Create issue
Issue #19 invalid
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

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 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 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.


  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).

  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