Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Potential fix for #436

  • Loading branch information...
commit fba77fc65f40ba10428346c0d01fe6c5d55ddbce 1 parent 1cf5ec8
@umbrae authored
Showing with 7 additions and 1 deletion.
  1. +3 −0  requests/models.py
  2. +4 −1 tests/test_requests.py
View
3  requests/models.py
@@ -675,6 +675,9 @@ def generate_chunked():
while 1:
#XXX correct line size? (httplib has 64kb, seems insane)
pending_bytes = fp.readline(40).strip()
+ if pending_bytes == '':
+ # No content, like a HEAD request. Break out.
+ break
pending_bytes = int(pending_bytes, 16)
if pending_bytes == 0:
break
View
5 tests/test_requests.py
@@ -797,7 +797,10 @@ def test_empty_response(self):
r = requests.get(httpbin('status', '404'))
r.text
-
+ def test_chunked_head_redirect(self):
+ u = "http://t.co/NFrx0zLG"
+ r = requests.head(u, allow_redirects=True)
+ self.assertEqual(r.status_code, 200)
if __name__ == '__main__':
unittest.main()
Please sign in to comment.
Something went wrong with that request. Please try again.