[Haskell-cafe] Re: Strange HTTP module behavior [PATCH]

John Goerzen jgoerzen at complete.org
Mon Feb 21 09:17:29 EST 2005


On Mon, Feb 21, 2005 at 10:43:33AM +0000, Keith Wansbrough wrote:
> John Goerzen wrote:
> 
> > It turns out that Network.Socket.recv raises an EOF error when it gets
> > back 0 bytes of data.
> 
> As it should... recv(2) returns zero bytes precisely when it reaches
> EOF; this is the standard sockets-API EOF indicator.  See any sockets
> tutorial.

Of course.  That's why I'm saying the exception is unexpected.  recv()
doesn't return -1 (indicating an error); it just returns an empty list.
For what seems like a direct binding to a low-level call, this action is
surprising.  If it were documented in the fptools haddock docs, it
probably wouldn't surprise me.  But as someone that is used to the C
API, that behavior is surprising.

> >  HTTP is expecting it to return an empty list for
> > some reason.
> 
> That is odd; HTTP must be broken.


More information about the Haskell-Cafe mailing list