-
Notifications
You must be signed in to change notification settings - Fork 142
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
feat: disable semicolon separator by default #336
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ function decodeComponentChar (highCharCode, lowCharCode) { | |
return null | ||
} | ||
|
||
function safeDecodeURI (path) { | ||
function safeDecodeURI (path, useSemicolonDelimiter) { | ||
let shouldDecode = false | ||
let shouldDecodeParam = false | ||
|
||
|
@@ -61,8 +61,8 @@ function safeDecodeURI (path) { | |
} | ||
// Some systems do not follow RFC and separate the path and query | ||
// string with a `;` character (code 59), e.g. `/foo;jsessionid=123456`. | ||
// Thus, we need to split on `;` as well as `?` and `#`. | ||
} else if (charCode === 63 || charCode === 59 || charCode === 35) { | ||
// Thus, we need to split on `;` as well as `?` and `#` if the useSemicolonDelimiter option is enabled. | ||
} else if (charCode === 63 || charCode === 35 || (charCode === 59 && useSemicolonDelimiter)) { | ||
querystring = path.slice(i + 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is any perf difference (I doubt), you can move the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, given that the |
||
path = path.slice(0, i) | ||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to set it
true
in the Fastify.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this option should be disabled in Fastify as well, but I don't know the best way to do it: leave the default
false
here and open issue/PR to update dependencies in Fastify, or make ittrue
here and send PR to Fastify with the option disabledThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave the
false
here, because it's a correct behavior and we can release a new major of fmw at any moment. In current version of Fastify it should be set totrue
by default, because otherwise it's a breaking change.About changing it to
false
in the fastify in a future release. It's better to open an issue about this in fastify, but IMHO it never would be set totrue
by defauld in the Fastify, because it will break too many apps. It just doesn't worth it even if it's true according to the spec.