[Haskell-cafe] Re: Strange HTTP module behavior [PATCH]
John Goerzen
jgoerzen at complete.org
Fri Feb 18 17:58:26 EST 2005
On Fri, Feb 18, 2005 at 11:36:57PM +0100, Bjorn Bringert wrote:
> John Goerzen wrote:
> >It turns out that Network.Socket.recv raises an EOF error when it gets
> >back 0 bytes of data. HTTP is expecting it to return an empty list for
> >some reason.
> >
> >The below patch fixed it for me.
> > [...]
>
> Hmm, strange. Is that recv behavior a bug or a feature?
I don't know, but it's explicitly there whatever it is. From ghc
6.2.2:
let len' = fromIntegral len
if len' == 0
then ioError (mkEOFError "Network.Socket.recv")
else peekCStringLen (ptr,len')
It appears this change was committed to fptools in version 1.26 of
Socket.hsc on July 15, 2002.
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/network/Network/Socket.hsc.diff?r1=1.25;r2=1.26;f=h
Which arguably is not what one would expect recv to do, and in any case
is undocumented at
http://www.haskell.org/ghc/docs/latest/html/libraries/network/Network.Socket.html#v%3Arecv
Still, 2002 was awhile back, so I'm still surprised nobody else noticed.
-- John
More information about the Haskell-Cafe
mailing list