[Haskell] New version of the HTTP module

Bjorn Bringert d00bring at dtek.chalmers.se
Wed Mar 17 11:18:29 EST 2004


Graham Klyne wrote:
> I'm trying to check this out with some software that uses a previous 
> version (HXml toolbox), and I get the following error from Hugs:
> [[
> Reading file "..\http\Browser.hs":
> Type checking
> ERROR "..\http\Browser.hs":865 - Type error in application
> *** Expression     : ioAction $ openTCP hst
> *** Term           : ioAction
> *** Type           : IO a -> BrowserAction a
> *** Does not match : (Int -> IO Connection) -> BrowserAction a
> ]]
> 
> It appears that the signature for "openTCP" has changed...
> 
> Previous version (HTTP.hs):
> [[
> openTCP :: String -> IO Connection
> openTCP uri =
> ]]
> -- http://homepages.paradise.net.nz/warrickg/haskell/http/HTTP.hs
> 
> Latest version (HTTP.hs):
> [[
> openTCP :: String -> Int -> IO Connection
> openTCP uri port =
> ]]
> -- http://www.dtek.chalmers.se/~d00bring/haskell-xml-rpc/HTTP.hs
> 
> But this is referenced by the copy of Browser indicated from your web page:
> [[
>                              ; c <- ioAction $ openTCP hst
> ]]
> http://homepages.paradise.net.nz/warrickg/haskell/http/Browser.hs
> 
> I'm guessing that you also have a modified version of Browser.hs?
> 
> #g
> -- 
> 
> At 00:16 16/03/04 +0100, Bjorn Bringert wrote:
> 
>> The Haskell HTTP client implementation available from [1] seems to be 
>> without a maintainer (if anyone knows how to reach Warrick Gray, who 
>> wrote it, let me know).
>>
>> I include a modified version of this module in the XML-RPC library 
>> [2]. Changes from the original module include:
>>
>>     * made it Hugs compatible
>>     * disabled 100-continue transfers as they caused POST requests to
>>       HTTP/1.0 servers to stall
>>     * called it Network.HTTP instead of HTTP
>>     * added support for URIs with a port number
>>     * added a simple toggle for HTTP traffic logging
>>
>> The modified HTTP module is available from:
>>
>> http://www.dtek.chalmers.se/~d00bring/haskell-xml-rpc/http.html
>>
>> In line with Graham Klyne's suggestion [3] that a consistent version 
>> of this module be brought into some "community space", it will 
>> probably move to the haskell-libs project at SourceForge in the not 
>> too distant future.
>>
>>
>> Yours truly,
>>
>> Bjorn Bringert
>>
>>
>> [1] http://homepages.paradise.net.nz/warrickg/haskell/http/
>>
>> [2] http://www.dtek.chalmers.se/~d00bring/haskell-xml-rpc/
>>
>> [3] http://www.haskell.org/pipermail/libraries/2004-February/001693.html

Actually I don't have a modified version of Browser, since I have never
used that module :). Of course I should have realized that I would break
other software by adding a port argument to openTCP, but at the time I 
did that I had no idea that others would use it.

I have reverted the type of the exported openTCP to String -> IO
Connection, it now always uses port 80 like the old version did. Instead 
there is an internal function openTCPPort that takes a port number. I 
will try to have a look at the Browser module to see what needs to be 
done to make it support arbitrary port numbers and if it needs any other 
updates.

An updated version of HTTP.hs is available at 
http://www.dtek.chalmers.se/~d00bring/haskell-xml-rpc/HTTP.hs

Thanks for pointing that out.

/Bjorn



More information about the Haskell mailing list