-
-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
res.redirect
unpredictable sometimes with Unicode and even ANSI/ASCII
#2897
Comments
And there's a failure with it... Guess we'll attempt to match |
Bahh... Apologies for the noise and closing. |
Hi @Martii, sorry we weren't able to get to you before you figured this out. I'm glad you were able to determine the issue! Always feel free to let us know if you have questions, and even drop by our support Gitter room, https://gitter.im/strongloop/express |
…ter handling of redirect URLs: expressjs/express#2897
We get on occasion with
§
theescape
d version (e.g. only%A7
a.k.a ASCII 245) during aredirect()
(shouldn't be butencodeURI
/encodeURIComponent
gives%C2%A7
)... I've spent about 3 hours trying different things... unfortunately it's not an easy bug to find. I've poured over our code in a commit that I'm attempting to get pushed to our organization when it's complete... but I'm having to ensure at the very leastencodeURI
is applied to the path... currently I am defaulting toencodeURIComponent
if needed for express routing... even though it's already applied to the String already in between the slashes when needed... same as GitHub does all the time withencodeURIComponent
. Some redirects work like a charm depending on their content... others don't.Anyhow... hope some of this info helps track this down a little better... the work around so far is to double
encodeURI
orencodeURIComponent
on each individualp/a/t/h/to
which I know will eventually fail down the line.Providing a reduced test case will be nearly impossible I think... but I am able to reproduce this with node@4.3.x and express@4.13.4 in our project.
Here's a few stack traces:
Stringy is exactly
/scripts/Marti/RFC_2606§3_-_Hello,_World!
beforeredirect()
and passed asaRes.redirect(Stringy)
with defaulting to 200 status code... tried forcing.status(200).redirect(Stringy)
too... no luck.As it can be seen here the "Stringy" with this one is
/users/テスト
Tested UserAgents:
Anchor tags with these exact same values work 100%... just not
redirect()
in express'sres
Object... so it's a bit baffling.Thanks for you patience and assistance with the provided intel. :)
The text was updated successfully, but these errors were encountered: