René's URL Explorer Experiment


Title: Fix bug with managing redirection and keepAuthorization in Web cmdlets by CarloToso · Pull Request #18902 · PowerShell/PowerShell · GitHub

Open Graph Title: Fix bug with managing redirection and keepAuthorization in Web cmdlets by CarloToso · Pull Request #18902 · PowerShell/PowerShell

X Title: Fix bug with managing redirection and keepAuthorization in Web cmdlets by CarloToso · Pull Request #18902 · PowerShell/PowerShell

Description: PR Summary The current behaviour of if (keepAuthorization && IsRedirectCode(response.StatusCode) && response.Headers.Location is not null) is wrong, I tested it by setting keepAuthorization = true --> this sets handleRetirect = true --> and then sets handler.AllowAutoRedirect = false. Without sessionRedirect (we can choose a better name) it ignores the MaximumRedirection parameter. Test: maunally set keepAuthorization = true before the if, then Invoke-WebRequest "http://mockbin.org/redirect/308?to=https://mockbin.org/redirect/302?to=https://mockbin.org/status/200" -MaximumRedirection 0 -SkipHttpErrorCheck --> expected 308, result 200 Proposed fix --> bool sessionRedirect = WebSession.MaximumRedirection > 0 || WebSession.MaximumRedirection == -1; if (keepAuthorization && sessionRedirect && IsRedirectCode(response.StatusCode) && response.Headers.Location is not null) PR Context Fix Bug, merge before #18546 and #18894

Open Graph Description: PR Summary The current behaviour of if (keepAuthorization && IsRedirectCode(response.StatusCode) && response.Headers.Location is not null) is wrong, I tested it by setting keepAutho...

X Description: PR Summary The current behaviour of if (keepAuthorization && IsRedirectCode(response.StatusCode) && response.Headers.Location is not null) is wrong, I tested it by s...

Opengraph URL: https://github.com/PowerShell/PowerShell/pull/18902

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:efe73341-7b58-b8e0-0de5-ec825826c48a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB386:12115C:2557654:36013A1:6A566D5F
html-safe-nonce95491b963cdc2af779a9ceafe810045e74cb5fa8d30d60b649d75336c9a7d63b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzg2OjEyMTE1QzoyNTU3NjU0OjM2MDEzQTE6NkE1NjZENUYiLCJ2aXNpdG9yX2lkIjoiNDQzMDc4NzYyODQwNjA0MTk1MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacbad31fd936141926110bfdbc0dfaf11133dfade27f2b8166161dd954ecd27c93
hovercard-subject-tagpull_request:1189333619
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/PowerShell/PowerShell/pull/18902/files
twitter:imagehttps://avatars.githubusercontent.com/u/105941898?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/105941898?s=400&v=4
og:image:altPR Summary The current behaviour of if (keepAuthorization && IsRedirectCode(response.StatusCode) && response.Headers.Location is not null) is wrong, I tested it by setting keepAutho...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None1bfcd903bf3318822b10b18a6332fac40d3a21f7d94456dca766ab8fa7328068
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release37f446b78ad53e6f593aa1a4243b87c76a3428ab
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/pull/18902/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fpull%2F18902%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fpull%2F18902%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/pull/18902/files
Reloadhttps://github.com/PowerShell/PowerShell/pull/18902/files
Reloadhttps://github.com/PowerShell/PowerShell/pull/18902/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/18902/files
PowerShell https://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Notifications https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Fork 8.4k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Star 54.4k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Code https://github.com/PowerShell/PowerShell
Issues 1.2k https://github.com/PowerShell/PowerShell/issues
Pull requests 287 https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality 3 https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
Code https://github.com/PowerShell/PowerShell
Issues https://github.com/PowerShell/PowerShell/issues
Pull requests https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FPowerShell%2FPowerShell%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FPowerShell%2FPowerShell%2Fissues%2Fnew%2Fchoose
iSazonovhttps://github.com/iSazonov
PowerShell:masterhttps://github.com/PowerShell/PowerShell/tree/master
CarloToso:Fix-handleRedirect-with-MaximumRedirectionhttps://github.com/CarloToso/PowerShell/tree/Fix-handleRedirect-with-MaximumRedirection
Conversation 28 https://github.com/PowerShell/PowerShell/pull/18902
Commits 18 https://github.com/PowerShell/PowerShell/pull/18902/commits
Checks 0 https://github.com/PowerShell/PowerShell/pull/18902/checks
Files changed https://github.com/PowerShell/PowerShell/pull/18902/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/18902/files
Fix bug with managing redirection and keepAuthorization in Web cmdlets https://github.com/PowerShell/PowerShell/pull/18902/files#top
Show all changes 18 commits https://github.com/PowerShell/PowerShell/pull/18902/files
4ad575b fix bug with managing redirection CarloToso Jan 7, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/4ad575b928a0bdf39ccfcd7772d646b9cefd2005
a1671df Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Web… CarloToso Jan 7, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/a1671df522d0ac9624fc5beae5c7b215e20495e4
8510729 keepAuthorization --> keepAuthorizationOnRedirect CarloToso Jan 8, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/8510729e91dd07cb66517369037c4f3c07c72370
e378ef2 remove useless IsPresent CarloToso Jan 8, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/e378ef2f887d2f49066329dbb3ff7a0e450125ab
2a9f147 missed two keepAuthorizationOnRedirect CarloToso Jan 8, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/2a9f14741ef1dfe1298b9295e885d3124806b904
f5b6d1d bool handleRedirect = keepAuthorizationOnRedirect CarloToso Jan 8, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/f5b6d1df53d88cf02e33a353db59eb25b0bddfb7
e48bd39 better handleRedirect if logic CarloToso Jan 8, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/e48bd3913b339b4791cf6e41de14c05c20f3998c
1345784 revert Resume.IsPresent CarloToso Jan 8, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/1345784d0156e1f49ac1929ff6cf64fe5c453812
3ed7bd7 keepAuthorizationOnRedirect --> handleRedirect CarloToso Jan 8, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/3ed7bd71db7fef87f129eb6ec9c0762576976f4b
c2d3399 add test CarloToso Jan 11, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/c2d3399c663c265e830c3866fcd3d6cabc1b38f1
c4ed1b7 Update test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlet… CarloToso Jan 12, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/c4ed1b714e4e95ed052da7aabc8dee2705fc8bfd
7f5b298 Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Web… CarloToso Jan 12, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/7f5b29812f60ffd72b22aaf8ce7cad55e1f25120
7f3fd07 remove comment CarloToso Jan 12, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/7f3fd07f47311639587b9a7f6bbad50dbee3248e
bcfcfc1 Merge branch 'master' into Fix-handleRedirect-with-MaximumRedirection CarloToso Jan 12, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/bcfcfc106a94e8d5aeaf4ef44b764853dfbef9a8
536de9d Merge branch 'master' into Fix-handleRedirect-with-MaximumRedirection CarloToso Jan 12, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/536de9ddd9cd3f008c3822b0f103fd16a1f82027
2771457 reorder keepAuthorizationOnRedirect CarloToso Jan 12, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/277145766cc847b06f9f385710be1372e6ed68ce
7a8daeb fix error CarloToso Jan 12, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/7a8daeb5c1eaec9f95da2137f4daafa42e6a811a
289f5e8 Merge branch 'PowerShell:master' into Fix-handleRedirect-with-Maximum… CarloToso Jan 13, 2023 https://github.com/PowerShell/PowerShell/pull/18902/commits/289f5e87a10f6d53f8b3232c025e704b726a6c7d
Clear filters https://github.com/PowerShell/PowerShell/pull/18902/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/18902/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/18902/files
WebRequestPSCmdlet.Common.cs https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
WebCmdlets.Tests.ps1 https://github.com/PowerShell/PowerShell/pull/18902/files#diff-1b256250c40f42b7c01f2695c0c908112a4eead87e3ef3ff534768ad930e7ca1
https://github.com/PowerShell/PowerShell/blob/master/.github/CODEOWNERS#L7
...owerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cshttps://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
View file https://github.com/CarloToso/PowerShell/blob/289f5e87a10f6d53f8b3232c025e704b726a6c7d/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/PowerShell/PowerShell/pull/18902/{{ revealButtonHref }}
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
iSazonovhttps://github.com/iSazonov
Jan 12, 2023https://github.com/PowerShell/PowerShell/pull/18902/files#r1068421737
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#18546https://github.com/PowerShell/PowerShell/pull/18546
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/18902/files
CarloTosohttps://github.com/CarloToso
Jan 13, 2023https://github.com/PowerShell/PowerShell/pull/18902/files#r1068838556
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/18902/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#18939https://github.com/PowerShell/PowerShell/pull/18939
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/18902/files
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-9e8673bc737d91c9712fa4e7e5fef6aac6690999bcbd0777759563afd015c50d
https://github.com/PowerShell/PowerShell/blob/master/.github/CODEOWNERS#L7
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1https://github.com/PowerShell/PowerShell/pull/18902/files#diff-1b256250c40f42b7c01f2695c0c908112a4eead87e3ef3ff534768ad930e7ca1
View file https://github.com/CarloToso/PowerShell/blob/289f5e87a10f6d53f8b3232c025e704b726a6c7d/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/PowerShell/PowerShell/pull/18902/{{ revealButtonHref }}
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-1b256250c40f42b7c01f2695c0c908112a4eead87e3ef3ff534768ad930e7ca1
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-1b256250c40f42b7c01f2695c0c908112a4eead87e3ef3ff534768ad930e7ca1
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-1b256250c40f42b7c01f2695c0c908112a4eead87e3ef3ff534768ad930e7ca1
https://github.com/PowerShell/PowerShell/pull/18902/files#diff-1b256250c40f42b7c01f2695c0c908112a4eead87e3ef3ff534768ad930e7ca1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.