Permalink
Browse files

Potential fix for #436

  • Loading branch information...
umbrae committed Mar 8, 2012
1 parent 1cf5ec8 commit fba77fc65f40ba10428346c0d01fe6c5d55ddbce
Showing with 7 additions and 1 deletion.
  1. +3 −0 requests/models.py
  2. +4 −1 tests/test_requests.py
View
@@ -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
@@ -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()

0 comments on commit fba77fc

Please sign in to comment.