Skip to content
Snippets Groups Projects
Commit 09a6ce28 authored by Chris Hofstaedtler's avatar Chris Hofstaedtler
Browse files

Imported Upstream version 2.9.4

parent d340dafb
No related branches found
No related tags found
No related merge requests found
=== 2.9.4 / 2014-02-10
* Bug fixes
* Improve proxy escaping from 2.9.2. Pull request #59 by Mislav Marohnić.
=== 2.9.3 / 2014-02-06
* Bug fixes
* Fix breakage in 2.9.2 for users without proxies. Pull request #56 by
Yoshihiro TAKAHARA (merged), #57 by ChuckLin, #58 by Kenny Meyer.
=== 2.9.2 / 2014-02-05
* Bug fixes
* Special characters in proxy passwords are now handled correctly. Issue
#48 by Mislav Marohnić. Pull request #54 by Juha Kajava
=== 2.9.1 / 2014-01-22
* Bug fixes
* Added license to gemspec. Issue #47 by Benjamin Fleischer
* Set Net::HTTP#keep_alive_timeout when supported by ruby. Pull request #53
by Dylan Thacker-Smith.
* The backtrace is preserved for errors in #reset to help with debugging.
Issue #41 by Andrew Cholakian.
=== 2.9 / 2013-07-24
* Minor enhancement
* Added max_requests to avoid ECONNRESET for a server that allows a limited
number of requests on a connection. Pull request #42 by James Tucker.
* Added Net::HTTP::Persistent#max_requests to avoid ECONNRESET for a server
that allows a limited number of requests on a connection. Pull request
#42 by James Tucker.
* Request failures are now raised with the backtrace of the original
exception. This gives better insight into the reason for the failure.
See #41 by Andrew Cholakian.
......@@ -17,8 +44,8 @@
* Requests retried by ruby 2.x are no longer retried by net-http-persistent.
* Finish the connection if an otherwise unhandled exception happens during a
request. Bug #46 by Mark Oude Veldhuis.
* detect_idle_timeout now assumes a StandardError indicates the idle timeout
has been found. Bug #43 by James Tucker.
* Net::HTTP::Persistent::detect_idle_timeout now assumes a StandardError
indicates the idle timeout has been found. Bug #43 by James Tucker.
=== 2.8 / 2012-10-17
......
......@@ -7,14 +7,18 @@ Hoe.plugin :git
Hoe.plugin :minitest
Hoe.plugin :travis
Hoe.spec 'net-http-persistent' do |p|
Hoe.spec 'net-http-persistent' do
developer 'Eric Hodel', 'drbrain@segment7.net'
self.readme_file = 'README.rdoc'
self.extra_rdoc_files += Dir['*.rdoc']
license 'MIT'
rdoc_locations <<
'docs.seattlerb.org:/data/www/docs.seattlerb.org/net-http-persistent/'
dependency 'minitest', '~> 5.2', :development
end
# vim: syntax=Ruby
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -203,7 +203,7 @@ class Net::HTTP::Persistent
##
# The version of Net::HTTP::Persistent you are using
VERSION = '2.9'
VERSION = '2.9.4'
##
# Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
......@@ -631,6 +631,7 @@ class Net::HTTP::Persistent
start connection unless connection.started?
connection.read_timeout = @read_timeout if @read_timeout
connection.keep_alive_timeout = @idle_timeout if @idle_timeout && connection.respond_to?(:keep_alive_timeout=)
connection
rescue Errno::ECONNREFUSED
......@@ -666,6 +667,14 @@ class Net::HTTP::Persistent
CGI.escape str if str
end
##
# URI::unescape wrapper
def unescape str
CGI.unescape str if str
end
##
# Returns true if the connection should be reset due to an idle timeout, or
# maximum request count, false otherwise.
......@@ -858,8 +867,8 @@ class Net::HTTP::Persistent
@proxy_args = [
@proxy_uri.host,
@proxy_uri.port,
@proxy_uri.user,
@proxy_uri.password,
unescape(@proxy_uri.user),
unescape(@proxy_uri.password),
]
@proxy_connection_id = [nil, *@proxy_args].join ':'
......@@ -955,9 +964,13 @@ class Net::HTTP::Persistent
start connection
rescue Errno::ECONNREFUSED
raise Error, "connection refused: #{connection.address}:#{connection.port}"
e = Error.new "connection refused: #{connection.address}:#{connection.port}"
e.set_backtrace $@
raise e
rescue Errno::EHOSTDOWN
raise Error, "host down: #{connection.address}:#{connection.port}"
e = Error.new "host down: #{connection.address}:#{connection.port}"
e.set_backtrace $@
raise e
end
##
......
No preview for this file type
--- !ruby/object:Gem::Specification
name: net-http-persistent
version: !ruby/object:Gem::Version
version: '2.9'
version: 2.9.4
platform: ruby
authors:
- Eric Hodel
......@@ -30,50 +30,50 @@ cert_chain:
KDyY1VIazVgoC8XvR4h/95/iScPiuglzA+DBG1hip1xScAtw05BrXyUNrc9CEMYU
wgF94UVoHRp6ywo8I7NP3HcwFQDFNEZPNGXsng==
-----END CERTIFICATE-----
date: 2013-07-24 00:00:00.000000000 Z
date: 2014-02-10 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: minitest
requirement: !ruby/object:Gem::Requirement
requirements:
- - ~>
- - "~>"
- !ruby/object:Gem::Version
version: '5.0'
version: '5.2'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ~>
- - "~>"
- !ruby/object:Gem::Version
version: '5.0'
version: '5.2'
- !ruby/object:Gem::Dependency
name: rdoc
requirement: !ruby/object:Gem::Requirement
requirements:
- - ~>
- - "~>"
- !ruby/object:Gem::Version
version: '4.0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ~>
- - "~>"
- !ruby/object:Gem::Version
version: '4.0'
- !ruby/object:Gem::Dependency
name: hoe
requirement: !ruby/object:Gem::Requirement
requirements:
- - ~>
- - "~>"
- !ruby/object:Gem::Version
version: '3.6'
version: '3.7'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ~>
- - "~>"
- !ruby/object:Gem::Version
version: '3.6'
version: '3.7'
description: |-
Manages persistent connections using Net::HTTP plus a speed fix for Ruby 1.8.
It's thread-safe too!
......@@ -94,8 +94,8 @@ extra_rdoc_files:
- Manifest.txt
- README.rdoc
files:
- .autotest
- .gemtest
- ".autotest"
- ".gemtest"
- History.txt
- Manifest.txt
- README.rdoc
......@@ -106,27 +106,28 @@ files:
- test/test_net_http_persistent.rb
- test/test_net_http_persistent_ssl_reuse.rb
homepage: http://docs.seattlerb.org/net-http-persistent
licenses: []
licenses:
- MIT
metadata: {}
post_install_message:
rdoc_options:
- --main
- "--main"
- README.rdoc
require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - '>='
- - ">="
- !ruby/object:Gem::Version
version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - '>='
- - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
rubyforge_project: net-http-persistent
rubygems_version: 2.0.4
rubygems_version: 2.2.1
signing_key:
specification_version: 4
summary: Manages persistent connections using Net::HTTP plus a speed fix for Ruby
......
......@@ -274,6 +274,7 @@ class TestNetHttpPersistent < Minitest::Test
def test_connection_for
@http.open_timeout = 123
@http.read_timeout = 321
@http.idle_timeout = 42
c = @http.connection_for @uri
assert_kind_of @http_class, c
......@@ -283,6 +284,7 @@ class TestNetHttpPersistent < Minitest::Test
assert_equal 123, c.open_timeout
assert_equal 321, c.read_timeout
assert_equal 42, c.keep_alive_timeout unless RUBY_1
assert_includes conns[0].keys, 'example.com:80'
assert_same c, conns[0]['example.com:80']
......@@ -503,6 +505,19 @@ class TestNetHttpPersistent < Minitest::Test
assert_same c, conns[1]['example.com:80:proxy.example:80:johndoe:muffins']
end
def test_connection_for_proxy_unescaped
uri = URI.parse 'http://proxy.example'
uri.user = 'john%40doe'
uri.password = 'muf%3Afins'
uri.freeze
http = Net::HTTP::Persistent.new nil, uri
c = http.connection_for @uri
assert_includes conns[1].keys,
'example.com:80:proxy.example:80:john@doe:muf:fins'
end
def test_connection_for_proxy_host_down
Net::HTTP.use_connect :host_down_connect
Net::HTTP::Persistent::SSLReuse.use_connect :host_down_connect
......@@ -644,6 +659,12 @@ class TestNetHttpPersistent < Minitest::Test
assert_equal '+%3F', @http.escape(' ?')
end
def test_unescape
assert_nil @http.unescape nil
assert_equal ' ?', @http.unescape('+%3F')
end
def test_expired_eh
c = basic_connection
reqs[c.object_id] = 0
......@@ -786,6 +807,15 @@ class TestNetHttpPersistent < Minitest::Test
assert_equal 1, @http.ssl_generation, 'ssl_generation'
end
def test_proxy_equals_nil
@http.proxy = nil
assert_equal nil, @http.proxy_uri
assert_equal 1, @http.generation, 'generation'
assert_equal 1, @http.ssl_generation, 'ssl_generation'
end
def test_proxy_equals_uri
proxy_uri = URI.parse 'http://proxy.example'
......@@ -1337,6 +1367,7 @@ class TestNetHttpPersistent < Minitest::Test
end
assert_match %r%host down%, e.message
assert_match __FILE__, e.backtrace.first
end
def test_reset_io_error
......@@ -1361,6 +1392,7 @@ class TestNetHttpPersistent < Minitest::Test
end
assert_match %r%connection refused%, e.message
assert_match __FILE__, e.backtrace.first
end
def test_retry_change_requests_equals
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment