Percent-encoded slash (“/”) is decoded before the request dispatch

前端 未结 3 557
北恋
北恋 2020-12-11 01:39

I have an URL containing several slash characters (/) as a part of the filename (not the URL). But when I send http request, the percent-encoded %2F

3条回答
  •  执念已碎
    2020-12-11 01:52

    If you're going to use PowerShell you can also do Workaround 1 in pure PowerShell:

    function UrlFix([Uri]$url) {
        $url.PathAndQuery | Out-Null
        $m_Flags = [Uri].GetField("m_Flags", $([Reflection.BindingFlags]::Instance -bor [Reflection.BindingFlags]::NonPublic))
        [uint64]$flags = $m_Flags.GetValue($url)
        $m_Flags.SetValue($url, $($flags -bxor 0x30))
    }
    
    UrlFix $ChromeUrl
    Invoke-WebRequest -Uri $ChromeUrl -OutFile $FilePath -Verbose
    

提交回复
热议问题