[erlang-questions] erlang http tcp_closed problem
Przemysław Wycisk
p.wycisk@REDACTED
Thu Feb 12 10:36:48 CET 2015
The reason of that behaviour was option packet_size on socket. Default set
of this option ({packet_size, 0}) should mean no size (line size in http)
limit shouldn't it?, but packets were dropped because of large cookie
header.
I consider it as a bug, and also i think that if line size limit in http
socket occurs i should get http_error instead of tcp_closed, it's quite
confusing.
On Sun, Feb 8, 2015 at 7:25 PM, Przemysław Wycisk <p.wycisk@REDACTED>
wrote:
> I've got problem with using erlang active http socket.
>
> I receive msgs like that:
>
> ok = inet:setopts(Sock,[{active, true}]),
> receive
> {http, Sock, {http_request, HttpMethod, {abs_path, Path}, _HttpVersion}} ->
> Headers = getHeaders(Sock),
> %more code
>
> and then headers like that:
>
> getHeaders(Sock, Headers) ->
> receive
> {http, Sock, {http_header, _Num, 'Content-Length', _, Value}} ->
> NewHeaders = Headers#'headers'{contentLength = Value},
> getHeaders(Sock, NewHeaders);
> {http, Sock, {http_header, _Num, 'Host', _, Value}} ->
> NewHeaders = Headers#'headers'{host = Value},
> getHeaders(Sock, NewHeaders);
> {http, Sock, {http_header, _Num, 'User-Agent', _, Value}} ->
> NewHeaders = Headers#'headers'{userAgent = Value},
> getHeaders(Sock, NewHeaders);
> %more headers here
> %
>
> {http, Sock, {http_error, Error}} ->
> ?LOG_INFO("protocol", "http returned error with reason:~p~n", [Error]),
> exit(normal);
> {http, Sock, http_eoh} ->
> Headers;
> {tcp_closed, Sock} -> %<a mark>
> ?LOG_INFO("connection", "Socket ~w closed by client", [Sock]),
> exit(normal);
> _Else ->
> getHeaders(Sock, Headers)
> end.
>
>
> Normally it works fine, packets and headers are received from browser and
> everyone is happy, but there is a case, when a browser sends a request, and
> then i get "tcp_closed" in place where <a mark> is placed, in the middle of
> receiving headers.
>
> This behaviour is strange for me, because it never happens in incognito
> mode. That could mean that bowsers cache is involved in the problem, but
> how?
>
> Anyone had the same problem? Anyone could help? I would be grateful.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150212/16bcf272/attachment.htm>
More information about the erlang-questions
mailing list