lib/httpclient.rb in httpclient-2.2.0.2 vs lib/httpclient.rb in httpclient-2.2.1
- old
+ new
@@ -227,11 +227,11 @@
#
# ruby -rhttpclient -e 'puts HTTPClient.get_content(ARGV.shift)' http://dev.ctor.org/
# ruby -rhttpclient -e 'p HTTPClient.head(ARGV.shift).header["last-modified"]' http://dev.ctor.org/
#
class HTTPClient
- VERSION = '2.2.0.2'
+ VERSION = '2.2.1'
RUBY_VERSION_STRING = "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
/: (\S+) (\S+)/ =~ %q$Id$
LIB_NAME = "(#{$1}/#{$2}, #{RUBY_VERSION_STRING})"
include Util
@@ -436,11 +436,11 @@
# HTTPClient from CGI environment from security reason. (HTTPClient checks
# 'REQUEST_METHOD' environment variable whether it's CGI or not)
#
# Calling this method resets all existing sessions.
def proxy=(proxy)
- if proxy.nil?
+ if proxy.nil? || proxy.to_s.empty?
@proxy = nil
@proxy_auth.reset_challenge
else
@proxy = urify(proxy)
if @proxy.scheme == nil or @proxy.scheme.downcase != 'http' or
@@ -726,12 +726,12 @@
#
# You can also pass a String as a body. HTTPClient just sends a String as
# a HTTP request message body.
#
# When you pass an IO as a body, HTTPClient sends it as a HTTP request with
- # chunked encoding (Transfer-Encoding: chunked in HTTP header). Bear in mind
- # that some server application does not support chunked request. At least
- # cgi.rb does not support it.
+ # chunked encoding (Transfer-Encoding: chunked in HTTP header) if IO does not
+ # respond to :read. Bear in mind that some server application does not support
+ # chunked request. At least cgi.rb does not support it.
def request(method, uri, *args, &block)
query, body, header, follow_redirect = keyword_argument(args, :query, :body, :header, :follow_redirect)
if [:post, :put].include?(method)
body ||= ''
end