Fixed content size parsing issue#4
Conversation
|
Hi g3rb3n. Your solution don't work on Django 2.1.7 because request_headers["content_length"] can be an empty string too. One possible solution can be don't parsing to int this header: Im looking on the code, and this var is not needed for other function, is only for info. But, in other future case this can be help: |
|
If request_headers["content_length"] is an empty string So int(request_headers["content_length"]) won't be called and req_size will become 0 from the else clause. Your proposal is logical equivalent. Or am I missing something? |
|
Well, sorry for my bad English. Im cuban and, i don't a top python
programmer. This solution works for me on my project using your
library.
Im using python 3.4.7 and Django 2.1.7 like a say with venv. In this case:
int(request_headers["content_length"]) fails because
request_headers["content_length"] is an empty string when i debug code
with Pycharm.
Thanks for reply.
2019-03-01 6:39 GMT-05:00, G3RB3N <notifications@github.com>:
… If request_headers["content_length"] is an empty string
"content_length" in request_headers will evaluate to True
request_headers["content_length"] will evaluate to False
So int(request_headers["content_length"]) won't be called and req_size will
become 0 from the else clause.
Your proposal is logical equivalent. Or am I missing something?
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#4 (comment)
|
|
I had the same problem when request_headers["content_length"] was returning an empty string. This PR fixes this issue. It is still not merged though by @elafarge, so you should indeed use my master version if you have the same issue. |
Added extra check for request_headers['content_length']