[
https://issues.apache.org/jira/browse/COUCHDB-595?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Newson reopened COUCHDB-595:
-----------------------------------
Below is a script to reproduce the problem.
Curl sends this;
> PUT /db1/doc1/att HTTP/1.1
> User-Agent: curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4
> OpenSSL/0.9.8k zlib/1.2.3
> Host: localhost:5984
> Accept: */*
> Content-Length: 61440
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
at this point, curl waits for COUCHDB to send;
HTTP/1.1 100 CONTINUE
But couchdb never sends this.
Curl, after a couple of seconds, gives up waiting and sends the body anyway.
Once this is sent, CouchDB responds with;
* Done waiting for 100-continue
< HTTP/1.1 201 Created
< Server: CouchDB/0.11.0b22c551bb-git (Erlang OTP/R13B)
< Location: http://localhost:5984/db1/doc1/att
< Date: Fri, 18 Dec 2009 20:26:38 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 67
< Cache-Control: must-revalidate
<
{"ok":true,"id":"doc1","rev":"1-a58ec7b4f38399400e6e9bcd9e87f2a1"}
The fix is to immediately return "HTTP/1.1 100 CONTINUE" on receipt of the end
of headers (the \r\n\r\n sequence) or a final error code, if the client
included an Expect: 100-continue header
#!/bin/sh
URL=http://localhost:5984
dd if=/dev/zero of=att bs=60k count=1
curl -X DELETE $URL/db1
curl -X PUT $URL/db1
for COUNT in {0..100000}
do
curl -X PUT -d '{"text":"some text goes here, oh yes."}' $URL/db1/doc$((COUNT
* 2))
curl -v -X PUT --data-binary @att $URL/db1/doc$((COUNT * 2 + 1))/att
done
> Expect/Continue support broken for non-chunked transfer uploads
> ---------------------------------------------------------------
>
> Key: COUCHDB-595
> URL: https://issues.apache.org/jira/browse/COUCHDB-595
> Project: CouchDB
> Issue Type: Bug
> Components: Database Core
> Reporter: Robert Newson
>
> CouchDB does not send the "HTTP/1.1 100 CONTINUE\r\n" line in response to a
> request with header "Expect: 100-continue". It does do so for chunked
> transfer mode, so correct expect/continue behavior can be achieved by forcing
> chunked mode, even when the exact length of the body is known.
> mochiweb_request.erl's recv/1 method does not send the header, but
> stream_body/4 does.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.