CouchDB
  1. CouchDB
  2. COUCHDB-48

Invalid character in request causes double HTTP response -- 200 and 500

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7.2
    • Fix Version/s: 0.8
    • Component/s: HTTP Interface
    • Labels:
      None
    • Environment:

      Debian (/etc/debian_version says lenny/sid, can never keep their versioning straight). Running CouchDB built from today's source. Accessing via ClouchDB.

      Description

      I inadvertently created a document with an ID which contains the sequence "%da", which when URL-decoded is apparently not a valid UTF-8 character. Instead of receiving the appropriate error, I got an HTTP 200 followed by an HTTP 500, both in response to the same request.

      Additionally, the document seems to have been created, since accessing certain pages of the list of documents in the built-in web interface causes the same 500 error to show up in the CouchDB logs.

      Here is a Wireshark capture which explains the issue:

      GET /mnemosyne/id-containing-the-sequence-%da HTTP/1.1

      Host: localhost:5984

      User-Agent: Drakma/0.11.5 (SBCL 1.0.12; Linux; 2.6.22-2-686; http://weitz.de/drakma/)

      Accept: /

      Connection: close

      HTTP/1.1 200 OK

      Transfer-Encoding: chunked

      Server: MochiWeb/1.0 (Any of you quaids got a smint?)

      Etag: "2795559181"

      Date: Tue, 29 Apr 2008 03:09:58 GMT

      Content-Type: text/plain;charset=utf-8

      HTTP/1.1 500 Internal Server Error

      Transfer-Encoding: chunked

      Server: MochiWeb/1.0 (Any of you quaids got a smint?)

      Date: Tue, 29 Apr 2008 03:09:58 GMT

      Content-Type: text/plain;charset=utf-8

      3b

      {"error":"EXIT","reason":"{ucs,{bad_utf8_character_code}}"}

      0

        Activity

        Hide
        Jacob Torrey added a comment -

        When run from SVN (r. 655820) it properly gives a 404 error:

        GET /test_suite_db_a/foo%da HTTP/1.1

        HTTP/1.1 404 Object Not Found
        Transfer-Encoding: chunked
        Server: MochiWeb/1.0 (Any of you quaids got a smint?)
        Date: Tue, 13 May 2008 11:27:03 GMT
        Content-Type: text/plain;charset=utf-8

        28

        {"error":"not_found","reason":"missing"}

        0

        Show
        Jacob Torrey added a comment - When run from SVN (r. 655820) it properly gives a 404 error: GET /test_suite_db_a/foo%da HTTP/1.1 HTTP/1.1 404 Object Not Found Transfer-Encoding: chunked Server: MochiWeb/1.0 (Any of you quaids got a smint?) Date: Tue, 13 May 2008 11:27:03 GMT Content-Type: text/plain;charset=utf-8 28 {"error":"not_found","reason":"missing"} 0
        Hide
        Christopher Lenz added a comment -

        Yeah, as this seems to work okay in trunk (maybe since the move to MochiWeb?), this issue can be closed.

        Show
        Christopher Lenz added a comment - Yeah, as this seems to work okay in trunk (maybe since the move to MochiWeb?), this issue can be closed.
        Hide
        Sam Bisbee added a comment -

        Resolved for a while now. Closing.

        Show
        Sam Bisbee added a comment - Resolved for a while now. Closing.

          People

          • Assignee:
            Unassigned
            Reporter:
            Eli Naeher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development