[Haskell-cafe] Libraries for Commercial Users

Erik de Castro Lopo mle+hs at mega-nerd.com
Wed Oct 7 22:02:34 EDT 2009


Don Stewart wrote:

> > A version of Network.HTTP that accepts HTTPS URLs and does the right
> > thing instead of attempting to do a HTTP connection instead.
> 
> Yeah, we use the curl library for all our HTTPS stuff.

Well there is a big difference between Network.Curl and Network.HTTP.
HTTP is really easy to understand and use, while Curl is not.

What I would like to do is a POST operation to a HTTPS server with
Content-Type "text/xml" and then get the HTTP response code as well
as the body which is also "text/xml". This should be easy and should
be obvious, but unfortunately does not even seem to be supported by
Network.Curl.

The Network.Curl API is rather weird. It has a very sensible and
obvious GET function:

    curlGetString :: URLString -> [CurlOption] -> IO (CurlCode, String)

but no corresponding POST function. Instead it has:

    curlPost :: URLString -> [String] -> IO ()
    curlMultiPost :: URLString -> [CurlOption] -> [HttpPost] -> IO ()

both of which seem to only support x-www-form-urlencoded data and not
text/xml. Furthermore, whats with the 'IO ()' result? Wouldn't it make
more sense to return 'IO (CurlCode, String)' like curlGetString?

I don't like to be critical of other people's projects, but Network.Curl
seems to be one huge ball of confusion.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the Haskell-Cafe mailing list