lib/www/mechanize/chain/response_reader.rb in mechanize-0.8.4 vs lib/www/mechanize/chain/response_reader.rb in mechanize-0.8.5
- old
+ new
@@ -22,10 +22,10 @@
res_klass = Net::HTTPResponse::CODE_TO_OBJ[@response.code.to_s]
raise ResponseCodeError.new(@response) unless res_klass
# Net::HTTP ignores EOFError if Content-length is given, so we emulate it here.
unless res_klass <= Net::HTTPRedirection
- raise EOFError if @response.content_length() && @response.content_length() != total
+ raise EOFError if (!params[:request].is_a?(Net::HTTP::Head)) && @response.content_length() && @response.content_length() != total
end
@response.each_header { |k,v|
Mechanize.log.debug("response-header: #{ k } => #{ v }")
} if Mechanize.log