summaryrefslogtreecommitdiff
path: root/test/net
Commit message (Collapse)AuthorAgeFilesLines
* s/mjit/rjit/Takashi Kokubun2023-03-061-1/+1
|
* s/MJIT/RJIT/Takashi Kokubun2023-03-061-1/+1
|
* Merge net-protocol-0.2.1Hiroshi SHIBATA2022-12-091-0/+8
|
* [ruby/net-protocol] Failing test case for #19Jean Boussier2022-12-081-0/+29
| | | | | | | | | Unfortunately we have to use a mock, but this test demonstrate the mutation bug fixed in #19. It fails on 0.2.0 but passes on 0.1.3 or 0.2.1. https://github.com/ruby/net-protocol/commit/40a1ab687c
* [ruby/net-http] Fix test for Ruby headPeter Zhu2022-11-261-1/+5
| | | | | | | The error raised for broken coderanges was changed in ruby/ruby@571d21f and the test was fixed in that commit but not ported to this repo. ruby/net-http@e6185dda26ea6db7a3515d4f47ab231f5f4ac902
* Make String#rstrip{,!} raise Encoding::CompatibilityError for broken coderangeJeremy Evans2022-11-241-1/+1
| | | | | | | | | | | | | | | | It's questionable whether we want to allow rstrip to work for strings where the broken coderange occurs before the trailing whitespace and not after, but this approach is probably simpler, and I don't think users should expect string operations like rstrip to work on broken strings. In some cases, this changes rstrip to raise Encoding::CompatibilityError instead of ArgumentError. However, as the problem is related to an encoding issue in the receiver, and due not due to an issue with an argument, I think Encoding::CompatibilityError is the more appropriate error. Fixes [Bug #18931]
* [ruby/net-http] Remove ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFEJeremy Evans2022-09-281-14/+4
| | | | | | | | | | | | | | | | | | This list is out of date. At least OpenBSD since 2013 does not allow one user to read the environment variables of a process run by another user. While we could try to keep the list updated, I think it's a bad idea to not use the user/password from the environment, even if another user on the system could read it. If http_proxy exists in the environment, and other users can read it, it doesn't make it more secure for Ruby to ignore it. You could argue that it encourages poor security practices, but net/http should provide mechanism, not policy. Fixes [Bug #18908] https://github.com/ruby/net-http/commit/1e4585153d
* [ruby/net-http] Make `Net::HTTPHeader#content_range` return nil on non-byte ↵Shishir Joshi2022-06-161-0/+21
| | | | | | | | | | | | | units * Returning nil from the `content_range` method instead of raising an error when the unit in the content-range header is not "bytes". Fix https://bugs.ruby-lang.org/issues/11450 https://github.com/ruby/net-http/commit/0b5030dd86 Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Revert "HTTPHeader.content_range throws error on non-byte units"Nobuyoshi Nakada2022-06-161-10/+0
| | | | This reverts commit 63546bfc1581d4abec2a0d846106a1c0afc0efa9.
* HTTPHeader.content_range throws error on non-byte unitsShishir Joshi2022-06-161-0/+10
| | | | | | | | * Added a nil check in Net::HTTPHeader#initialize_http_header for keys in the header that do not have any value * Returning nil from the content_range method instead of raising an error when the unit in the content-range header is not bytes * Modified initialize_http_header to match trunk fix [Bug #11450] fix https://github.com/ruby/ruby/pull/1018
* [ruby/net-http] Feature detect to make net/http usable with JRubyKarol Bucek2022-04-201-3/+5
| | | | | | | | Handle missing session_new_cb= and do not call session_cache_mode=, as JRuby SSL does not support these methods. https://github.com/ruby/net-http/commit/3237ef4d8c
* [ruby/net-http] Add ignore_eof access to HTTP and HTTPResponseJeremy Evans2022-04-201-0/+30
| | | | | | | | | | | | | | | | | | | The ignore_eof setting on HTTPResponse makes it so an EOFError is raised when reading bodies with a defined Content-Length, if the body read was truncated due to the socket be closed. The ignore_eof setting on HTTP sets the values used in responses that are created by the object. For backwards compatibility, the default is for both settings is true. However, unless you are specifically tested for and handling truncated responses, it's a good idea to set ignore_eof to false so that errors are raised for truncated responses, instead of those errors silently being ignored. Fixes [Bug #14972] https://github.com/ruby/net-http/commit/4d47e34995
* [ruby/net-http] Update the content-length heading when decoding bodiesJeremy Evans2022-04-141-0/+13
| | | | | | | | | | | | | | | | | Previously, the content-encoding header was removed and the body was modified, but the content-length header was not modified, resulting in the content-length header not matching the body length. Don't delete content-length before yielding inflate body, as that causes a switch to read the entire body instead of reading in chunks. Fixes [Bug #16672] https://github.com/ruby/net-http/commit/58284e9710 Co-authored-by: st0012 <stan001212@gmail.com>
* [ruby/net-http] Add HTTP#response_body_encoding for setting response body ↵Jeremy Evans2022-04-122-0/+289
| | | | | | | | | | | | | | | | | | | encoding This allows for the ability to opt-in to a method to set the encoding of response bodies. By setting the accessor to a String or Encoding instance, it will use the specified encoding. Setting the value of true will try to detect the encoding of the response body, either using the Content-Type header (assuming it specifies charset) or by scanning for a <meta> tag in the document that specifies the encoding. The default is false in which case no forcing of encoding will be done (same as before the patch). Implements [Feature #2567] Implements [Feature #15517] https://github.com/ruby/net-http/commit/6233e6b7c1 Co-authored-by: Yui Naruse <naruse@ruby-lang.org>
* [ruby/net-http] Revert "Update the content-length heading when decoding bodies"Jeremy Evans2022-04-031-13/+0
| | | | | | | | | This reverts commit https://github.com/ruby/net-http/commit/a7cb30124cf1. This is causing errors in Ruby's CI, will revert for now and try again after testing a fix with Ruby's CI. https://github.com/ruby/net-http/commit/7b852b1feb
* [ruby/net-http] Update the content-length heading when decoding bodiesJeremy Evans2022-04-021-0/+13
| | | | | | | | | | | Previously, the content-encoding header was removed and the body was modified, but the content-length header was not modified, resulting in the content-length header not matching the body length. Fixes [Bug #16672] https://github.com/ruby/net-http/commit/a7cb30124c
* [ruby/net-http] Do not set SNI hostname if connecting to IP addressJeremy Evans2022-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | RFC 6066, section 3, explicitly disallows the use of an IP address as an SNI server name. So check if the connection is being made to an IP address using the resolv regexps, and do not set an SNI hostname in that case. Recent changes to LibreSSL make it more strictly follow RFC 6066, resulting an s.hostname= raising an error if passed an IP address. When such verions of LibreSSL are used, this change not only fixes the net/http tests, it also fixes tests for webrick and open-uri, which both make SSL connections to 127.0.0.1 using net/http in their tests. Avoid warning in the openssl extension by unsetting @ssl_context.verify_hostname if connecting to an IP address. Make changes so that the post_connection_check still happens when connecting to an IP address, which is necessary to keep checking that the certificate returned includes the IP address, which one of the tests depends on. Revert the previous change that modified the regexp used for checking the error message. https://github.com/ruby/net-http/commit/fa68e64bee
* [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
* Promote net-smtp to the bundled gemsHiroshi SHIBATA2021-05-275-752/+0
|
* Promote net-pop to the bundled gemsHiroshi SHIBATA2021-05-271-166/+0
|
* Promote net-imap to the bundled gemsHiroshi SHIBATA2021-05-274-1314/+0
|
* Promote net-ftp to the bundled gemsHiroshi SHIBATA2021-05-273-2782/+0
|
* [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
* [ruby/net-imap] Move UTF7 & datetime formatting to net/imap/data_encodingnicholas a. evans2021-05-062-38/+46
| | | | | | Partially implements #10. https://github.com/ruby/net-imap/commit/0d43c5e856
* [ruby/net-imap] Update AUTH=PLAIN to be a little closer to RFC4616nicholas a. evans2021-05-061-0/+23
| | | | | | | | * Add authzid support * must not contain NULL chars * improve rdoc https://github.com/ruby/net-imap/commit/a587fc71b7
* test/net/ftp/test_ftp.rb - fix intermittent MinGW failureMSP-Greg2021-05-051-1/+1
| | | | | | | | | | | | | | | | | | | | Fixes intermittent error as below: [242/838] 5316=test_ftp #<Thread:0x0000020aa8733f20 D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:2532 run> terminated with exception (report_on_exception is true): D:/a/ruby/ruby/src/tool/lib/minitest/unit.rb:199:in `assert': Expected #<Errno::ECONNRESET: An existing connection was forcibly closed by the remote host.> to be nil. (MiniTest::Assertion) from D:/a/ruby/ruby/src/tool/lib/test/unit/core_assertions.rb:504:in `assert' from D:/a/ruby/ruby/src/tool/lib/minitest/unit.rb:299:in `assert_nil' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:430:in `ensure in block in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:431:in `block in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:2539:in `block in create_ftp_server' D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:426:in `write': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET) from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:426:in `print' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:426:in `block (2 levels) in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:420:in `each' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:420:in `each_with_index' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:420:in `block in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:2539:in `block in create_ftp_server'
* test/net/imap/test_imap.rb: wait a moment before socket is closedYusuke Endoh2021-05-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | to try to suppress a failure on Solaris. This is the same as 19504d115dc09558255fcb5213f80dd8454ab189 http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210504T070007Z.fail.html.gz ``` 1) Error: IMAPTest#test_idle_done_not_during_idle: Errno::EINVAL: Invalid argument - connect(2) for [::1]:33839 /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:1214:in `__connect_nonblock' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:1214:in `connect_nonblock' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:56:in `connect_internal' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:137:in `connect' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:642:in `block in tcp' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:227:in `each' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:227:in `foreach' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:632:in `tcp' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/lib/net/imap.rb:1223:in `tcp_socket' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/lib/net/imap.rb:1180:in `initialize' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/test/net/imap/test_imap.rb:289:in `new' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/test/net/imap/test_imap.rb:289:in `test_idle_done_not_during_idle' ```
* 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
|
* test/net/smtp/test_smtp.rb: wait a moment before socket is closedYusuke Endoh2021-04-301-0/+1
| | | | | | | | | | | | | | On Solaris, Socket.tcp seems to fail with EINVAL if the server closes the connection immediately after accpeted. I think this is a bug of Socket.tcp, but seems difficult to fix soon. http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210429T100007Z.fail.html.gz ``` 1) Failure: Net::TestSMTP#test_eof_error_backtrace [/export/home/chkbuild/chkbuild-sunc/tmp/build/20210429T100007Z/ruby/test/net/smtp/test_smtp.rb:193]: [ruby-core:78550] [Bug #13018]. [EOFError] exception expected, not #<Net::ReadTimeout: Net::ReadTimeout>. ```
* [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
* test/net/ftp/test_ftp.rb: Use RubyVM::JIT instead of RubyVM::MJITYusuke Endoh2021-04-281-1/+1
|
* test/net/ftp/test_ftp.rb: reduce the size of a long responseYusuke Endoh2021-04-281-2/+2
| | | | | | | | "9" * 999999999 (about 1 GB) was too large for some CI servers. This commit changes the size to 999999 (about 1 MB). http://rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20210427T141707Z.fail.html.gz http://rubyci.s3.amazonaws.com/raspbian10-aarch64/ruby-master/log/20210427T145408Z.fail.html.gz
* test/net/ftp/test_ftp.rb: remove unused variableYusuke Endoh2021-04-281-1/+0
|
* [ruby/net-ftp] Add test casesShugo Maeda2021-04-271-0/+6
| | | | https://github.com/ruby/net-ftp/commit/865232bb2a
* [ruby/net-ftp] Reduce resource cosumption of Net::FTP::TIME_PARSERShugo Maeda2021-04-271-0/+11
| | | | | | | | | Reported by Alexandr Savca as a DoS vulnerability, but Net::FTP is a client library and the impact of the issue is low, so I have decided to fix it as a normal issue. Based on patch by nobu. https://github.com/ruby/net-ftp/commit/a93af636f8
* [ruby/net-ftp] Close the passive connection data socket if there is an error ↵Jeremy Evans2021-04-271-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | setting up the transfer Previously, the connection leaked in this case. This uses begin/ensure and checking for an error in the ensure block. An alternative approach would be to not even perform the connection until after the RETR (or other) command has been sent. However, I'm not sure all FTP servers support that. The current behavior is: * Send (PASV/EPSV) * Connect to the host/port returned in 227/229 reply * Send (RETR/other command) Changing it to connect after the RETR could break things. FTP servers might expect that the client has already connected before sending the RETR. The alternative approach is more likely to introduce backwards compatibility issues, compared to the begin/ensure approach taken here. Fixes Ruby Bug 17027 https://github.com/ruby/net-ftp/commit/6e8535f076
* [ruby/net-ftp] Re-apply 827e471d438fdec1ae329afb5912b8e06d534823Hiroshi SHIBATA2021-04-271-1/+1
| | | | https://github.com/ruby/net-ftp/commit/3ca80368c4
* Merge net-imap-0.2.0Hiroshi SHIBATA2021-04-222-10/+137
|