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

Graham Klyne GK at ninebynine.org
Mon Feb 21 09:58:30 EST 2005


Hmmm...  FWIW, I've been using a lightly modified version of Bjorn's 
version of HTTP in a modified HaXml parser, and it worked fine for 
accessing external entities.  But that almost certainly did not involve 
receiving zero bytes.

#g
--

At 16:58 18/02/05 -0600, John Goerzen wrote:

>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
>_______________________________________________
>Haskell-Cafe mailing list
>Haskell-Cafe at haskell.org
>http://www.haskell.org/mailman/listinfo/haskell-cafe

------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Haskell-Cafe mailing list