From 8a0a05434e0e5cb2760958ae78f5685a45624252 Mon Sep 17 00:00:00 2001 From: Ethan Ferguson Date: Fri, 26 Jan 2024 10:42:11 -0500 Subject: [PATCH] Fixed Request Body reading --- 1991.fs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/1991.fs b/1991.fs index 8ea2273..d8602f2 100644 --- a/1991.fs +++ b/1991.fs @@ -347,11 +347,17 @@ s" image/x-icon" filetype: ico 0 then ; +: substring-to-end ( index c-addr u -- c-addr u ) + rot dup rot swap - rot rot + swap ; + : read-request-body ( socket u -- ) \ Takes the socket and the length of the \ body (Content-Length). - here swap aligned read-socket - set-request-body ; + 2over swap drop swap - + 2over substring-to-end + set-request-body + drop ; + : read-request ( socket -- addr u ) \ Returns the request header \ but also collects the request body.