aboutsummaryrefslogtreecommitdiffstats
path: root/test/net/http
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/net-http] Remove redundant MJIT conditionKazuhiro NISHIYAMA2022-01-171-1/+1
| | | | | | ref https://github.com/ruby/ruby/commit/da0f67c0383f57129c7a76255964b1ee739d8db8 https://github.com/ruby/net-http/commit/dbeb5f1c8f
* [ruby/net-http] Fix unescaped `.` in RegexpKazuhiro NISHIYAMA2022-01-141-2/+2
| | | | | | Use `include?` instead. https://github.com/ruby/net-http/commit/05022744a9
* [ruby/net-http] Use omit instead of skip for test-unitHiroshi SHIBATA2022-01-112-3/+3
| | | | https://github.com/ruby/net-http/commit/843d4548de
* [ruby/net-http] Handle invalid use of IP addresses in SNIJeremy Evans2022-01-041-1/+1
| | | | | | | | | | | | | | | | Server Name Indication does not allow IP addresses (RFC 6066, section 3: `Literal IPv4 and IPv6 addresses are not permitted in "HostName".`). Recent versions of LibreSSL enforce this restriction, which raises when setting the hostname to an IP address (s.hostname=), before attempting to setup the SSL connection. Since the certificate used in the test is already for localhost, we cannot connect to localhost. However, as all the test does is check for a specific exception, just modify the regexp used so it handles both cases. https://github.com/ruby/net-http/commit/6ab399db45
* Prepare for removing RubyVM::JIT (#5262)Takashi Kokubun2021-12-131-1/+1
|
* Sync test_http_request.rb after fix to net-httpJeremy Evans2021-11-151-1/+1
|
* [ruby/net-http] Fix tests after change to allow HEAD to send Accept-EncodingJeremy Evans2021-11-161-2/+3
| | | | https://github.com/ruby/net-http/commit/ca7bb8c51c
* quick fix for `test_initialize_HEAD`Koichi Sasada2021-11-111-1/+1
| | | | | | | | | | | | | | | https://github.com/ruby/ruby/commit/52ab9bbee918c63faad32e3851b162691b984d40 makes a failure. ``` 1) Failure: HTTPRequestTest#test_initialize_HEAD [/tmp/ruby/v3/src/trunk/test/net/http/test_http_request.rb:53]: <{"accept"=>["*/*"], "user-agent"=>["Ruby"]}> expected but was <{"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"], "accept"=>["*/*"], "user-agent"=>["Ruby"]}>. ``` I'm not sure it is correct, so please review later.
* [ruby/net-http] Reset keep_alive timer on new connectionKazuki Yamaguchi2021-11-041-0/+24
| | | | | | | | | The last_communicated timestamp is for HTTP persistent connection, to decide whether the current TCP connection may be reused for the subsequent requests or not. Naturally, the timer must be reset if the connection is recreated since it is no longer relevant. https://github.com/ruby/net-http/commit/0a013de42d
* [ruby/net-http] Use omit instead of skip for test-unitHiroshi SHIBATA2021-09-111-1/+1
| | | | https://github.com/ruby/net-http/commit/5bb14fd3bc
* Fix test failure of 60b02db5161625dd5f7d22d31989dd966837333c with WindowsHiroshi SHIBATA2021-07-291-2/+1
|
* [ruby/net-http] Enforce write timeout when body_stream is usedMiguel Teixeira2021-07-291-0/+28
| | | | | | | | | | | | | The existing implementation of `Net::HTTP#write_timeout` relies on `Net::BefferedIO` to trigger the `Net::WriteTimeout` error. This commit changes `send_request_with_body_stream` to remove the optimization that was making `Net::HTTP#write_timeout` not work when `body_stream` is used. Open issue: https://bugs.ruby-lang.org/issues/17933 https://github.com/ruby/net-http/commit/a0fab1ab52
* [ruby/net-http] Do not require stringioKazuki Yamaguchi2021-05-061-1/+0
| | | | | | | | | It is not used in net/http library code since commit 15ccd0118c13 (r36473 in ruby svn trunk, 2012). require's in test suite are also cleaned up. https://github.com/ruby/net-http/commit/996d18a43f
* Fix test/net/http/test_https.rb host naming for WindowsMSP-Greg2021-05-041-43/+25
|
* Workaround failures on WindowsNobuyoshi Nakada2021-05-041-0/+2
|
* [ruby/net-http] Decode user and password from env configured proxyLukas Eipert2021-04-281-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | If someone sets an env variable defining a http_proxy, containing a username / password with percent-encoded characters, then the resulting base64 encoded auth header will be wrong. For example, suppose a username is `Y\X` and the password is `R%S] ?X`. Properly URL encoded the proxy url would be: http://Y%5CX:R%25S%5D%20%3FX@proxy.example:8000 The resulting proxy auth header should be: `WVxYOlIlU10gP1g=`, but the getters defined by ruby StdLib `URI` return a username `Y%5CX` and password `R%25S%5D%20%3FX`, resulting in `WSU1Q1g6UiUyNVMlNUQlMjAlM0ZY`. As a result the proxy will deny the request. Please note that this is my first contribution to the ruby ecosystem, to standard lib especially and I am not a ruby developer. References: - https://gitlab.com/gitlab-org/gitlab/-/issues/289836 - https://bugs.ruby-lang.org/projects/ruby-master/repository/trunk/revisions/58461 - https://bugs.ruby-lang.org/issues/17542 https://github.com/ruby/net-http/commit/e57d4f38aa
* Fix a warningKazuhiro NISHIYAMA2021-01-231-1/+1
| | | | | | ``` .../ruby/test/net/http/test_httpresponse.rb:81: warning: constant RubyVM::MJIT is deprecated ```
* [ruby/net-http] RubyVM::MJIT is deprecated, prefer RubyVM::JIT nowNobuyoshi Nakada2021-01-211-1/+3
| | | | https://github.com/ruby/net-http/commit/abc6ea1877
* Rename RubyVM::MJIT to RubyVM::JITTakashi Kokubun2021-01-131-1/+1
| | | | | | | | because the name "MJIT" is an internal code name, it's inconsistent with --jit while they are related to each other, and I want to discourage future JIT implementation-specific (e.g. MJIT-specific) APIs by this rename. [Feature #17490]
* Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&Benoit Daloze2020-12-041-1/+1
| | | | * Otherwise those tests, etc cannot run on alternative Ruby implementations.
* test/net/http/test_https.rb: The test logic was buggyYusuke Endoh2020-09-241-4/+4
| | | | | The expected certs must be `[CA_CERT, SERVER_CERT]` before 1.1.1g and `[SERVER_CERT]` after 1.1.1h.
* test/net/http/test_https.rb: the order of verify_callback seems to varyYusuke Endoh2020-09-241-4/+4
| | | | ... depending upon the environment.
* test/net/http/test_https.rb: Stop the error due to openssl 1.1.1hYusuke Endoh2020-09-241-4/+8
| | | | | | | | | | | | | | | | | | | On some environments that uses OpenSSL 1.1.1h, the two tests now fail. http://rubyci.s3.amazonaws.com/android29-x86_64/ruby-master/log/20200924T062352Z.fail.html.gz https://github.com/ruby/ruby/runs/1159288773?check_suite_focus=true ``` 1) Failure: TestNetHTTPS#test_get [/data/data/com.termux/files/home/cb/tmp/build/20200924T062352Z/ruby/test/net/http/test_https.rb:47]: <"0\x82\x03\xED0\x82\x02\xD5\xA0\x03..."> expected but was <"0\x82\x03\xE30\x82\x02\xCB\xA0\x03...">. ``` Not sure why, but verify_callback now seems to receive only SERVER_CERT but not CA_CERT. It would be good to investigate the issue furthermore, but tentatively, I want to stop the failures.
* [ruby/net-http] Fix SSL session reuse test with LibreSSL 3.2+Jeremy Evans2020-08-031-0/+8
| | | | https://github.com/ruby/net-http/commit/5ae9620fbc
* [ruby/net-http] Switch invalid server name formatJeremy Evans2020-08-031-5/+5
| | | | | | | | | | | | | | | | invalid_servername is not a valid name in an SSL request due to the use of the underscore, and LibreSSL 3.2.0 will raise an exception for this. These tests are not testing the allowed characters in the server name, but how net/http handles cases where the server name provided does not match the IP address you are trying to connect to, so I think it's better to just modify the tests to use a correct format. While here, fix a typo in a test name, and use better code in the ensure block so the same test doesn't issue both a failure and an error. https://github.com/ruby/net-http/commit/0e8dc91120
* Skip test_read_body_block_mod for --jit-waitTakashi Kokubun2020-06-221-1/+2
|
* Try increasing read_timeout a little moreTakashi Kokubun2020-06-211-1/+1
| | | | | It failed again http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3018488
* Increase read_timeout for --jit-waitTakashi Kokubun2020-06-211-0/+1
| | | | | This tries to fix a random failure like http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3017837
* test/net/http/test_http.rb: relax open_timeout limitYusuke Endoh2020-03-211-1/+1
| | | | | | | | | | | | | | | The test fails randomly on the CI of OpenCSW SPARC Solaris 10: https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-master/log/20200321T091909Z.fail.html.gz ``` 1) Failure: TestNetHTTP_v1_2_chunked#test_timeout_during_HTTP_session [/export/home/rubyci/unstable10s/tmp/build/20200321T091909Z/ruby/test/net/http/test_http.rb:575]: [Net::ReadTimeout] exception expected, not #<Net::OpenTimeout: execution expired>. ``` The environment uses RUBY_TEST_SUBPROCESS_TIMEOUT_SCALE=20, so the open timeout 0.1 sec. means 2.0 sec. for the environment, but it seems too strict because the environment is painfully slow.
* Let Net::HTTP.get take request headers (#2957)Takashi Kokubun2020-03-102-1/+26
| | | | | | | | | | | * Let Net::HTTP.get take request headers * Add more test cases for no header usages * Add examples with request headers * Add a NEWS entry [ci skip] [Feature #16686]
* Fixed FD leakNobuyoshi Nakada2020-03-041-0/+2
|
* Promote net-http to the default gems.Hiroshi SHIBATA2020-02-211-5/+5
| | | | | test/net/http/test_https.rb: rename fixture methods to read_fixture because it conflicts with test-unit gem.
* Add #verify_hostname= and #verify_hostname to skip hostname verification (#2858)Yuta Iwama2020-01-231-0/+23
| | | | | | | | | | | | According to https://github.com/ruby/openssl/pull/60, > Currently an user who wants to do the hostname verification needs to call SSLSocket#post_connection_check explicitly after the TLS connection is established. if an user who wants to skip the hostname verification, SSLSocket#post_connection_check doesn't need to be called https://bugs.ruby-lang.org/issues/16555
* Revert "lib/net/http/response.rb: support raw deflate correctly"Yusuke Endoh2019-12-161-16/+16
| | | | | | | | | | | | | | | | This reverts commit 5105240b1e851410020b3b3f1a2bead7ffdd4291. In RFC 2616: ``` deflate The "zlib" format defined in RFC 1950 [31] in combination with the "deflate" compression mechanism described in RFC 1951 [29]. ``` So "Content-Encoding: deflate" means zlib format, not raw deflate. [Bug #11268]
* lib/net/http/response.rb: support raw deflate correctlyYusuke Endoh2019-12-161-16/+16
| | | | | | | | | | | | | | Net::HTTP had used `Zlib::Inflate.new(32 + Zlib::MAX_WBITS)` for all content encoding (deflate, zlib, and gzip). But the argument `32 + Zlib::MAX_WBITS` means zlib and gzip decoding with automatic header detection, so (raw) deflate compression had not been supported. This change makes it support raw deflate correctly by passing an argument `-Zlib::MAX_WBITS` (which means raw deflate) to `Zlib::Inflate.new`. All deflate-mode tests are fixed too. [Bug #11268]
* fix ipaddr parameter of Net::HTTP.start to support proxyNARUSE, Yui2019-12-101-0/+39
| | | | 54072e329cab7207fba133caba4fc12b45add8f9
* test/net/http/test_https.rb (test_get_SNI_failure): stop proxy settingsYusuke Endoh2019-12-103-43/+45
| | | | | | | | | | | | | | Because the test fails under HTTP proxy settings. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20191210T000004Z.fail.html.gz ``` 1) Failure: TestNetHTTPS#test_get_SNI_failure [/export/home/users/chkbuild/cb-gcc/tmp/build/20191210T000004Z/ruby/test/net/http/test_https.rb:81]: [OpenSSL::SSL::SSLError] exception expected, not #<Net::HTTPServerException: 403 "Forbidden">. ``` The new SNI feature introduced at 54072e329c may need to be improved for HTTP proxy environment.
* Add ipaddr optional parameter to Net::HTTP#startNARUSE, Yui2019-12-091-0/+31
| | | | | | | | | | | | | | | | to replace the address for TCP/IP connection [Feature #5180] There're 3 layers of hostname: * host address for TCP/IP * TLS server name * HTTP Host header value To test DNS round robin or check server certificate from server local, people sometimes want to connect server with given IP address but keep TLS server name and HTTP Host header value. closes [Feature #15215] closes https://github.com/ruby/ruby/pull/1893 closes https://github.com/ruby/ruby/pull/1977
* Ignore Errno::EPIPE when sending requests in net/httpJeremy Evans2019-09-271-0/+11
| | | | | | | | An EPIPE when sending the request should be ignored. Even if you cannot write more data, you may still be able to read the server's response. Fixes [Bug #14466]
* Adding missing test for Net::HTTPGenericRequest initializer (#1835)Espartaco Palma2019-08-161-0/+1
| | | | | A new exception is raised if an URI::HTTP is received and that object doesn't have a hostname property. Complementary to #1278
* Test missing Content-Type warningsNobuyoshi Nakada2019-07-241-4/+11
|
* Show the caller's locationNobuyoshi Nakada2019-07-241-1/+13
| | | | | * lib/net/http/header.rb: show the caller's location instead of the current lines.
* test/net/http/test_http.rb: Extend the timeoutYusuke Endoh2019-06-111-2/+2
| | | | https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-master/log/20190610T071910Z.log.html.gz
* test/net/http/test_http.rb: extend the timeout for Solaris CIYusuke Endoh2019-06-061-5/+5
| | | | https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-master/log/20190605T231909Z.fail.html.gz
* Preserve HTTP header key as string [Bug #15394]naruse2018-12-101-0/+5
| | | | | | | | to prevent send Host header twice accidentally. From: Sangyong Sim <sangyong-sim@cookpad.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* net/http, net/ftp: skip SSL/TLS session resumption testsrhe2018-08-091-0/+7
| | | | | | | | | | | | | | | | | | Due to a bug in OpenSSL 1.1.0h[1] (it's only in this specific version; it was introduced just before the release and is already fixed in their stable branch), the callback set by SSLContext#session_new_cb= does not get called for clients, making net/http and net/ftp not attempt session resumption. Let's disable the affected test cases for now. Another option would be to fallback to using SSLSocket#session as we did before r64234. But since only a single version is affected and hopefully a new stable version containing the fix will be released in near future, I chose not to add such workaround code to lib/. [1] https://github.com/openssl/openssl/pull/5967 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* net/http, net/ftp: fix session resumption with TLS 1.3rhe2018-08-081-25/+10
| | | | | | | | | | | When TLS 1.3 is in use, the session ticket may not have been sent yet even though a handshake has finished. Also, the ticket could change if multiple session ticket messages are sent by the server. Use SSLContext#session_new_cb instead of calling SSLSocket#session immediately after a handshake. This way also works with earlier protocol versions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* increase body sizenaruse2018-06-251-1/+1
| | | | | | To try to block writing on travis. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/net/http/test_httpresponse.rb: add testcases for net/httpresponsemame2018-06-241-0/+30
| | | | | | | | | This change adds testcases for Response#inspect and #code_type, and improves line coverage of lib/net/http/response.rb (91.8 % to 92.94 %). A patch from @owlworks. https://github.com/ruby/ruby/pull/1898 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove debug printnaruse2018-06-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e