зеркало из https://github.com/github/ruby.git
* lib/net/http/generic_request.rb
(Net::HTTP::GenericRequest#initialize): optimize object allocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b6ecbc7055
Коммит
159fa373f8
|
@ -1,3 +1,9 @@
|
|||
Wed Aug 6 02:16:43 2014 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/net/http/generic_request.rb
|
||||
(Net::HTTP::GenericRequest#initialize):
|
||||
optimize object allocation.
|
||||
|
||||
Wed Aug 6 01:16:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/uri/generic.rb (URI::Generic#path_query): remove a private method.
|
||||
|
|
|
@ -14,19 +14,18 @@ class Net::HTTPGenericRequest
|
|||
|
||||
if URI === uri_or_path then
|
||||
@uri = uri_or_path.dup
|
||||
host = @uri.hostname
|
||||
host += ":#{@uri.port}" if @uri.port != @uri.class::DEFAULT_PORT
|
||||
path = uri_or_path.request_uri
|
||||
host = @uri.hostname.dup
|
||||
host << ":".freeze << @uri.port.to_s if @uri.port != @uri.default_port
|
||||
@path = uri_or_path.request_uri
|
||||
raise ArgumentError, "no HTTP request path given" unless @path
|
||||
else
|
||||
@uri = nil
|
||||
host = nil
|
||||
path = uri_or_path
|
||||
raise ArgumentError, "no HTTP request path given" unless uri_or_path
|
||||
raise ArgumentError, "HTTP request path is empty" if uri_or_path.empty?
|
||||
@path = uri_or_path.dup
|
||||
end
|
||||
|
||||
raise ArgumentError, "no HTTP request path given" unless path
|
||||
raise ArgumentError, "HTTP request path is empty" if path.empty?
|
||||
@path = path
|
||||
|
||||
@decode_content = false
|
||||
|
||||
if @response_has_body and Net::HTTP::HAVE_ZLIB then
|
||||
|
@ -44,7 +43,7 @@ class Net::HTTPGenericRequest
|
|||
initialize_http_header initheader
|
||||
self['Accept'] ||= '*/*'
|
||||
self['User-Agent'] ||= 'Ruby'
|
||||
self['Host'] ||= host
|
||||
self['Host'] ||= host if host
|
||||
@body = nil
|
||||
@body_stream = nil
|
||||
@body_data = nil
|
||||
|
|
Загрузка…
Ссылка в новой задаче