[erlang-questions] Are you using {packet, http} ?

Christian S <>
Wed Jul 23 15:14:54 CEST 2008


>>
>> You change into plain mode after the end of headers arrive.
>>
>> It is a little bit annoying that no chunked-mode body exists.
>> Implementable in erlang though.
>
>
>
> Thank you for your reply Christian,
> You mean It automatically swiches in? If we originally set [binary, {packet,
> http}] then after end of header to what form it will be swiches to.
>       for an example {packet, 0}
>       and are we getting the rest as {tcp, Socket, Bin}

No, you do
  inet:setopts(Sock, [{packet, raw}]),
when you get http_eoh

Find some code that uses this and read it. Suggested example:

http://www.tornkvist.org/gitweb?p=iserve.git;a=blob;f=src/iserve_socket.erl;h=6b0c0f5c37f75b7a8236029f23d8cac78f1e2b42;hb=HEAD

Notice how it only sports an unencoded body (a size specified in a
content length header) and chunked encoding POSTing would make it cry.



More information about the erlang-questions mailing list