397 Commits

Author SHA1 Message Date
Peter Zhu
969fd30cb1 [ruby/net-http] [DOC] Fix links
The RDoc link format has changed so these are all broken links.

https://github.com/ruby/net-http/commit/97fe6085c3
2026-01-27 03:40:07 +00:00
Hiroshi SHIBATA
26447b3597 [ruby/net-http] v0.9.1
https://github.com/ruby/net-http/commit/8cee86e939
2025-12-17 15:47:43 +09:00
Kazuki Yamaguchi
b80fc8bd84 [ruby/net-http] Freeze more constants for Ractor compatibility
Freeze Net::HTTP::SSL_ATTRIBUTES and IDEMPOTENT_METHODS_. Both constants
have been marked as :nodoc:.

Together with https://github.com/ruby/openssl/issues/521, this enables
HTTPS clients in non-main Ractors on Ruby 4.0.

https://github.com/ruby/net-http/commit/f24b3b358b
2025-12-17 15:47:43 +09:00
Hiroshi SHIBATA
fedafec78b [ruby/net-http] v0.9.0
https://github.com/ruby/net-http/commit/3ccf0c8e6a
2025-12-17 15:47:43 +09:00
Misaki Shioi
7b5691c3b0
Socket.tcp and TCPSocket.new raises IO::TiemoutError with user specified timeout (#15602)
* `Socket.tcp` and `TCPSocket.new` raises `IO::TiemoutError` with user specified timeout

In https://github.com/ruby/ruby/pull/11880, `rsock_connect()` was changed to raise `IO::TimeoutError` when a user-specified timeout occurs.
However, when `TCPSocket.new` attempts to connect to multiple destinations, it does not use `rsock_connect()`, and instead raises `Errno::ETIMEDOUT` on timeout.
As a result, the exception class raised on timeout could differ depending on whether there were multiple destinations or not.

To align this behavior with the implementation of `rsock_connect()`, this change makes `TCPSocket.new` raise `IO::TimeoutError` when a user-specified timeout occurs.
Similarly, `Socket.tcp` is updated to raise `IO::TimeoutError` when a timeout occurs within the method.
(Note that the existing behavior of `Addrinfo#connect_internal`, which Socket.tcp depends on internally and which raises `Errno::ETIMEDOUT` on timeout, is not changed.)

* [ruby/net-http] Raise `Net::OpenTimeout` when `TCPSocket.open` raises `IO::TimeoutError`.

With the changes in https://github.com/ruby/ruby/pull/15602, `TCPSocket.open` now raises `IO::TimeoutError` when a user-specified timeout occurs.
This change updates #connect to handle this case accordingly.

https://github.com/ruby/net-http/commit/f64109e1cf
2025-12-17 15:02:26 +09:00
Benoit Daloze
99133a66f3 [ruby/net-http] Check whether TCPSocket#initialize supports open_timeout once and without exceptions
* See discussion in https://github.com/ruby/net-http/pull/224
* This check is known to work on at least CRuby, TruffleRuby and JRuby.
* Exceptions show up with `ruby -d`/`$DEBUG == true` and would show for every Net::HTTP instance.

https://github.com/ruby/net-http/commit/8c76f92779
2025-12-09 10:37:15 +00:00
Hiroshi SHIBATA
79c57d747f Fixed by misspell -w -error -source=text 2025-12-09 17:48:57 +09:00
Daisuke Aritomo
ea415e9636 [ruby/net-http] open: Never call Timeout.timeout in rescue clause
The try-open_timeout-then-fallback-to-timeout introduced in
https://github.com/ruby/net-http/commit/1903cedd8cd0 works well, but when it errors
due to any reason in Rubies which do not support `open_timeout`, it
spits the rescued ArgumentError that is unrelated to user code and not
actionable.

    Net::HTTP.start('foo.bar', 80)

    /.../net-http-0.8.0/lib/net/http.rb:1691:in 'TCPSocket#initialize': Failed to open TCP connection to foo.bar:80 (getaddrinfo(3): nodename nor servname provided, or not known) (Socket::ResolutionError)
            from /.../net-http-0.8.0/lib/net/http.rb:1691:in 'IO.open'
            from /.../net-http-0.8.0/lib/net/http.rb:1691:in 'block in Net::HTTP#connect'
            from /.../timeout-0.4.4/lib/timeout.rb:188:in 'block in Timeout.timeout'
            from /.../timeout-0.4.4/lib/timeout.rb:195:in 'Timeout.timeout'
            from /.../net-http-0.8.0/lib/net/http.rb:1690:in 'Net::HTTP#connect'
            from /.../net-http-0.8.0/lib/net/http.rb:1655:in 'Net::HTTP#do_start'
            from /.../net-http-0.8.0/lib/net/http.rb:1635:in 'Net::HTTP#start'
            from /.../net-http-0.8.0/lib/net/http.rb:1064:in 'Net::HTTP.start'
            (snip)
    /.../net-http-0.8.0/lib/net/http.rb:1682:in 'TCPSocket#initialize': unknown keyword: :open_timeout (ArgumentError)

              sock = TCPSocket.open(conn_addr, conn_port, @local_host, @local_port, open_timeout: @open_timeout)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            from /.../net-http-0.8.0/lib/net/http.rb:1682:in 'IO.open'
            from /.../net-http-0.8.0/lib/net/http.rb:1682:in 'Net::HTTP#connect'
            from /.../net-http-0.8.0/lib/net/http.rb:1655:in 'Net::HTTP#do_start'
            from /.../net-http-0.8.0/lib/net/http.rb:1635:in 'Net::HTTP#start'
            from /.../net-http-0.8.0/lib/net/http.rb:1064:in 'Net::HTTP.start'
            (snip)
            ... 8 levels...

This patch suppresses the ArgumentError by moving the retry out of the
rescue clause.

https://github.com/ruby/net-http/commit/86232d62f5
2025-12-05 12:34:14 +00:00
Sorah Fukumori
244a4bedc2 [ruby/net-http] releng v0.8.0
https://github.com/ruby/net-http/commit/9d65391f54
2025-11-13 16:01:15 +00:00
Yasuo Honda
c6997ddf3e [ruby/net-http] Replace Ruby 3.5 with Ruby 4.0
This commit updates the Ruby version to follow the commit in Ruby master branch.
6d81969b47

https://github.com/ruby/net-http/commit/1e48cfaaf7
2025-11-12 01:09:49 +00:00
Daisuke Aritomo
f29d772a73 [ruby/net-http] Remember if TCPSocket impl supports open_timeout
For open_timeout support detection, the previous implementation relied
on an ArgumentError being raised and then rescued. In Ruby, rescue is a
rather expensive operation and should be avoided when possible.

This patch reduces the number of begin-rescues by remembering if the
TCPSocket implementation supports open_timeout.

https://github.com/ruby/net-http/commit/06d982f3a1
2025-11-10 02:40:46 +00:00
Daisuke Aritomo
97efbc47d0 [ruby/net-http] Ruby 2 compat
https://github.com/ruby/net-http/commit/09bf573dd5
2025-11-10 02:40:46 +00:00
Daisuke Aritomo
f710e6bb54 [ruby/net-http] Replace Timeout.timeout with TCPSocket.open(open_timeout:) when available
This patch replaces the implementation of #open_timeout from Timeout.timeout from the builtin timeout in TCPSocket.open, which was introduced in Ruby 3.5 (https://bugs.ruby-lang.org/issues/21347).

The builtin timeout in TCPSocket.open is better in several ways than Timeout.timeout. It does not rely on a separate Ruby Thread for monitoring Timeout (which is what the timeout library internally does).

Furthermore, it is compatible with Ractors, as opposed to Timeout.timeout (it internally uses Thread::Mutex which can not be used in non-main Ractors).
This change allows the following code to work.

    require 'net/http'
    Ractor.new {
      uri = URI('http://example.com/')
      http = Net::HTTP.new(uri.host, uri.port)
      http.open_timeout = 1
      http.get(uri.path)
    }.value

In Ruby <3.5 environments where `TCPSocket.open` does not have the `open_timeout` option, I have kept the behavior unchanged. net/http will use `Timeout.timeout { TCPSocket.open }`.

https://github.com/ruby/net-http/commit/728eb8fc42
2025-11-10 02:40:46 +00:00
Nobuyoshi Nakada
4fe0342a86
Reapply "[ruby/net-http] [DOC] Suppress documentation for internals"
This reverts commit af610e107c3a7515228843eb6b1c5978f2ee2685.
Reverted by a mistake.
2025-11-09 22:18:37 +09:00
Nobuyoshi Nakada
af610e107c
Revert "[ruby/net-http] [DOC] Suppress documentation for internals"
This reverts commit 155cdce539a95b510a80a19e3840cde6b293cd4d.
2025-11-09 22:11:40 +09:00
Nobuyoshi Nakada
4170b70d32 [ruby/net-http] [DOC] Fix too stopped documentations
https://github.com/ruby/net-http/commit/58685b78ab
2025-11-09 13:10:33 +00:00
Nobuyoshi Nakada
155cdce539
[ruby/net-http] [DOC] Suppress documentation for internals
https://github.com/ruby/net-http/commit/e4d80bd609
2025-11-09 21:06:24 +09:00
Hiroshi SHIBATA
8b1fd559b8 [ruby/net-http] v0.7.0
https://github.com/ruby/net-http/commit/ec9c70a6fb
2025-10-31 02:28:22 +00:00
Daisuke Aritomo
aa0f689bf4 [ruby/net-http] Freeze some constants to improve Ractor compatibility
Freeze `Net::HTTP::SSL_IVNAMES`, `Net::HTTPResponse::CODE_CLASS_TO_OBJ`
and `Net::HTTPResponse::CODE_TO_OBJ` to improve Ractor compatibility.

This change allows the following code to work:

    Ractor.new {
      uri = URI.parse('http://example.com')
      http = Net::HTTP.new(uri.host, uri.port)
      http.open_timeout = nil
      http.read_timeout = nil
      http.get('/index.html')
    }

https://github.com/ruby/net-http/commit/9f0f5e4b4d
2025-05-17 00:42:12 +00:00
Hiroshi SHIBATA
4d9a1d5b6f Handle to look up CGI::EscapeExt instead of using LoadError. cgi/escape is provided snce Ruby 2.3 2025-05-13 14:37:24 +09:00
Hiroshi SHIBATA
a61f51f66d Use cgi/escape instead of cgi/util 2025-05-09 14:27:28 +09:00
Stan Lo
5ff1c479d6 Sync net-http commits
9bcf818fd0
5e34e74261
2024-12-16 13:00:49 -08:00
Hiroshi SHIBATA
2b895a7ad5 [ruby/net-http] Bump up 0.6.0
https://github.com/ruby/net-http/commit/6475fa68ba
2024-12-02 08:42:13 +00:00
Hiroshi SHIBATA
716ea630db [ruby/net-http] Need to restore under the Net namespace
https://github.com/ruby/net-http/commit/4650f86981
2024-11-19 09:19:16 +00:00
Hiroshi SHIBATA
b23c5063e8 [ruby/net-http] Restore HTTPSession constant for backward compatibility
https://github.com/ruby/net-http/commit/37f17d29e0
2024-11-19 03:39:17 +00:00
Nobuyoshi Nakada
8e98fbdd19 [ruby/net-http] Remove deprecated constants
These constants, isolated in net/http/backward.rb, have not only been
deprecated since 2001, but have also had a warning since 2021.

https://github.com/ruby/net-http/commit/265bfa929f
2024-11-15 03:15:04 +00:00
Hiroshi SHIBATA
72bc698419 [ruby/net-http] Bump up v0.5.0
https://github.com/ruby/net-http/commit/28a4bf9295
2024-11-07 02:39:23 +00:00
Evgeni Golov
bc1b4235fb [ruby/net-http] implement talking SSL to the proxy too
https://bugs.ruby-lang.org/issues/16482

https://github.com/ruby/net-http/commit/ae2d83f88b
2024-07-11 01:56:08 +00:00
fatkodima
70bdc0f777 [ruby/net-http] Add ability to configure default settings for new connections
https://github.com/ruby/net-http/commit/fed3dcd0c2
2024-07-11 01:51:03 +00:00
MSP-Greg
d605fb54cf [ruby/net-http] net/http.rb - derive SSL_IVNAMES from SSL_ATTRIBUTES
https://github.com/ruby/net-http/commit/7191bb923b
2024-07-11 01:10:08 +00:00
Zopolis4
4d744a7aa7 [ruby/net-http] Add Net::HTTP.put method
https://github.com/ruby/net-http/commit/6dc01c985b
2024-05-30 09:02:32 +00:00
BurdetteLamar
76afbda5b5 [ruby/net-http] Tweak to Net::HTTP What's Here
https://github.com/ruby/net-http/commit/3bf641ca63
2024-01-06 18:26:38 +00:00
Jeremy Evans
4d03140009 [ruby/net-http] Don't invoke response block more than once due to retry
If a socket error occurs while performing a streaming download via
the response block provided to transport_request, avoid calling
the response block again as this would result in duplicate data
received by the client.

Fixes https://github.com/ruby/net-http/pull/86
Fixes https://github.com/ruby/net-http/pull/87

Fixes [Bug #11526]

https://github.com/ruby/net-http/commit/114d01b092

Co-authored-by: Jeremy Stanley <jeremy@instructure.com>
2024-01-05 16:51:37 +00:00
Hiroshi SHIBATA
75a8b48fba [ruby/net-http] Bump version to 0.4.1
https://github.com/ruby/net-http/commit/21e226c0bc
2024-01-05 08:25:03 +00:00
Hiroshi SHIBATA
e3a19b8a43 [ruby/net-http] Bump up 0.4.0
https://github.com/ruby/net-http/commit/4be99c204c
2023-11-06 08:23:09 +00:00
Hiroshi SHIBATA
66d266244c [ruby/net-http] Removed obsolated Revision constant
https://github.com/ruby/net-http/commit/c1c5638014
2023-11-06 08:22:39 +00:00
Christian van Rensen
14fa5e39d7 [ruby/net-http] fix no_proxy behaviour
https://github.com/ruby/net-http/commit/f4951dc42a
2023-10-30 09:27:06 +00:00
0x1eef
e77c766b7a [ruby/net-http] No longer neccessary to call String#freeze on string literals.
See #144

https://github.com/ruby/net-http/commit/5a986c13d3
2023-09-19 01:32:18 +00:00
Josh Nichols
af67ced3b0 [ruby/net-http] Update lib/net/http.rb
@natematykiewicz's suggestion to avoid another string allocation

https://github.com/ruby/net-http/commit/4a22c42338

Co-authored-by: Nate Matykiewicz <natematykiewicz@gmail.com>
2023-08-16 01:40:13 +00:00
Josh Nichols
70da92cdf7 [ruby/net-http] Fix on 2.7
https://github.com/ruby/net-http/commit/5194fd541e
2023-08-16 01:40:10 +00:00
Josh Nichols
4d21134f3f [ruby/net-http] freeze rest of lib
https://github.com/ruby/net-http/commit/455a74734a
2023-08-16 01:40:09 +00:00
Hiroshi SHIBATA
030f39822a [ruby/net-http] Re-apply
https://github.com/ruby/net-http/commit/d22ca54904de after
testing

https://github.com/ruby/net-http/commit/7ac7401a9c
2023-03-07 01:35:20 +00:00
Nobuyoshi Nakada
fd0a5659ca [ruby/net-http] Test building packages
Also revert commit https://github.com/ruby/net-http/commit/d22ca54904de "Replaced
non-ascii charactor. It fails version detection at `net-http.gemspec`."

https://github.com/ruby/net-http/commit/fbeb247d93
2023-03-06 13:26:34 +00:00
Hiroshi SHIBATA
62e2b61607
Replaced non-ascii charactor. It fails version detection at net-http.gemspec.
>#   Returns the X509 certificate chain for the session<E2><80><99>s socket peer.
2023-03-06 14:50:53 +09:00
Burdette Lamar
1b4c1492c1 [ruby/net-http] [DOC] What's Here for Net:HTTP
(https://github.com/ruby/net-http/pull/128)

https://github.com/ruby/net-http/commit/39e70f0f9b
2023-03-05 19:06:37 +00:00
Burdette Lamar
6e6992e5db [ruby/net-http] [DOC] Enhanced RDoc for Net::HTTP
(https://github.com/ruby/net-http/pull/127)

https://github.com/ruby/net-http/commit/07b2b88ef5
2023-02-26 13:37:15 +00:00
Burdette Lamar
05f016cdad [ruby/net-http] [DOC] Enhanced RDoc for Net::HTTP
(https://github.com/ruby/net-http/pull/126)

https://github.com/ruby/net-http/commit/4700d0660b
2023-02-24 19:09:06 +00:00
Burdette Lamar
7c47c2617a [ruby/net-http] [DOC] Enhanced RDoc for Net::HTTP
(https://github.com/ruby/net-http/pull/125)

https://github.com/ruby/net-http/commit/2ea20380fc
2023-02-23 16:51:58 +00:00
Burdette Lamar
4edb2a29f6 [ruby/net-http] [DOC] Enhanced RDoc for Net:HTTP
(https://github.com/ruby/net-http/pull/124)

https://github.com/ruby/net-http/commit/aaf26b21d6
2023-02-22 13:58:36 +00:00
Burdette Lamar
899fad907c [ruby/net-http] [DOC] Enhanced RDoc for Net::HTTP
(https://github.com/ruby/net-http/pull/123)

https://github.com/ruby/net-http/commit/220ff3f741
2023-02-20 21:57:16 +00:00