-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
WebCmdlets check if absolute uri before checking scheme #19468
Conversation
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
Please add new test. |
$command = "Invoke-WebRequest -Uri '$uri' -SkipCertificateCheck" | ||
|
||
$result = ExecuteWebCommand -command $command | ||
$result.Error.FullyQualifiedErrorId | Should -Be "WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand" |
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.
Before the fix was it "InsecureRedirection" exception? Could you please explain why now it is WebCmdletWebResponseException?
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.
I introduced "InsecureRedirection" exception in #18595, previously it was WebCmdletWebResponseException.
If the uri has no scheme checking for a scheme would throw an error, so we skip the check and we go back to the old error on https to http redirection
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
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.
The issue author has confirmed the fix solves the issue for his scenarios: #19461 (comment)
@CarloToso please update the comment as we discussed in #19468 (comment) and then I will merge the PR. Thanks!
@daxian-dbw done |
🎉 Handy links: |
PR Summary
History:
-AllowInsecureRedirect
to follow the redirect anyway Add AllowInsecureRedirect switch to Web cmdlets #18546-AllowInsecureRedirect
Webcmdlets display an error on https to http redirect #18595PR Context
Fix #19461
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).