{"action":"created","issue":{"url":"https://api.github.com/repos/swl10/pyslet/issues/39","labels_url":"https://api.github.com/repos/swl10/pyslet/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/swl10/pyslet/issues/39/comments","events_url":"https://api.github.com/repos/swl10/pyslet/issues/39/events","html_url":"https://github.com/swl10/pyslet/pull/39","id":128131984,"number":39,"title":"Default to '0' if token comes back as None in ChunkedReader","user":{"login":"stevehof","id":2334898,"avatar_url":"https://avatars.githubusercontent.com/u/2334898?v=3","gravatar_id":"","url":"https://api.github.com/users/stevehof","html_url":"https://github.com/stevehof","followers_url":"https://api.github.com/users/stevehof/followers","following_url":"https://api.github.com/users/stevehof/following{/other_user}","gists_url":"https://api.github.com/users/stevehof/gists{/gist_id}","starred_url":"https://api.github.com/users/stevehof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevehof/subscriptions","organizations_url":"https://api.github.com/users/stevehof/orgs","repos_url":"https://api.github.com/users/stevehof/repos","events_url":"https://api.github.com/users/stevehof/events{/privacy}","received_events_url":"https://api.github.com/users/stevehof/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-22T11:01:31Z","updated_at":"2016-01-25T06:57:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/swl10/pyslet/pulls/39","html_url":"https://github.com/swl10/pyslet/pull/39","diff_url":"https://github.com/swl10/pyslet/pull/39.diff","patch_url":"https://github.com/swl10/pyslet/pull/39.patch"},"body":"As far as i can tell, according to pep-0333 or pep-3333 we shouldn't be getting this far if the content-length is empty. Let me know if you want me to look into catching this higher up."},"comment":{"url":"https://api.github.com/repos/swl10/pyslet/issues/comments/174419767","html_url":"https://github.com/swl10/pyslet/pull/39#issuecomment-174419767","issue_url":"https://api.github.com/repos/swl10/pyslet/issues/39","id":174419767,"user":{"login":"stevehof","id":2334898,"avatar_url":"https://avatars.githubusercontent.com/u/2334898?v=3","gravatar_id":"","url":"https://api.github.com/users/stevehof","html_url":"https://github.com/stevehof","followers_url":"https://api.github.com/users/stevehof/followers","following_url":"https://api.github.com/users/stevehof/following{/other_user}","gists_url":"https://api.github.com/users/stevehof/gists{/gist_id}","starred_url":"https://api.github.com/users/stevehof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevehof/subscriptions","organizations_url":"https://api.github.com/users/stevehof/orgs","repos_url":"https://api.github.com/users/stevehof/repos","events_url":"https://api.github.com/users/stevehof/events{/privacy}","received_events_url":"https://api.github.com/users/stevehof/received_events","type":"User","site_admin":false},"created_at":"2016-01-25T06:57:17Z","updated_at":"2016-01-25T06:57:17Z","body":"Hey\r\n\r\nI'll run over our implementation first, so that if there are any 'unique' things we do, we can fix it from a different angle. \r\n\r\nWe currently run a fairly large framework on top of our own wsgi backend, on which we add odata2.Server as a 3rd party listening server. We pass the requests on when they have the right root. It is possible that we do not/do perform things that your server might not expect.\r\n\r\nAs to why this might be happening. When we are running odata2.client.insert_identity, it then creates a new stream with an empty StringIO. This doesn't set a content-length (which could/should be '0'?), but when the stream arrives on the server, this is the 'wsgi.input' that is attempted to be read and has no Content-length. This all happens in rfc5023.py:299 which is called from odata2.server.py:784\r\n\r\nIt is also possible that when running your system standalone, there could be other code that picks up the missing content-length and skips this. \r\n\r\nThrowing an exception would make sense, although I might not expect an exception if I ask it to read an empty ChunkedFile, I would expect an empty stream...\r\n\r\nAs per pep-3333 that I mentioned above, the official word is that if content-length is None/0, the server must not attempt to read the input. It might be better to write tests around this fact, and therefore it is likely we will never get this error in the future as all empty content-lengths will be avoided?\r\n\r\nLooking forward to your thoughts on the matter. I was looking at writing some unit-tests for you but wasn't able to get runtest_mediaresource and test_wsgi.py working. :)"}}