GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix bug with managing redirection and keepAuthorization in Web cmdlets by CarloToso · Pull Request #18902 · PowerShell/PowerShell Conversation
|
|
CarloToso Can you enhance our helper test tool - WebListener - to cover the scenario? Currently it supports redirection but not take into account authorization header (I guess we could use I see only reason we do custom redirection processing is that we want to keep the auth header. So I suggest rename |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) we also need to handle redirection for #18546 and #18894, I can change I don't know much about the helper tool test but I can look into it |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It is the same as |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…Cmdlet/Common/WebRequestPSCmdlet.Common.cs Co-authored-by: xtqqczze <[email protected]>
|
If we change it handleRedirect to keepAuthorization, it will be misleading after we add -PreserveHTTPMethodOnRedirect or -AllowInsicureRedirect. We could add something like this |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I don't see a problem here. As I said only reason we do manual redirect processing is that we want to keep auth header. So variable names should reflect to our intention. And comments could be updated too. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| // Resume requires OutFile. | ||
| if (Resume.IsPresent && OutFile is null) | ||
| if (Resume && OutFile is null) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This reduces readability. 😕
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
reverted
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) It looks like there already are some tests that cover -PreserveAuthorizationOnRedirect |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Can you point these tests? I see there is Authorization controller but it doesn't cover redirection scenario. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) I found the -PreserveAuthorizationOnRedirect parameter in WebCmdlet.Tests.ps1 and I think it covers this case |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
If the test is passed before the PR it is a broken test. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think the tests are not broken, they just never checked for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please confirm that the new tests fail before the PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
CarloToso Please resolve merge conflicts. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CarloToso Please resolve merge conflict again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| bool keepAuthorizationOnRedirect = WebSession is not null | ||
| && WebSession.Headers is not null | ||
| && PreserveAuthorizationOnRedirect.IsPresent | ||
| && WebSession.Headers.ContainsKey(HttpKnownHeaderNames.Authorization); | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It seems PreserveAuthorizationOnRedirect.IsPresent should be on first place.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (handleRedirect | ||
| && WebSession.MaximumRedirection is not 0 | ||
| && IsRedirectCode(response.StatusCode) | ||
| && response.Headers.Location is not null) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why is AllowInsecureRedirect removed?
We merged #18546 without tests. Time to add tests for AllowInsecureRedirect
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Added some tests #18939, AllowInsecureRedirect is in handleRedirect after this PR (line 1422)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/rebase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CarloToso Please rebase to get tests. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🎉 Handy links: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.