how many messages should arrive using http:request with {self,once}?

Adam Kocoloski <>
Thu Jun 11 21:55:08 CEST 2009


Hi, on reading the http man page I figured that a request of the form

http:request(get, {"http://google.com",[]}, [], [{stream,  
{self,once}}, {sync,false}]).

would leave me with one {http, {Ref,stream_start,[Headers],Pid}}  
message in my mailbox, and that I'd call

http:stream_next(Pid)

repeatedly to get the rest of the response.  Instead I get a bunch of  
{http, _} messages immediately -- a stream_start, 2 streams, and a  
stream_end (in the case of google.com).  Did I misread the man page?   
Is the threshold at which I have to call stream_next(Pid) actually  
larger than a single message?  At the moment the only difference  
between {stream, self} and {stream, {self,once}} that I see is the  
extra Pid in the messages (which I don't use).  Best,

Adam


More information about the erlang-questions mailing list