WebCmdlets check if absolute uri before checking scheme#19468
WebCmdlets check if absolute uri before checking scheme#19468daxian-dbw merged 7 commits intoPowerShell:masterfrom
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.
Before the fix was it "InsecureRedirection" exception? Could you please explain why now it is WebCmdletWebResponseException?
There was a problem hiding this comment.
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
daxian-dbw
left a comment
There was a problem hiding this comment.
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:
-AllowInsecureRedirectto follow the redirect anyway Add AllowInsecureRedirect switch to Web cmdlets #18546-AllowInsecureRedirectWebcmdlets display an error on https to http redirect #18595PR Context
Fix #19461
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).