You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Shahar Evron (JIRA)" <ji...@apache.org> on 2008/04/17 22:37:22 UTC

[jira] Updated: (COUCHDB-42) Sending "Content-length: 0" in PUT requests causes connection to close

     [ https://issues.apache.org/jira/browse/COUCHDB-42?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shahar Evron updated COUCHDB-42:
--------------------------------

    Description: 
CouchDb built from trunk rev. 649048

When sending a PUT request with no body and "Content-length: 0" header, the connection is closed by the HTTP server after the response is received. This happens when creating a new DB for example (no body is sent).

For example from telnet:
---- code ----
$ telnet localhost 5984
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
PUT /test_db HTTP/1.1
Host: localhost

HTTP/1.1 201 Created
Transfer-Encoding: chunked
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Thu, 17 Apr 2008 20:33:40 GMT
Content-Type: text/plain;charset=utf-8

b
{"ok":true}
0
---- end code ----

In the above example the connection is not closed and all is fine.  However:

---- code ----
PUT /test_db2 HTTP/1.1
Host: localhost
Content-length: 0

HTTP/1.1 201 Created
Transfer-Encoding: chunked
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Thu, 17 Apr 2008 20:33:59 GMT
Content-Type: text/plain;charset=utf-8

b
{"ok":true}
0

Connection closed by foreign host.
---- end code ----


  was:
CouchDb built from trunk rev. 649048

When sending a PUT request with no body and "Content-length: 0" header, the connection is closed by the HTTP server after the response is received. This happens when creating a new DB for example (no body is sent).

For example from telnet:
{code}
$ telnet localhost 5984
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
PUT /test_db HTTP/1.1
Host: localhost

HTTP/1.1 201 Created
Transfer-Encoding: chunked
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Thu, 17 Apr 2008 20:33:40 GMT
Content-Type: text/plain;charset=utf-8

b
{"ok":true}
0
{code}
In the above example the connection is not closed and all is fine.  However:
{code}
PUT /test_db2 HTTP/1.1
Host: localhost
Content-length: 0

HTTP/1.1 201 Created
Transfer-Encoding: chunked
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Thu, 17 Apr 2008 20:33:59 GMT
Content-Type: text/plain;charset=utf-8

b
{"ok":true}
0

Connection closed by foreign host.
{code}



> Sending "Content-length: 0" in PUT requests causes connection to close
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-42
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-42
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>         Environment: Linux/Gentoo i386, glibc 2.7
>            Reporter: Shahar Evron
>
> CouchDb built from trunk rev. 649048
> When sending a PUT request with no body and "Content-length: 0" header, the connection is closed by the HTTP server after the response is received. This happens when creating a new DB for example (no body is sent).
> For example from telnet:
> ---- code ----
> $ telnet localhost 5984
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> PUT /test_db HTTP/1.1
> Host: localhost
> HTTP/1.1 201 Created
> Transfer-Encoding: chunked
> Server: MochiWeb/1.0 (Any of you quaids got a smint?)
> Date: Thu, 17 Apr 2008 20:33:40 GMT
> Content-Type: text/plain;charset=utf-8
> b
> {"ok":true}
> 0
> ---- end code ----
> In the above example the connection is not closed and all is fine.  However:
> ---- code ----
> PUT /test_db2 HTTP/1.1
> Host: localhost
> Content-length: 0
> HTTP/1.1 201 Created
> Transfer-Encoding: chunked
> Server: MochiWeb/1.0 (Any of you quaids got a smint?)
> Date: Thu, 17 Apr 2008 20:33:59 GMT
> Content-Type: text/plain;charset=utf-8
> b
> {"ok":true}
> 0
> Connection closed by foreign host.
> ---- end code ----

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.