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

Add/Modify Url Encoding/Decoding for IIS UrlRewrite #40483

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

senbar
Copy link

@senbar senbar commented Mar 1, 2022

Add Url encoding and modify url Encoding for IIS UrlRewrite

Add Segment Decode class using Uri.UnescapeDataString and plug it into Input Parser.
Modify Url Encode so that it uses Uri.DecodeDataString.

Description

As was suggested I have changed Decode Data String to Unescape Data String which is recommended by docs.
For Url Decoding I have used analogical function UnescapeDataString. I have written unit tests for decoding covering opposite cases to encoding. I have also written tests for InputParser checking whether decode parameter goes into correct case and correct rule is added.

I wasn't sure if I was supposed to write performance tests since the motivation of changing from UrlEncode was that it's slow. If these test are desired I can add them.

Fixes #5985

@adityamandaleeka
Copy link
Member

@adityamandaleeka adityamandaleeka commented Mar 2, 2022

Triage: Unfortunately UnescapeDataString isn't sufficient here because it's not context-aware and will unescape things that it shouldn't (such as %3F in the middle of a path).

We'll investigate and get back to you with a better approach.

@adityamandaleeka
Copy link
Member

@adityamandaleeka adityamandaleeka commented Mar 2, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants