Skip to content

Conversation

@ldesauw
Copy link

@ldesauw ldesauw commented Nov 5, 2025

Feature

This pull request introduces an option to used url.EscapedPath() to determine parameters instead of the usual Path.
There was already an option to use url.RawPath but this field should not be used as stated here : https://pkg.go.dev/net/url@master#URL and this caused issue when having %252F in the requested path (see #4033)
I added an option to use EscapedPath() instead.

What Changed

Added UseEscapedPath field in Engine. 
handleHTTPRequest() now set path to EscapedPath if `UseEscapedPath` is at true. 
`UseEscapedPath` will override `UserRawPath` if both are activated. 

Testing

Added TestEngineHandleContextUseEscapedPathPercentEncoded() to check that the path received by the handler is indeed the escapedPath.
Added TestEngineHandleContextUseRawPathPercentEncoded() to display the difference of behavior with the current RawPath
Added TestEngineHandleContextUseEscapedPathOverride() to test that UseEscapedPath override useRawPath.

Related Issues

Closes #4033

@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.83%. Comparing base (3dc1cd6) to head (8c587f3).
⚠️ Report is 210 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4420      +/-   ##
==========================================
- Coverage   99.21%   98.83%   -0.38%     
==========================================
  Files          42       44       +2     
  Lines        3182     2928     -254     
==========================================
- Hits         3157     2894     -263     
- Misses         17       21       +4     
- Partials        8       13       +5     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.83% <100.00%> (?)
-tags go_json 98.76% <100.00%> (?)
-tags nomsgpack 98.82% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.24 98.83% <100.00%> (?)
go-1.25 98.83% <100.00%> (?)
macos-latest 98.83% <100.00%> (-0.38%) ⬇️
ubuntu-latest 98.83% <100.00%> (-0.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] UnescapePathValues = false still unescapes path values

2 participants