Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RFC2396_PARSER explicitly to avoid the warning. #2509

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sentry-ruby/lib/sentry/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def extract_request_info(req)
# IPv6 url could look like '::1/path', and that won't parse without
# wrapping it in square brackets.
hostname = address =~ Resolv::IPv6::Regex ? "[#{address}]" : address
uri = req.uri || URI.parse(URI::RFC2396_PARSER.escape("#{use_ssl? ? 'https' : 'http'}://#{hostname}#{req.path}"))
uri = req.uri || URI.parse(uri_parser.escape("#{use_ssl? ? 'https' : 'http'}://#{hostname}#{req.path}"))
url = "#{uri.scheme}://#{uri.host}#{uri.path}" rescue uri.to_s

result = { method: req.method, url: url }
Expand All @@ -78,6 +78,12 @@ def extract_request_info(req)

result
end

def uri_parser
URI::RFC2396_PARSER
rescue NameError
URI::DEFAULT_PARSER
end
end
end
end
Expand Down
Loading