
Hi folks, I was recently looking for HTTP client libraries for Haskell. I investigated several, and it seems that there aren't any really ready for primetime. Am I missing anything? Here's what I found: * Bjorn's String-based HTTP It eats RAM. Does not appear to read data lazily, returns a String, and may have a memory leak as well. Does not appear to be suited for anything except very small file downloads. * nominolo's ByteString port of Bjorn's HTTP Appears to exist only in a darcs repo linked from his personal blog. Makes me hesitant to use it in production code, for fear that it won't be around long-term. * tagsoup Broken in many ways. Does not support chunked encoding that is mandated by HTTP RFC. Will be incompatible with numerous HTTP servers, and the manual states as much. Port 80 hardcoded. * network-minihttp Doesn't appear to actually be very useful as a client. Also, as far as I have been able to deduce, none of these have built-in support for https (SSL) URLs. There is also a Curl binding (or two?) floating around, which I haven't investigated. It would be nicer to have a native Haskell solution. Or should I just go write one? -- John

Hi
* tagsoup
Broken in many ways. Does not support chunked encoding that is mandated by HTTP RFC. Will be incompatible with numerous HTTP servers, and the manual states as much. Port 80 hardcoded.
I'd just like to stress that the one in tagsoup shouldn't be used for anything! It is only there to be a demo of tagsoup parsing, since otherwise an HTML parser is a bit dull. The haddock currently says: "It is very restricted, and it not intended for proper use" I guess I can make the warning a bit more violent. (And fix the grammar...) As soon as someone decides what is the answer to your HTTP question, the one in tagsoup will be removed. Thanks Neil

On 27 mar 2008, at 20.08, John Goerzen wrote:
Hi folks,
I was recently looking for HTTP client libraries for Haskell. I investigated several, and it seems that there aren't any really ready for primetime. Am I missing anything? Here's what I found:
* Bjorn's String-based HTTP
It eats RAM. Does not appear to read data lazily, returns a String, and may have a memory leak as well. Does not appear to be suited for anything except very small file downloads.
* nominolo's ByteString port of Bjorn's HTTP
Appears to exist only in a darcs repo linked from his personal blog. Makes me hesitant to use it in production code, for fear that it won't be around long-term.
No, it also leaks handles. I am now convinced that a fold/enumerator- based interface is the best solution but haven't gotten around to implementing it. It also isn't particularly well-tested (closer to not at all). It was a proof-of-concept (and to test what improvements are possible), but we never had the time or energy to complete it.
* tagsoup
Broken in many ways. Does not support chunked encoding that is mandated by HTTP RFC. Will be incompatible with numerous HTTP servers, and the manual states as much. Port 80 hardcoded.
* network-minihttp
Doesn't appear to actually be very useful as a client.
Also, as far as I have been able to deduce, none of these have built-in support for https (SSL) URLs.
There is also a Curl binding (or two?) floating around, which I haven't investigated. It would be nicer to have a native Haskell solution. Or should I just go write one?
It would be a good summer of code project, but I don't know if someone will apply for it. Also, if you need it right now (or want to refer to a reliable implementation in your book) you probably don't want to count on that to work out.
-- John
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Thu, Mar 27, 2008 at 12:08 PM, John Goerzen
* Bjorn's String-based HTTP It eats RAM. Does not appear to read data lazily, returns a String, and may have a memory leak as well. Does not appear to be suited for anything except very small file downloads.
Do you know why it's eating RAM? With the issue with open sockets resolved (I know, I have to send that patch to Bjorn...), I haven't had observable stability or leaking issues. I'm using it to hit JSON/XML services like Twitter, del.icio.us, Google reader, etc. Laziness here is a bit of a mixed bag, since if you're too lazy, you'll try to read the stream after it's long gone. (Principle of Least Surprise) We do need a real (HTTPS, support for encoding, possibility to be lazy) HTTP client library, and a binding for libcurl may be the short path. -- paulrbrown@gmail.com http://mult.ifario.us/

paulrbrown+haskell-cafe:
On Thu, Mar 27, 2008 at 12:08 PM, John Goerzen
wrote: * Bjorn's String-based HTTP It eats RAM. Does not appear to read data lazily, returns a String, and may have a memory leak as well. Does not appear to be suited for anything except very small file downloads.
Do you know why it's eating RAM? With the issue with open sockets resolved (I know, I have to send that patch to Bjorn...), I haven't had observable stability or leaking issues. I'm using it to hit JSON/XML services like Twitter, del.icio.us, Google reader, etc.
Laziness here is a bit of a mixed bag, since if you're too lazy, you'll try to read the stream after it's long gone. (Principle of Least Surprise)
We do need a real (HTTPS, support for encoding, possibility to be lazy) HTTP client library, and a binding for libcurl may be the short path.
And we have a curl binding, already in wide use. http://code.haskell.org/curl.git/ a release to hackage is imminent.

On 2008-03-28, Don Stewart
paulrbrown+haskell-cafe: And we have a curl binding, already in wide use.
http://code.haskell.org/curl.git/
a release to hackage is imminent.
Do you mean this? http://hackage.haskell.org/cgi-bin/hackage-scripts/package/curl-1.3.1 Looks like it's not quite as current as your Git repo. -- John

Hi,
On Fri, Mar 28, 2008 at 6:42 AM, John Goerzen
On 2008-03-28, Don Stewart
wrote: paulrbrown+haskell-cafe:
And we have a curl binding, already in wide use.
http://code.haskell.org/curl.git/
a release to hackage is imminent.
Do you mean this?
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/curl-1.3.1
Looks like it's not quite as current as your Git repo.
Is this surprising? Hackage is not a revision control system. The curl package on hackage is a fairly recent version of the git repo. -Iavor

On 2008-03-30, Iavor Diatchki
Hi,
On Fri, Mar 28, 2008 at 6:42 AM, John Goerzen
wrote: On 2008-03-28, Don Stewart
wrote: paulrbrown+haskell-cafe:
And we have a curl binding, already in wide use.
http://code.haskell.org/curl.git/
a release to hackage is imminent.
Do you mean this?
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/curl-1.3.1
Looks like it's not quite as current as your Git repo.
Is this surprising? Hackage is not a revision control system. The curl package on hackage is a fairly recent version of the git repo.
No, but I was confirming that the Hackage package corresponds to the given Git repo. -- John

On Thursday 27 March 2008 04:38:21 pm Paul Brown wrote:
On Thu, Mar 27, 2008 at 12:08 PM, John Goerzen
wrote: * Bjorn's String-based HTTP It eats RAM. Does not appear to read data lazily, returns a String, and may have a memory leak as well. Does not appear to be suited for anything except very small file downloads.
Do you know why it's eating RAM? With the issue with open sockets
It appears to be insufficient laziness. You'll probably never notice it because you're only downloading small files. Trying to download a 20MB file resulted in 500MB RAM usage for me before I killed it. -- John

On Thu, Mar 27, 2008 at 12:08 PM, John Goerzen
* network-minihttp
Doesn't appear to actually be very useful as a client.
Also, as far as I have been able to deduce, none of these have built-in support for https (SSL) URLs.
The client doesn't do a lot, but I don't know what you would want from a client. Email me a list of use cases and ;) It does support HTTPS, however. See examples/webcat.hs AGL -- Adam Langley agl@imperialviolet.org http://www.imperialviolet.org

On 2008-03-27, Adam Langley
On Thu, Mar 27, 2008 at 12:08 PM, John Goerzen
wrote: * network-minihttp
Doesn't appear to actually be very useful as a client.
Also, as far as I have been able to deduce, none of these have built-in support for https (SSL) URLs.
The client doesn't do a lot, but I don't know what you would want from a client. Email me a list of use cases and ;)
You know, it actually looks very nice to me. I don't know what I was looking at before, but I've poked around at your sources a bit and I like what I see. The fact that I can get a result as a lazy ByteString is nice. Your Source type is an interesting approach, too. -- John

On Fri, Mar 28, 2008 at 6:40 AM, John Goerzen
Your Source type is an interesting approach, too.
I'm still not sure if it's actually a good idea. But if you do have any requests, I'm very open to them. I think that a fetchBasic which walks redirects would be a good start but, other than that, I'm rather distracted with elliptic curve groups at the moment. AGL -- Adam Langley agl@imperialviolet.org http://www.imperialviolet.org
participants (7)
-
Adam Langley
-
Don Stewart
-
Iavor Diatchki
-
John Goerzen
-
Neil Mitchell
-
Paul Brown
-
Thomas Schilling