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

fix: Unable to use sentry when URI contains non-ascii symbols on Net::HTTP traces. #2417

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

rascencio-kraft
Copy link
Contributor

@rascencio-kraft rascencio-kraft commented Sep 26, 2024

Description

Fixes #2418

Using URI::DEFAULT_PARSER.escape to properly escape the constructed URLs, which prevents issues with special characters that may cause errors during URI parsing.

Changelog

  • Added URI::DEFAULT_PARSER.escape to handle special characters in URL construction and prevent parsing errors on Net::HTTP traces.

Right now sentry is not capable of sending traces that contain non ascii characters due to it's usage of `URI.parse`.

It will not accept characters like å, ø or æ
@rascencio-kraft rascencio-kraft changed the title escaping URLs on http.rb Unable to use sentry when HTTP URi contains non-ascii symbols - escaping URLs on http.rb Sep 26, 2024
@rascencio-kraft rascencio-kraft changed the title Unable to use sentry when HTTP URi contains non-ascii symbols - escaping URLs on http.rb fix: Unable to use sentry when HTTP URi contains non-ascii symbols - escaping URLs on http.rb Sep 26, 2024
@rascencio-kraft rascencio-kraft changed the title fix: Unable to use sentry when HTTP URi contains non-ascii symbols - escaping URLs on http.rb fix: Unable to use sentry when URI contains non-ascii symbols on Net::HTTP traces. Sep 27, 2024
…m for Net::HTTPRequest

Signed-off-by: Raul Ascencio <raul@kraftanmelding.no>
Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty!

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.67%. Comparing base (399c97d) to head (545ac1c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2417      +/-   ##
==========================================
- Coverage   98.68%   98.67%   -0.02%     
==========================================
  Files         210      210              
  Lines       13958    13967       +9     
==========================================
+ Hits        13775    13782       +7     
- Misses        183      185       +2     
Components Coverage Δ
sentry-ruby 99.04% <100.00%> (-0.02%) ⬇️
sentry-rails 97.34% <ø> (ø)
sentry-sidekiq 97.07% <ø> (ø)
sentry-resque 96.79% <ø> (ø)
sentry-delayed_job 98.92% <ø> (ø)
sentry-opentelemetry 100.00% <ø> (ø)
Files with missing lines Coverage Δ
sentry-ruby/lib/sentry/net/http.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/net/http_spec.rb 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@sl0thentr0py sl0thentr0py merged commit 152eb5e into getsentry:master Sep 27, 2024
138 of 139 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Net::HTTP tracing doesn't support URIs with non ascii characters.
2 participants