Open GeJ opened 6 years ago
I tried to dig further. Looking at HTTP::Parser, one can read at line 97 :
# >0: header size
# -1: failed
# -2: request is partial
sub parse-http-request(Blob $req is copy) is export {
But the comments in HTTP::Server::Tiny (at line 186) say :
} elsif $header_len == -1 { # incomplete header
debug 'incomplete header' unless DEBUGGING;
} elsif $header_len == -2 { # invalid request
self!send-response(400, [], ['Bad request']);
Isn't there a discrepancy here?
No taker? I guess I'm the only one who is experiencing this issue after all.
FYI, after some further debugging, if I invert the logic with the elsif $header_len == -1
and -2
, the test passes successfully.
I've had this error for quite a while but since nobody had reported it, I thought that the error came from my setup.
However, today while trying to build HTTP-Server-Tiny and bumping into the same error again, I had a look at #63 and it was pretty similar (except that I'm not using Docker, but running FreeBSD).
I'm new at Perl6 so any hint or pointer to debug this issue are more than welcome.
That said, I activated HST_DEBUG and here is the result :
The server's response being :
HTTP/1.0 400 Bad Request\r\nserver: HTTP::Server::Tiny\r\ndate: Wed, 04-Oct-2017 12:05:59 GMT\r\n\r\nBad request
But, if I group the request headers up to (and including) the standalone CRLF in one string like this :
Then the test runs successfully with the following debugging information :
Now I'm not sure if the problem comes from HTTP::Server::Tiny or HTTP::Parser. Any idea?