Skip to content

Commit

Permalink
Fix for Github Issue #211.
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelsauce committed Aug 2, 2015
1 parent a2f53cb commit 80d0d67
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions turbo/async.lua
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ function async.HTTPClient:_handle_headers(data)
return
end
local content_length = self.response_headers:get("Content-Length", true)
if not content_length or content_length == 0 then
if not content_length or content_length == 0 or self.kwargs.method == "HEAD" then
if self.response_headers:get("Transfer-Encoding", true) ==
"chunked" then
"chunked" and not self.kwargs.method == "HEAD" then
-- Chunked encoding.
self._chunked = true
self._read_buffer = buffer()
Expand Down Expand Up @@ -621,8 +621,7 @@ function async.HTTPClient:_handle_redirect(location)
local old_host = self.hostname
self:_set_url(location)
if self.response_headers:get("Connection") == "close" or
self.iostream:closed() or old_host ~= self.hostname or
old_scehma ~= self.schema then
self.iostream:closed() or old_host ~= self.hostname then
-- Call close to be sure that it really is closed...
self.iostream:close()
local sock, msg = socket.new_nonblock_socket(self.family,
Expand Down

0 comments on commit 80d0d67

Please sign in to comment.