1. Ian Bicking
  2. WebOb
  3. Issues
Issue #19 invalid

KeyError: 'CONTENT_LENGTH'

jab
created an issue

WebOb on App Engine causes KeyError: 'CONTENT_LENGTH' when I attempt to log the request headers and no Content-Length header was sent in the request. There is a corresponding issue in the App Engine tracker at http://code.google.com/p/googleappengine/issues/detail?id=4879#c3.

Comments (7)

  1. Sergey Schetinin

    The test case should have the form of simple python code. For example:

    req = Request({.....})
    req.headers # this throws error
    

    Try logging environ which gives you the errors and producing such a test should be simple.

  2. jab reporter

    Thanks Sergey, I should have logged the environ in the first place. If you go to https://webobissue19.appspot.com/ you'll now see the environ there too.

    Not sure I can easily reproduce with simple code like you suggest since it looks like a deployment related issue? (Bug is most easily exposed via App Engine's "secure: always" directive.) I did go to a bit of trouble to give you https://bitbucket.org/jab/webobissue19/src/tip/testcase.py which hopefully is still pretty helpful. If you give me your Google account I can make you an owner of the App Engine app if that would help too.

    Thanks

  3. Sergey Schetinin

    It's just as I suspected. First of all WebOb doesn't have this problem for a long-long time. That's why you would not be able to reproduce it on a current version.

    Another thing is that appengine's wsgi environ is wrong, they always put 'HTTP_CONTENT_LENGTH': '0' there which is completely invalid (there's no such header in the request and the correct key is just CONTENT_LENGTH anyway). I've reported this before with no attention from gae team (as usual).

    http://code.google.com/p/googleappengine/issues/detail?id=4604

  4. jab reporter

    Thanks for the additional info. I've starred App Engine issue 4604, for whatever it's worth.

    Am I understanding correctly that if App Engine either stopped putting the incorrect HTTP_CONTENT_LENGTH key in the environ, or updated to a more recent version of WebOb, the bug would go away? (I guess ideally they would do both.)

  5. Log in to comment