[erlang-questions] gen_tcp and large HTTP headers

Steve Vinoski vinoski@REDACTED
Wed Jun 22 23:15:56 CEST 2011


Looking at the packet parser, I'm thinking it always treats this case
as HTTP version 0.9, so that's wrong as well. Can you verify that
major and minor are set to 0 and 9 respectively in the version tuple
within the http_request tuple you get?

--steve

On Wed, Jun 22, 2011 at 4:25 PM, Roberto Ostinelli <roberto@REDACTED> wrote:
> hi steve,
>
> it does look so indeed. i actually do receive the http_request message:
>
> {http, Sock, {http_request, Method, Path, Version}}
>
> even though the GET request has obviously been shortened, so that the
> remaining part of the GET request gets passed over and then generates the
> http_error message while parsing headers.
>
> i guess i actually should not receive the http_request message, since the
> GET header is incomplete.
>
>
> 2011/6/22 Steve Vinoski <vinoski@REDACTED>
>>
>> IMO this is really a bug in the http packet parser. Setting recbuf
>> might work for this example but if you get a larger URI then it will
>> obviously fail, as you can't set it large enough.
>>
>> For this case the packet parser must realize the http request line is
>> incomplete and complete the parsing only once the whole request line
>> arrives. Getting this completely right might well require allowing a
>> way for the application to control how long a URI it wants to allow,
>> since if the parser just keeps reading in packets to find the end of
>> the request line someone could deny service by just sending request
>> packets that contain a really really long URI.
>>
>> --steve
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>



More information about the erlang-questions mailing list