New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with httplib and Content-Length: -1 #45968
Comments
When opening an IP Webcam URL with urllib2, the response is a continuous Server: DM-Web As you can see, the Content-Type is multipart/x-mixed-replace, and the The problem is trying to read anything from the file-like object ...
"chunked" The length attribute is being set to '-1' which leads to blocking when I don't know if this is the right fix, but I would suggest changing: length = self.msg.getheader('content-length')
if length and not self.chunked: to: length = self.msg.getheader('content-length')
if length >= 0 and not self.chunked: |
Your proposed fixed is not correct: length = self.msg.getheader("content-length")
if length and not self.chunked:
try:
self.length = int(length)
except ValueError:
pass
# patch
if self.length < 0:
self.length = None |
I have made a patch of the proposed fixed and ran the httplib test |
Fixed in r61035. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: