[erlang-questions] getting the path of an http request as binary

Pablo Platt pablo.platt@REDACTED
Thu Feb 11 15:50:32 CET 2010


Digging further I found that mochiweb_http:loop/2 set
inet:setopts(Socket, [{packet, http}])

So I guess replacing it should work:
inet:setopts(Socket, [{packet, http_bin}])

There are probably places where mochiweb expects lists and not binaries but it'll be easy to fix




________________________________
From: Pablo Platt <pablo.platt@REDACTED>
To: Sverker Eriksson <sverker@REDACTED>
Cc: erlang-questions@REDACTED
Sent: Thu, February 11, 2010 4:42:51 PM
Subject: Re: [erlang-questions] getting the path of an http request as binary


>> Is it possible to get the Path as binary without having to convert  it?
>Socket option {packet, http_bin}

In mochiweb_socket_server/init the BaseOpts have {packet, 0}
Which according to the inet docs means that "no packaging is done".

What will replacing {packet, 0} with {packet, http_bin}do?
I probably can't expect it to just work.





________________________________
From: Sverker Eriksson <sverker@REDACTED>
To: Pablo Platt <pablo.platt@REDACTED>
Cc: erlang-questions@REDACTED
Sent: Thu, February 11, 2010 4:24:07 PM
Subject: Re: [erlang-questions] getting the path of an http request as binary

Pablo Platt wrote:
> Hi
>
> mochiweb uses:
> gen_tcp:recv(Socket, 0, ?REQUEST_RECV_TIMEOUT)
> which result with:
> {ok, {http_request, Method, Path, Version}}
> where the Path is a list.
>
> Is it possible to get the Path as binary without having to convert it?
>
>  
Socket option {packet, http_bin}

> Are there docs about http_binary packet parser in R13B03?
>
>  
inet:setopts/2
erlang:decode_packet/3

/Sverker, Erlang/OTP Ericsson


________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED


      


More information about the erlang-questions mailing list