Repository navigation
Conversation
The Net::HTTP adapter always spelled the port out, so an ordinary HTTPS request was logged as https://example.com:443/path. That is not the URL anyone writes by hand, so grepping the log for the URL a gateway uses finds nothing, and the line cannot be pasted into curl as it stands. Dropped when it is the default for the scheme, keeping any other port. The suite's own server listens on 9292, so the existing expectations are unaffected; the new spec drives Net::HTTP directly to cover 443 and 80.
trusche
requested changes
Sep 21, 2026
trusche
left a comment
Owner
There was a problem hiding this comment.
Thank you @tycooon, good improvement!
connectalso usesurl_approved?and would have to be modified for consistency- While we're at it,
excon.rb:7is the last remaining place forcing the port unconditionally, would you mind fixing that too? Plus the README
| end | ||
|
|
||
| def connect | ||
| HttpLog.log_connection(@address, @port) if !started? && HttpLog.url_approved?("#{@address}:#{@port}") |
Owner
There was a problem hiding this comment.
Suggested change
| HttpLog.log_connection(@address, @port) if !started? && HttpLog.url_approved?("#{protocol}://#{@address}#{port_suffix}") |
Let's make sure this is consistent, can we add a spec for this if one doesn't already exist?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the scheme fix already on master: an ordinary HTTPS request is still logged as
That is not the URL anyone writes by hand, which costs twice in practice — grepping a log for the URL a client actually uses finds nothing, and the line cannot be pasted into curl as it stands.
This drops the port when it is the default for the scheme, and keeps it otherwise:
This is what #63 was after. You said there you were happy to merge it with passing specs, so this branch brings them.
Specs
The suite's server listens on 9292, a non-default port, so no existing expectation moves. The new spec drives
Net::HTTPdirectly rather than through the test server, since the ports that matter here are 443 and 80, and covers all four cases above.I ran the full suite before and after the change on Ruby 3.4.5: same 169 failures either way (colour and Excon/Oj expectations that fail on master in my environment), plus the 4 new passing examples. So nothing here regresses.
Note for anyone filtering on the URL
url_approved?matches against this same string, so an allowlist or denylist pinned to the literal:443would need loosening. Patterns that key on the host, or that already treat the scheme and port as optional, are unaffected.