Fixed Request Body reading

This commit is contained in:
Ethan Ferguson 2024-01-26 10:42:11 -05:00
parent b1f03d4e41
commit 8a0a05434e
No known key found for this signature in database
GPG Key ID: 876F56AB5F896F90
1 changed files with 8 additions and 2 deletions

10
1991.fs
View File

@ -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.