lib/httpclient.rb in httpclient-2.1.3.1 vs lib/httpclient.rb in httpclient-2.1.4
- old
+ new
@@ -89,11 +89,11 @@
#
# body = { 'keyword' => 'ruby', 'lang' => 'en' }
# res = clnt.post(uri, body)
#
# 2. Do multipart file upload with POST. No need to set extra header by
-# yourself from httpclient/2.1.3.
+# yourself from httpclient/2.1.4.
#
# File.open('/tmp/post_data') do |file|
# body = { 'upload' => file, 'user' => 'nahi' }
# res = clnt.post(uri, body)
# end
@@ -197,13 +197,13 @@
#
# 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.1.3.1'
+ VERSION = '2.1.4'
RUBY_VERSION_STRING = "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
- /: (\S+) (\S+)/ =~ %q$Id: httpclient.rb 259 2009-01-08 12:49:04Z nahi $
+ /: (\S+) (\S+)/ =~ %q$Id: httpclient.rb 269 2009-02-13 13:21:15Z nahi $
LIB_NAME = "(#{$1}/#{$2}, #{RUBY_VERSION_STRING})"
include Util
# Raised for indicating running environment configuration error for example
@@ -872,14 +872,14 @@
extheader << ['Content-Type', content_type]
end
end
req = HTTP::Message.new_request(method, uri, query, body, boundary)
extheader.each do |key, value|
- req.header.set(key, value)
+ req.header.add(key, value)
end
- if @cookie_manager && cookies = @cookie_manager.find(uri)
- req.header.set('Cookie', cookies)
+ if @cookie_manager && cookie = @cookie_manager.find(uri)
+ req.header.add('Cookie', cookie)
end
req
end
def create_boundary
@@ -989,10 +989,10 @@
end
def do_get_header(req, res, sess)
res.version, res.status, res.reason, headers = sess.get_header
headers.each do |key, value|
- res.header.set(key, value)
+ res.header.add(key, value)
end
if @cookie_manager
res.header['set-cookie'].each do |cookie|
@cookie_manager.parse(cookie, req.header.request_uri)
end