[erlang-questions] inet:setopts({packet, http}) for RTSP

Sverker Eriksson sverker@REDACTED
Mon Nov 16 15:05:40 CET 2009

Max Lapshin wrote:
> Yes, I have next problem with uncommon use of http packet mode.
> As it is impossible to use {packet, http} for reading non-HTTP
> request, I set {packet, line}, {active, once} to read first line of
> request,
> then I make {active, once}, {packet, httph_bin} to receive several
> lines of real http headers.
> When I get http_eoh, I switch to {packet, raw}, {active, once} and
> next received message is http_error.
> Trace dump shows me that message box is full of http_error messages:
> {active, once} doesn't limit
> http packetizer input and body gets into http parser.
That doesn't seem right. If you want to trouble shoot this (which I do 
not have time for at the moment), you should look in 

This if-statement in tcp_reply_data() and tcp_reply_binary_data()

if (desc->inet.active == INET_ONCE)
    desc->inet.active = INET_PASSIVE;

should make it revert to passive mode after each received packet.

/Sverker, Erlang/OTP Ericsson

More information about the erlang-questions mailing list