Inets httpd hangs when there is only one HeaderOption

Felix Lange <>
Sun Mar 7 10:59:16 CET 2010


Hello list,

the inets reference manual states that the return value of 
Module:do/1 should match (snipped):

NewData = [{response,{StatusCode,Body}}] 
        | [{response,{response,Head,Body}}] 
        | [{response,{already_sent,Statuscode,Size}}]
Head = [HeaderOption]
HeaderOption = {Option, Value} | {code, StatusCode}

I generate the return value using a function such as this:
response(Code, Headers, Content) ->
    {proceed, [{response, {response, [{code, Code} | Headers], format_xhtml(Content)}}]}.

When Headers is the empty list, the server fails to send
the body in full, only the half of it mysteriously gets through.
Btw, this doesn't happen if i use:
    {proceed, [{response, {Code, format_xhtml(Content)}}]}

It's also worth noting that this section of the manual is flawed in
other respects, i.e. the mod record is missing the init_data field.

$ curl -v http://localhost:50601
* About to connect() to localhost port 50601 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 50601 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.6 (i686-pc-linux-gnu) libcurl/7.19.6 OpenSSL/0.9.8l zlib/1.2.3
> Host: localhost:50601
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: inets/5.3
< Content-Type: text/html
< Date: Sun, 07 Mar 2010 09:38:58 GMT
* no chunk, no close, no size. Assume close to signal end
<
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>foo</title></head>



More information about the erlang-questions mailing list