CouchDB
  1. CouchDB
  2. COUCHDB-335

More 500 errors for malformed client requests

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: HTTP Interface
    • Labels:
      None
    • Environment:

      SVN trunk "0.10.0a768591"

    • Skill Level:
      Regular Contributors Level (Easy to Medium)

      Description

      Here are four more cases where malformed client requests can return "500 Internal Server Error" (as shown by curl -v) with an unhelpful diagnostic message.

      $ curl -X PUT http://127.0.0.1:5984/test

      {"ok":true}

      $ curl -X POST -d '

      {"docs":[1,2,3]}

      ' http://127.0.0.1:5984/test/_bulk_docs

      {"error":"unknown_error","reason":"function_clause"}
          1. 500 Internal Server Error

      $ curl -X POST -d '{"docs":{"foo":"bar"}}' http://127.0.0.1:5984/test/_bulk_docs

      {"error":"unknown_error","reason":"function_clause"}
          1. 500 Internal Server Error

      $ curl -X POST -d '[]' -H 'Content-Type: application/json' http://127.0.0.1:5984/test/_temp_view

      {"error":"badmatch","reason":""}
          1. 500 Internal Server Error

      $ curl -X POST -d '{}' -H 'Content-Type: application/json' http://127.0.0.1:5984/test/_temp_view
      {"error":"badmatch","reason":"nocatch,{compilation_error,<<\"expression does not eval to a function. (undefined)\">>,\n [

      {couch_os_process,prompt,2}

      ,\n

      {couch_query_servers,'-start_doc_map/2-fun-0-',2}

      ,\n

      {lists,foreach,2}

      ,\n

      {couch_query_servers,start_doc_map,2}

      ,\n

      {couch_view_updater,view_compute,2}

      ,\n

      {couch_view_updater,update,1}

      ]}"}

          1. 500 Internal Server Error

      See also COUCHDB-320 which gives another way to elicit a 500:

      curl -X POST -d '{"map":"function(){}"}' http://127.0.0.1:5984/test/_temp_view

      {"error":"incorrect_mime_type","reason":"application/x-www-form-urlencoded"}
          1. 500 Internal Server Error
      1. error-tests.js
        2 kB
        Brian Candler

        Activity

        Hide
        Paul Joseph Davis added a comment -

        Thanks for the reports. Would it be possible for you to generate a test suite patch so that I don't make more mistakes when translating the curl errors?

        I'm at a conference and I can't commit a whole bunch of time to this but failing tests would be helpful to make sure that I'm fixing exactly what you've found.

        Show
        Paul Joseph Davis added a comment - Thanks for the reports. Would it be possible for you to generate a test suite patch so that I don't make more mistakes when translating the curl errors? I'm at a conference and I can't commit a whole bunch of time to this but failing tests would be helpful to make sure that I'm fixing exactly what you've found.
        Hide
        Brian Candler added a comment -

        Test cases for errors 1-3 attached.

        I'm not sure what you want to return for case 4. Clearly we need the Javascript compilation error somehow, but I don't think the Erlang barf is needed.

        Show
        Brian Candler added a comment - Test cases for errors 1-3 attached. I'm not sure what you want to return for case 4. Clearly we need the Javascript compilation error somehow, but I don't think the Erlang barf is needed.

          People

          • Assignee:
            Unassigned
            Reporter:
            Brian Candler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development