Граф коммитов

73 Коммитов

Автор SHA1 Сообщение Дата
naruse ccf911a02d Refix r36678: switch with zlib and check content-encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-10 10:53:18 +00:00
naruse 89c88eb5a9 Suppress warnings: Net::HTTPResponse#header is obsolete
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-10 05:25:08 +00:00
naruse 7391ae231a Run automatic deflate decoding only if it has zlib.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-10 05:25:04 +00:00
shyouhei 9b16b7478a * test/net/http/test_https.rb (TestNetHTTPS#test_session_reuse): localhost is not (always) 127.0.0.1. Don't expect that.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-26 05:54:29 +00:00
drbrain ead728ca7d * lib/net/http.rb: Added SSL session reuse across connections for a
single instance to speed up connection.  [Feature #5341]
* NEWS:  ditto
* test/net/http/test_https.rb:  Tests for #5341


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-25 00:05:59 +00:00
naruse 478d37da05 Use 0 for webrick's port and get the actual port. [Bug #6766]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-21 19:07:28 +00:00
naruse 07a6d0e9d1 * lib/net/http.rb (Net::HTTP.newobj): return back for compatibility.
* lib/net/http.rb (Net::HTTP.new): set default_port if proxy port is
  not given.

* lib/net/http.rb (Net::HTTP#initialize): ditto.

* lib/net/http.rb (Net::HTTP#proxy?): return true or false.

* lib/net/http.rb (Net::HTTP#proxy_address): check proxy_uri is not nil.

* lib/net/http.rb (Net::HTTP#proxy_port): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-21 15:45:10 +00:00
drbrain 9416becda4 * lib/net/http.rb: Net::HTTP now automatically detects and uses
proxies from the environment.  A proxy may also be specified as
  before.

  Net::HTTP::Proxy still creates anonymous classes, but these classes
  are only used to store configuration information.  When an HTTP
  instance is created the configuration is now copied.

  Additionally, Net::HTTP::ProxyDelta is no longer used by Net::HTTP

  [Feature #6546]
* lib/open-uri.rb:  Moved URI::Generic#find_proxy to uri/generic.
* lib/uri/generic.rb:  Imported find_proxy from open-uri.
* test/open-uri/test_open-uri.rb:  Moved proxy-discovery tests to URI.
* test/uri/test_generic.rb:  Imported proxy-discovery tests from
  open-uri.
* test/net/http/test_http.rb:  Added tests for proxy behavior.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-20 01:56:21 +00:00
drbrain b1a0509b54 * lib/net/http/response.rb: Automatically inflate gzip and
deflate-encoded response bodies.  [Feature #6942]
* lib/net/http/generic_request.rb:  Automatically accept gzip and
  deflate content-encoding for requests.  [Feature #6494]
* lib/net/http/request.rb:  Updated documentation for #6494.
* lib/net/http.rb:  Updated documentation for #6492 and #6494, removed
  Content-Encoding handling now present in Net::HTTPResponse.
* test/net/http/test_httpresponse.rb:  Tests for #6492
* test/net/http/test_http_request.rb:  Tests for #6494
* test/open-uri/test_open-uri.rb (test_content_encoding):  Updated test
  for automatic content-encoding handling.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-19 22:43:38 +00:00
usa b72fc09537 * test/net/http/test_http.rb (TestNetHTTPLocalBind#test_bind_to_local*):
re-enable the tests because now it's OK on windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-19 04:29:14 +00:00
naruse da78490c80 use localhost for both local and remote. [Bug #6746]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18 16:48:54 +00:00
naruse da74f0f426 Support IPv6 address. [Bug #6746]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-17 08:41:21 +00:00
usa 8cc3fef898 * test/net/http/test_http.rb (TestNetHTTPLocalBind#test_bind_to_local*):
cannot cross between network interfaces on Windows, so skip this test
  until we find better test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-12 01:48:23 +00:00
naruse 558edd5192 Use IPv4 address on connecting to 127.0.0.1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-12 01:27:42 +00:00
naruse 4689853711 * lib/net/http.rb (Net::HTTP#connect): use local_host and local_port
if specified. patched by Ricardo Amorim [Feature #6617]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-11 18:37:18 +00:00
knu 1b51476c1b * test/net/http/test_httpresponses.rb: Add a test file for
Net::HTTPResponses and put a test case for the previous bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-05 03:31:36 +00:00
naruse 3ba0abdb15 * lib/net/http/header.rb (Net::HTTPHeader#range): fix broken parser of
HTTP Range request. Old one can't parse invalid specs and multiple
  specs correctly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 13:09:26 +00:00
ayumin 3893159530 * test/net/http/test_https.rb: update test for r35494
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-30 03:51:03 +00:00
drbrain ea9b6997cc * lib/net/protocol.rb (module Net): Added ReadTimeout to match
OpenTimeout.  ReadTimeout is now raised by rbuf_fill instead of
  Timeout::Error to help users distinguish what type of timeout
  occurred.  [ruby-trunk - Feature #6088]
* lib/net/pop.rb (module Net):  Updated documentation for ReadTimeout
  and OpenTimeout.
* lib/net/http.rb (module Net):  ditto
* lib/net/smtp.rb (module Net):  ditto
* lib/net/telnet.rb (module Net):  Net::ReadTimeout is now raised in
  waitfor to match Net::Protocol.
* test/net/http/test_http.rb:  Updated Timeout::Error expectation to
  Net::ReadTimeout.
* test/net/ftp/test_ftp.rb:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11 21:20:51 +00:00
drbrain 09f27873ed * lib/net/protocol.rb: Add OpenTimeout subclass of Timeout::Error
* lib/net/pop.rb:  Modernize Timeout usage.  Patch by Eric Wong.
	  Use Net::OpenTimeout instead of Timeout::Error.  [Bug #5765]
	* lib/net/http.rb:  ditto
	* lib/net/smtp.rb:  ditto
	* lib/net/telnet.rb:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28 05:15:54 +00:00
drbrain 8a7da58c0f * lib/net/http.rb: Retry HTTP requests for additional network errors.
Introduce OpenTimeout subclass of Timeout::Error.  [Bug #6001]
	* test/net/http/test_http.rb:  Reduce timeout to 0.01s for faster test
	* test/net/http/test_https.rb:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28 04:51:37 +00:00
naruse aced01eeb4 Fix r34779. Raised error on connection reset varies on environments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25 07:41:07 +00:00
drbrain 7a1180c745 * lib/net/http.rb (Net::HTTP#transport_request): Fix infinite loop
upon EOFError or Errno::ECONNRESET where count is reset to 0.
* test/net/http/test_http.rb (class TestNetHTTPKeepAlive):  Test for
  above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 01:10:07 +00:00
kazu ca0bb51887 * test/net/http/test_https_proxy.rb
(HTTPSProxyTest#test_https_proxy_authentication):
  add workaround to avoid to hang up without openssl.
  see #5786

* test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-02 15:55:07 +00:00
usa a267b9512a * test/net/http/test_http.rb (TestNetHTTPKeepAlive#*): remove debug
output.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-02 07:22:17 +00:00
naruse bee7ccddd2 * lib/net/http.rb (Net::HTTP#transport_request): retry a idempotent
request automatically. [ruby-dev:45030] [Bug #5790]
  [ruby-core:41821] [Bug #5813]

* lib/net/http.rb (Net::HTTP#keep_alive_timeout=): added to specify
  the second to reconnect the TCP connection on Keep-Alive.
  The default value is 2 second because current servers uses 2 sec.
  http://ftp-admin.blogspot.com/2009/09/keepalivetimeout2.html

* lib/net/http.rb (Net::HTTP#begin_transport): reconnect TCP
  connection on keep-alive timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-20 05:56:35 +00:00
naruse afbcfdf961 Suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-22 09:48:50 +00:00
akr b0fe688676 * test/net/http/test_http.rb: remove temporally files in ensure clause.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-19 07:37:22 +00:00
akr 805a01cb9a * test/net/http/test_http.rb: remove temporally files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-18 23:19:26 +00:00
shyouhei fa25f26095 * test/net/http/test_http.rb (TestNetHTTP_version_1_1_methods#test_timeout_during_HTTP_session):
If you connect to localhost, you should listen localhost.

* test/net/http/test_https.rb (TestNetHTTPS#test_timeout_during_SSL_handshake):
  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-01 22:35:05 +00:00
nahi 800c313bde * lib/net/http.rb (Net::HTTP.post_form): Do not ignore query part of
the given URI to post. See #655.

* test/net/http/test_http.rb, test/net/http/utils.rb: Test it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 17:44:44 +00:00
nahi b219a56c07 * lib/net/http.rb, lib/net/protocol.rb: Allow to configure to wait
server returning '100 continue' response befor sending HTTP request
  body. See NEWS for more detail. See #3622.
  Original patch is made by Eric Hodel <drbrain@segment7.net>.

* test/net/http/test_http.rb: test it.

* NEWS: Add new feature.

On my env (Ubuntu 11.04 64bit),
9510 tests, 2203824 assertions, 0 failures, 0 errors, 29 skips
->
9514 tests, 2203836 assertions, 0 failures, 0 errors, 29 skips


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 08:10:42 +00:00
kosaki e15b3c83b8 * test/net/http/utils.rb (TestNetHTTPUtils#teardown): add nil check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-28 17:17:36 +00:00
naruse 84b96e1be4 Fix tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-19 12:43:27 +00:00
yugui ef0736604a * lib/net/http.rb (Net::HTTP#connect): makes it timeout during
SSL handshake too. [ruby-core:34203]
  Patch by Marc Slemko.

* test/net/http/test_http.rb (TestNetHTTP_v1_2#test_timeout_during_HTTP_session):
  test for [ruby-core:34203]

* test/net/http/test_https.rb (TestNetHTTPS#test_timeout_during_SSL_handshake):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 07:26:18 +00:00
tenderlove b092e967b0 use require_relative instead of File.expand_path
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-06 00:39:50 +00:00
tenderlove 9bc8ccf4d4 * lib/net/protocol.rb (eof?): BufferedIO should proxy eof? to the
underlying IO object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-06 00:24:45 +00:00
knu 0d375e732d * lib/net/http.rb (Net::HTTP#get): A header hash given should not
be modified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 04:58:57 +00:00
naruse cba0d62d91 * lib/net/http.rb (Net::HTTPRequest#send_request_body_data):
set binmode to tempfile.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-14 04:05:03 +00:00
naruse 1c9f703a47 * lib/net/http.rb (Net::HTTPRequest#set_form): Added to support
both application/x-www-form-urlencoded and multipart/form-data.
  There is a similar API, Net::HTTPRequest#set_form_data, but
  to keep its compatibility this is newly added. [ruby-dev:42729]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-13 01:04:37 +00:00
naruse c37ca96692 * lib/net/http.rb: remove version 1.1 features.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10 01:08:45 +00:00
shyouhei 93fba33b47 * test/net/http/test_https.rb: As always, localhost is not
guaranteed to be resolved as 127.0.0.1.  But a SSL
          certificate needs a socket to listen on a specific address
          where a CN resolves to.  On situations where localhost is
          not 127.0.0.1, these tests are not possible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-27 06:57:39 +00:00
nahi e54c30c05e * test/net/http/test_https.rb (test_identity_verify_failure): follows
the SSL hostname check error message of openssl.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-09 08:17:51 +00:00
naruse ab70e53ac3 * lib/net/http.rb: adding support to rfc5789 patch verb.
Added a Net::HTTP::Patch class which expects a message body
  and response body. It recycles the post method into a patch one,
  that will send the encoded representation to the server.
  Summarizing, a new class has been created, the post method
  extracted into send_entity, including a new argument,
  which defines which class to use (Post or Patch) and
  finally a patch method was created. [ruby-core:30426]
  Patched by Guilherme Silveira
  <guilherme.silveira AT caelum.com.br>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-01 12:30:52 +00:00
mame 57c1406697 * lib/net/http.rb (Net::HTTPResponse#read_chunked): ensure to skip the
last newline of chunk.  [ruby-core:29229]

* test/net/http/utils.rb: add an option for chunked response test.

* test/net/http/test_http.rb: add tests for chunked response.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-03 23:42:26 +00:00
nahi d1cb4a5ba7 * lib/net/http.rb (Net::HTTPResponse#each_response_header):
accept multiline message header of HTTP response.  see #1796.
          cf. RFC 2616 '4.2 Message Header'.                          

        * test/net/http/test_httpresponse.rb: added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 13:09:03 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
nobu 00b4a3f9c4 * test: assert_raises has been deprecated since a long time ago.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 17:44:39 +00:00
mame 7edda76f15 * test/net/http/test_http.rb (_test_request__file): specify encoding
explicitly.

* test/net/http/utils.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-29 18:02:24 +00:00
mame 8d4f4e25e5 * test/net/http/test_http.rb: compare encodings of two strings before
comparing themself, which suppress too big error output.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 14:49:39 +00:00