Repository navigation
Closed
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Invoke-WebRequest -Uri 'https://www.foxit.com/downloads/latest.html?product=Foxit-Reader&platform=Windows&version=&package_type=exe&language=German' -Method HeadExpected behavior
Invoke-WebRequest succeeds without issues.
I cannot reproduce this behavior with v7.2.7.
Actual behavior
Invoke-WebRequest fails. The provided URI is claimed to be invalid, since the hostname is not parsed correctly.
Error details
Exception :
Type : System.UriFormatException
TargetSite :
Name : CreateThis
DeclaringType : uri
MemberType : Method
Module : System.Private.Uri.dll
Message : Invalid URI: The hostname could not be parsed.
Source : System.Private.Uri
HResult : -2146233033
StackTrace :
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri.CreateUri(Uri baseUri, String relativeUri, Boolean dontEscape)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ParseLinkHeader(HttpResponseMessage response, Uri requestUri)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Invoke-WebRequest], UriFormatException
FullyQualifiedErrorId : System.UriFormatException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
InvocationInfo :
MyCommand : Invoke-WebRequest
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 5
Line : Invoke-WebRequest -Uri 'https://www.foxit.com/downloads/latest.html?product=Foxit-Reader&platform=Windows&version=&package_type=exe&language=German' -Method Head
PositionMessage : At line:1 char:1
+ Invoke-WebRequest -Uri 'https://www.foxit.com/downloads/latest.html?p …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Invoke-WebRequest
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1Environment data
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues
Activity
SteveL-MSFT commentedon Nov 14, 2022
This doesn't repro for me on Windows with 7.3.0:
Does this repro consistently for you?
brogers5 commentedon Nov 14, 2022
I can only consistently reproduce this on one of my devices: a self-assembled desktop running Windows 11 22H2.
I've attempted reproduction from a Dell XPS 13 9310 2-in-1 (personal laptop) running Windows 11 22H2, as well as an HP ZBook Studio G5 (work laptop) running Windows 10 Enterprise 20H2. The request succeeded on both devices without issues.
On the failing device, the call succeeds in Windows PowerShell, but I'm seeing a different response which may be relevant:
Based on the stack trace, I'm guessing we're trying to parse the
Linkheader's URI, which fails:adityapatwardhan commentedon Nov 14, 2022
It seems that the regression was introduced by this change: #15973
Maybe Steven (@sliekens) can help here?
sliekens commentedon Nov 15, 2022
Aditya Patwardhan (@adityapatwardhan) Brian Rogers (@brogers5)
I can see that the server is using unquoted rel types. (
rel=prefetchinstead ofrel="prefetch")*is not an allowed character for a hostname.SteveL-MSFT commentedon Nov 21, 2022
We should probably update the code so that if there is an exception parsing the links, we just leave the links empty and maybe emit a warning message.
microsoft-github-policy-service commentedon Nov 15, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 15, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 15, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 22, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.