aboutsummaryrefslogtreecommitdiffstats
path: root/test/net
Commit message (Collapse)AuthorAgeFilesLines
* 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]
* Add more debug infoKazuhiro NISHIYAMA2019-12-151-1/+8
| | | | | | | | | | | | | closed server doesn't have useful info. So call inspect before close. And add local debug code in comment. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20191215T092405Z.fail.html.gz ``` 1) Failure: IMAPTest#test_connection_closed_without_greeting [/export/home/rubyci/chkbuild-tmp/tmp/build/20191215T092405Z/ruby/test/net/imap/test_imap.rb:483]: [Net::IMAP::Error] exception expected, not #<RuntimeError: {:e=>#<Errno::EINVAL: Invalid argument - connect(2) for [::1]:41748>, :server=>#<TCPServer:(closed)>, :port=>41748, :server_addr=>"::1"}>. ```
* Move `rescue` for debug into block of assert_raiseKazuhiro NISHIYAMA2019-12-121-2/+2
|
* Add more debug info when Errno::EINVALKazuhiro NISHIYAMA2019-12-121-0/+2
| | | | https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20191212T072406Z.fail.html.gz
* 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
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-19/+19
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-181-13/+0
| | | | | | | | | | | | | | | | | This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd.
* 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]
* Add Net::FTP#features and Net::FTP#optionShugo Maeda2019-09-021-0/+96
| | | | | Patch by darkphnx (Dan Wentworth) . Thanks! [Feature #15964]
* 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.
* Suppress unused variable warningsNobuyoshi Nakada2019-06-301-0/+3
|
* Removed unused variablesNobuyoshi Nakada2019-06-302-3/+2
|
* Add max option to TestProtocol#create_mockioNobuyoshi Nakada2019-06-291-8/+6
| | | | | | * test/net/protocol/test_protocol.rb (TestProtocol#create_mockio): max option to limit maximum writable size at once, and unify mock method in test_write0_multibyte.
* test/net/imap/test_imap.rb: use Thread#stop? to wait for server threadYusuke Endoh2019-06-251-4/+3
| | | | | Still timeout occurs. Retry for 5dd8fdd3f328f741fae4abba00c478e8a51d2a7e. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20190625T032405Z.fail.html.gz
* test/net/imap/test_imap.rb: wait for the server thread to startYusuke Endoh2019-06-151-14/+29
| | | | | | | | | In some slow CI environments, the invocation of a thread seems very slow. This causes a test failure to attempt to connect a server that does not start yet. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20190615T002420Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20190611T022407Z.fail.html.gz
* 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
* test/net/fixtures/Makefile: moved from test/net/imapmrkn2019-01-021-0/+0
| | | | | | | | | This Makefile can be used to update test certificates. It should have been moved at which the certificates was moved at r56836. [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Try to update cert (2nd try)kazu2019-01-022-84/+83
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Try to update certkazu2019-01-023-118/+124
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix Net::Protocol::BufferedIO#write when sending large multi-byte stringnobu2018-12-271-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit should fix Net::Protocol::BufferedIO#write when sending large multi-byte string like following example. ``` $ ruby -rnet/http -rjson -v -e "Net::HTTP.post(URI('http://httpbin.org/post'), { text: 'あ'*100_000 }.to_json, 'Content-Type' => 'application/json')" ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux] Traceback (most recent call last): 19: from -e:1:in `<main>' 18: from lib/ruby/2.6.0/net/http.rb:500:in `post' 17: from lib/ruby/2.6.0/net/http.rb:605:in `start' 16: from lib/ruby/2.6.0/net/http.rb:920:in `start' 15: from lib/ruby/2.6.0/net/http.rb:502:in `block in post' 14: from lib/ruby/2.6.0/net/http.rb:1281:in `post' 13: from lib/ruby/2.6.0/net/http.rb:1493:in `send_entity' 12: from lib/ruby/2.6.0/net/http.rb:1479:in `request' 11: from lib/ruby/2.6.0/net/http.rb:1506:in `transport_request' 10: from lib/ruby/2.6.0/net/http.rb:1506:in `catch' 9: from lib/ruby/2.6.0/net/http.rb:1507:in `block in transport_request' 8: from lib/ruby/2.6.0/net/http/generic_request.rb:123:in `exec' 7: from lib/ruby/2.6.0/net/http/generic_request.rb:189:in `send_request_with_body' 6: from lib/ruby/2.6.0/net/protocol.rb:247:in `write' 5: from lib/ruby/2.6.0/net/protocol.rb:265:in `writing' 4: from lib/ruby/2.6.0/net/protocol.rb:248:in `block in write' 3: from lib/ruby/2.6.0/net/protocol.rb:275:in `write0' 2: from lib/ruby/2.6.0/net/protocol.rb:275:in `each_with_index' 1: from lib/ruby/2.6.0/net/protocol.rb:275:in `each' lib/ruby/2.6.0/net/protocol.rb:280:in `block in write0': undefined method `bytesize' for nil:NilClass (NoMethodError) ``` [Fix GH-2058] From: Eito Katagiri <eitoball@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* test_ftp.rb: loosen another timeout requirementk0kubun2018-11-141-2/+2
| | | | | | | for Travis osx. https://travis-ci.org/ruby/ruby/jobs/454864155 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_ftp.rb: loosen timeout for Travis osxk0kubun2018-11-141-4/+4
| | | | | | https://travis-ci.org/ruby/ruby/jobs/454798071 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_ftp.rb: extend timeout for --jit-wait testingk0kubun2018-11-081-1/+1
| | | | | | | to avoid random failures like https://app.wercker.com/ruby/ruby/runs/mjit-test1/5be394b818310600284f2b50?step=5be394f1591ca800079b1329 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Exclude CI platform specific failures by --excludes optionnobu2018-10-211-5/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* skip tests broken with OpenSSL 1.1.1 on Travis osxk0kubun2018-10-211-0/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/net/imap/test_imap.rb (test_exception_during_idle): kill infinite loopernormal2018-08-161-1/+3
| | | | | | | | | | | | | | | | It is possible for Mutex#sleep (via ConditionVariable#wait) to prematurely wake up under MJIT (because Mutex#sleep can't handle spurious wakeups). This affects @idle_done_cond in Net::IMAP#idle and means the response handler may never set `in_idle' to `true`. In any case, ensure the infinite looping `raiser' thread stops running when the test is done. Will work on reducing the effect of spurious wakeups from MJIT... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* net/http, net/ftp: skip SSL/TLS session resumption testsrhe2018-08-092-0/+20
| | | | | | | | | | | | | | | | | | 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
* check net.core.wmem_default and max instead of tcpnaruse2018-06-221-1/+1
| | | | | | https://travis-ci.org/ruby/ruby/jobs/395416137 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* show net.ipv4.tcp_wmem to debug failure on travisnaruse2018-06-221-1/+1
| | | | | | https://travis-ci.org/ruby/ruby/builds/395318841 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* assert_raise(Net::ReadTimeout) on Windows [Bug #14829]naruse2018-06-081-5/+3
| | | | | | From: MSP-Greg <MSP-Greg@users.noreply.github.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* th is nilusa2018-06-081-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* skip write_timeout test on Windowsnaruse2018-06-071-5/+5
| | | | | | | | This test is about write_timeout. To ensure it really raised Net::WriteTimeout, skip this test on Windows, whose write returns immediately even for large data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Some platforms immediately returns from Socket#writeusa2018-06-071-3/+3
| | | | | | | | | | * test/net/http/test_http.rb (test_timeout_during_HTTP_session_write): on some platforms such as Windows immediately returns from Socket#write, and have to wait to read its response. So, we can not handle Net::WriteTimeout and should handle Net::ReadTimeout instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add Net::HTTPClientException [Bug #14688]naruse2018-06-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Introduce write_timeout to Net::HTTP [Feature #13396]naruse2018-06-062-0/+109
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* net/imap: Fix ArgumentError in send_string_datashugo2018-05-111-0/+37
| | | | | | | Thanks to ShockwaveNN (Pavel Lobashov) for reporting the bug. [ruby-core:86990] [Bug #14750] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: workaround for EPROTOTYPEnobu2018-04-301-1/+1
| | | | | | | | | | * io.c (internal_write_func, internal_writev_func): retry at unexpected EPROTOTYPE on macOS, to get rid of a kernel bug. [ruby-core:86690] [Bug #14713] * ext/socket/init.c (rsock_{sendto,send,write}_blocking): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_ftp.rb: extend read_timeout for --jit-waitk0kubun2018-04-281-1/+1
| | | | | | | testing. I'm running `make test-all RUN_OPTS='--jit-wait'` and the read_timeout was too slow for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Raise ArgumentError if host component is nilnaruse2018-03-081-0/+12
| | | | | | | From: oss92 <mohamed.o.alnagdy@gmail.com> fix https://github.com/ruby/ruby/pull/1278 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e