aboutsummaryrefslogtreecommitdiffstats
path: root/lib/net/http/response.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 20:36:07 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 20:36:07 +0000
commit570b766901c1a80f5a317012eb81ee9d1f301073 (patch)
tree14d373b6b3a8f52d66970279004a545b174cc01e /lib/net/http/response.rb
parent34a3668c30753dcd2632aaf84d3ee5d29599eac1 (diff)
downloadruby-570b766901c1a80f5a317012eb81ee9d1f301073.tar.gz
* lib/net/http.rb: Requests may be created with a URI which sets the
Host header. Responses contain the requested URI for easier redirect following. [ruby-trunk - Feature #6482] * lib/net/http/generic_request.rb: ditto. * lib/net/http/response.rb: ditto.j * NEWS (net/http): Updated for above. * test/net/http/test_http.rb: Tests for above. * test/net/http/test_http.rb: ditto. * test/net/http/test_httpresponse.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/http/response.rb')
-rw-r--r--lib/net/http/response.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb
index 6b044c3d34..bde3b5b440 100644
--- a/lib/net/http/response.rb
+++ b/lib/net/http/response.rb
@@ -79,6 +79,7 @@ class Net::HTTPResponse
initialize_http_header nil
@body = nil
@read = false
+ @uri = nil
end
# The HTTP version supported by the server.
@@ -93,6 +94,10 @@ class Net::HTTPResponse
attr_reader :message
alias msg message # :nodoc: obsolete
+ # The URI used to fetch this response. The response URI is only available
+ # if a URI was used to create the request.
+ attr_reader :uri
+
def inspect
"#<#{self.class} #{@code} #{@message} readbody=#{@read}>"
end
@@ -118,6 +123,10 @@ class Net::HTTPResponse
error! unless self.kind_of?(Net::HTTPSuccess)
end
+ def uri= uri # :nodoc:
+ @uri = uri.dup if uri
+ end
+
#
# header (for backward compatibility only; DO NOT USE)
#