[Haskell-cafe] Error in HTTP 4.004 + CouchDB?
Alex Ott
alexott at gmail.com
Thu Jan 22 14:32:26 EST 2009
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:
PUT http://127.0.0.1:5984/test1/Users_ott_tmp_1_tst HTTP/1.1
Content-Type: ...
...
Host: 127.0.0.1:5984
...
instead of proper
PUT /test1/Users_ott_tmp_1_tst HTTP/1.1
I can eliminate this by explicitly setting of the scheme & authority into
empty values, but this lead to improper creation of the Host header in
request:
PUT /test1/Users_ott_tmp_1_tst HTTP/1.1
Content-Type: ...
...
Host:
...
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 )
--
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/ http://xtalk.msk.su/~ott/
http://alexott-ru.blogspot.com/
More information about the Haskell-Cafe
mailing list