-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add support for parsing Link Header with variable whitespace #7322
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 support for parsing Link Header with variable whitespace #7322
Conversation
| // we only support the URL in angle brackets and `rel`, other attributes are ignored | ||
| // user can still parse it themselves via the Headers property | ||
| string pattern = "<(?<url>.*?)>;\\srel=\"(?<rel>.*?)\""; | ||
| string pattern = "<(?<url>.*?)>;\\s*rel=\"(?<rel>.*?)\""; |
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.
Please do not introduce any overlapping terms
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.
Resolved, I misread the Regex
markekraus
left a comment
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.
LGTM
markekraus
left a comment
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.
LGTM, but need to update WebListener documentation https://github.com/PowerShell/PowerShell/tree/master/test/tools/WebListener#link
|
@markekraus added documentation! |
add support for variable whitespace in link header
PR Summary
Thanks to the @cruscio's analysis, it appears that the Link Header allows for any amount of whitespace or even no whitespace. The currently explicitly expect a single whitespace after the semicolon in the Link Header before the
Relproperty.Fix is to change the regex to allow for variable or no whitespace and associated tests to handle these two cases. Changed
GetLinkhelper to support passing in whitespace to use.Fix #5667
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests