Repository navigation
Closed
Labels
Issue-BugIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.Resolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-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
Using 'Invoke-WebRequest -UseBasicParsing', the returned BasicHtmlWebResponseObject does not parse <input> tags correctly. It assumes they will be closed with a '/>' or '</input>'. However in html, neither the slash nor closing tag is required/legal depending on your html flavour.
The bug is in BasicHtmlWebResponseObject.Common.cs. The s_inputFieldRegex is set to:
@"<input\s+[^>]*(/>|>.*?</input>)"
But it should be:
@"<input\s+[^>]*(/>|>|>.*?</input>)"
Looking at the history the problem has been there since PowerShell 3.0, and remains unfixed in the latest PowerShell Core.
Expected behavior
Suppose we will perform an HTTP GET thusly:
`$response = Invoke-WebRequest -UseBasicParsing -Url 'https://localhost/test.html'`
And the returned html is:
`<html><body><input name='foo' value='mcgoo'></body>/</html>`
$response.InputFields should contain 1 element. $response.InputFields.FindByName('foo') should return the element.Actual behavior
Instead $response.InputFields contains no elements, and $response.InputFields.FindByName('foo') returns $null.Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 10.0.18363
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
Issue-BugIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.Resolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues
Activity
farmerau commentedon Oct 4, 2021
I'll try to take a look into this.
farmerau commentedon Nov 6, 2021
richard-browne The fix for this was merged.
CarloToso commentedon Dec 2, 2022
Ilya (@iSazonov) this is no longer an issue, could you please close it?