No 400 response

Mark Smith smitty at gmail.com
Thu Feb 21 23:37:47 UTC 2008


> Hey, all. I just noticed that if I send a botched request, I
>  don't get a 400 response as I'd expect:
>
>     [edaly at db-01 Perlbal]$ telnet localhost 8080
>     Trying 127.0.0.1...
>     Connected to localhost.
>     Escape character is '^]'.
>     BOTCHED REQUEST
>
>     Connection closed by foreign host.
>
>  I think the bailout is at line 264 of Socket.pm:
>
>     unless (($is_res ? $self->{res_headers} : $self->{req_headers}) =
>                 Perlbal::HTTPHeaders->new(\$hstr, $is_res)) {
>         # bogus headers?  close connection.
>         print "  bogus headers\n" if Perlbal::DEBUG >= 3;
>         return $self->close("parse_header_failure");
>     }
>
>  It looks intentional. Any reason why it doesn't return a 400
>  instead?

It is intentional...

Honestly I don't remember why this decision was made.  What does the
HTTP spec say in this regard?  If you get bad headers, are there any
directives that you MUST send a 400 or something?

In particular, would be interesting to see if HTTP 1.0 agrees with 1.1
or if they differ, and perhaps to see what other servers do.  IIS,
Apache, lighttpd, etc...


-- 
Mark Smith / xb95
smitty at gmail.com


More information about the perlbal mailing list