[erlang-questions] How to get binaries when using {packet, http}

Oscar Hellström oscar@REDACTED
Wed Jan 21 10:54:31 CET 2009


Hi,

Doesn't the combination [binary, {packet, http}] mean that if the socket
is changed to return raw packets later they will be returned as binaries
while if it was opened with [list, {packet, http}] recv or setting it to
active  will give you list. This is useful when you want to read the
http body as a binary rather than a list. Or is there some other way of
changing it from a list to a binary later?

Sverker Eriksson wrote:
> No, there is currently no way to get the "strings" in the http-tuples as 
> binaries instead of lists.
>
> The obvious combinations of options to achieve that would be 
> [binary,{packet,http}]. But due to fear of breaking running applications 
> (such as Yaws and Mochiweb) it was not done when {packet, http} was 
> documented and made official. Consider it an invalid combination and do 
> not use it.
> No decision has been made about introducing http-binaries in this or any 
> other way.
>
> /Sverker, Erlang/OTP Ericsson
>
>
> Sergey S wrote:
>   
>> Hello.
>>
>> I discovered that no matter which type of incoming data you choose
>> (binary/list), all the data is delivered as lists.
>>
>> Is there a way to get binaries instead of lists?
>>
>> If not, is this behaviour going to be changed? In other words, will
>> there be a way to get binaries using {packet, http}?
>>
>> Thanks.
>>
>> --
>> Sergey
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
>>   
>>     
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>   

Best regards

-- 
Oscar Hellström, oscar@REDACTED
Office: +44 20 7655 0337
Mobile: +44 798 45 44 773
Erlang Training and Consulting
http://www.erlang-consulting.com/




More information about the erlang-questions mailing list