[Haskell-cafe] Error in HTTP 4.004 + CouchDB?

Sigbjorn Finne sigbjorn.finne at gmail.com
Fri Jan 23 01:51:13 EST 2009

Thanks Alex,

contacting the maintainer of a package rather than author is probably
the best course of action in general. They may both be out of date,
but the former maybe less so. :)

As verified offline, you issue this request via sendHTTP when experiencing
this misbehavior.

A couple of suggestions on what to do:

 * Use Network.Browser instead and send it via (browse $ request req),
    which will normalize the path and Host: headers as you expect for 
 * pull down the latest bits from the repository and normalize your request
    prior to calling sendHTTP by using

         (Network.HTTP.Base.normalizeRequest False{-no proxy-} req)

    (we're in a tight spot wrt. backwards compatibility for sendHTTP, so 
     it perform this normalization step by default would break code that 
now interacts
    with proxies via sendHTTP.)

The repository version also has support for custom request verbs, which 
might be
of interest&use to some.

Let me know how it goes -- git repository URL available via 


On 1/22/2009 11:32, Alex Ott wrote:
> Hello
> (i sent this message to the mail of author, specified at hackage, but it
> returned to me, so i decided to resend it here)
> I found strange thing during work with latest versions of CouchDB & HTTP
> module on my Mac OS X 10.4. The problem is, that when i send document to
> the couchdb server, it name was cut to the 2 characters.
> After some investigation i found, that this is problem in combination of
> the CouchDB + HTTP usage.  CouchDB module fills out the Request structure,
> and specify scheme & authority fields.  This lead that i see (in network
> dumps) following data:
> I tried to fix this problem myself, but I'm novice in the industrial
> Haskell programming ;-)
> P.S. this code from (CouchDB/HTTP.hs) will restore proper behaviour of the
> code, but break Host header
> makeURL path query = CouchMonad $ \conn -> do
>   return ( (ccURI conn) { uriPath = '/':path
>                         , uriQuery = if null query then "" else '?':(urlEncodeVars query)
>                         , uriScheme = ""
>                         , uriAuthority = Nothing
>                         }
>          ,conn )

More information about the Haskell-Cafe mailing list