
"Warrick Gray"
writes: I've been tinkering with a client-side HTTP/1.1 implementation for Haskell. [..] In the interests of finding all bugs and giving something for nothing I've made the code available:
Thanks I think it is a nice library.
Significantly missing is any hint of SSL and request pipelining. Suggestions on improvements are welcome.
I tried HTTP.hs and Base64.hs a little and they seem to work well so far.
I think your http library would make a useful addition to the Haskell libraries, at least as a starting point for a standard HTTP library.
I've asked Warrick if he'd like to incorporate his HTTP client implementation into the hierarchical libraries, and maintain it. He's happy to do that. Does anyone have any objections or comments? The HTTP module itself can go in Network.Protocols.HTTP, and Browser maybe in Network.Protocols.HTTP.Browser. Base64 is a little more generic - perhaps FileFormat.Base64? Cheers, Simon

Simon Marlow wrote:
...
The HTTP module itself can go in Network.Protocols.HTTP, and Browser maybe in Network.Protocols.HTTP.Browser. Base64 is a little more generic - perhaps FileFormat.Base64?
How about FileFormat.Encoding.Base64? In the future, FileFormat.Encoding.QuotedPrintable FileFormat.Encoding.Gzipped FileFormat.Encoding.Yenc Text.Encoding.Rot13 Regards, Matt Harden

I think I found an issue with the HTTP.hs library when
making a short-lived non-persistent connection to a server
from a slower machine (i486). I can also reproduce it by
running my program with strace or ltrace on a faster machine
(PIII).
My program just uses "simpleHTTP" to read a status page from
my ADSL router modem. Here a code fragment:
getStatus :: String -> String -> IO (Maybe (Status, Maybe PPPAddresses))
getStatus url auth =
do
resresp <- getStatusPage url auth
case resresp of
Left err -> print err >> return Nothing
Right resp -> return $ Just $ extractStatus $ rspBody resp
getStatusPage :: String -> String -> IO (Result Response)
getStatusPage url auth =
case parseURI url of
Just uri ->
do
let defaultreq = Request uri GET [] ""
authval = "Basic " ++ encode auth
reqauth = insertHeader HdrAuthorization authval defaultreq
simpleHTTP reqauth
Nothing ->
error $ "getStatusPage: Bad url: " ++ url
Below is some ltrace output. I'm using ghc-5.02.3 on Linux.
Jens
__libc_start_main(0x080c8ff8, 1, 0xbffff794, 0x08049080, 0x080d9090
participants (3)
-
Jens Petersen
-
Matt Harden
-
Simon Marlow