XHTTP: only force trailing path slash when session/seq use path placement#6307
Open
dudkin-2005 wants to merge 1 commit into
Open
XHTTP: only force trailing path slash when session/seq use path placement#6307dudkin-2005 wants to merge 1 commit into
dudkin-2005 wants to merge 1 commit into
Conversation
8a45b8e to
da21a8f
Compare
|
By the way, you can check the patch and include this code snippet in the branch. You do realize this is an inherent shortcoming, right? Xray has always been highly flexible when it comes to traffic configuration. This looks more like an oversight. |
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.
GetNormalizedPathalways appends a trailing slash to the configured path.That slash is only meaningful when sessionID and/or seq are carried in the
path: it separates the configured base path from the appended segments and
lets the server slice them back off via
req.URL.Path[len(path):].When both sessionID and seq are placed in query/cookie/header, the path
carries no appended segments, so the forced trailing slash is unnecessary.
It also makes URLs look unnatural — a directory-style trailing slash right
before the query string, or a file path that gets a slash appended after its
extension.
This change makes the trailing slash conditional on path placement being
used for sessionID or seq. The default placement is
path, so any configthat does not move both fields off the path keeps the exact previous
behaviour; only configs that move both fields off the path are affected.
Examples
Both meta fields in query
Before:
After:
File-like path —
"path": "/stream/filename.extension", both in query:Before →
/stream/filename.extension/?x_session=<id>After →
/stream/filename.extension?x_session=<id>Unchanged: default (path) placement —
"path": "/abc":sessionID and seq are in the path, so the trailing slash is still added — identical to the current behaviour.
Unchanged: root path —
"path": "/"stays/?...in all cases.