Powershell: Bad Request(400) is returned when calling Invoke-WebRequest with fragment(#)

Created on 16 Sep 2018  路  5Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

Invoke-WebRequest http://localhost/hello#fragment

Expected behavior

On PowerShell 5.1,

Invoke-WebRequest http://localhost/hello#fragment

apache httpd access.log:

 [16/Sep/2018:10:52:18 +0000] "GET /hello HTTP/1.1" 404 203 "-" "Mozilla/5.0 (Windows NT; Windows NT 10.0; ja-JP) WindowsPowerShell/5.1.17134.228"

Actual behavior

apache httpd access.log:

[16/Sep/2018:10:50:50 +0000] "GET /hello#fragment HTTP/1.1" 400 226 "-" "-"

The fragment is not cut off.

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Linux 3.10.0-862.2.3.el7.x86_64 #1 SMP Wed May 9 18:05:47 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Area-Cmdlets-Utility Issue-Bug Waiting - DotNetCore

All 5 comments

/cc @markekraus Could you please comment the Issue?

@chuanjiao10 the docker API's don't use fragments. Your comment is unrelated to this issue.

Looks like a regression in corefx introduced by a fix they made

CoreFx has merged the change, we'll pick it up in the future once it shows up in a .Net Core release

The fix is 3.0 milestone - we have to wait months.

Was this page helpful?
0 / 5 - 0 ratings