Powershellを使用する5.0.10586.117ログインするフォームを含む特定のWebサイト(IIS 8.5上)を要求したいと思います。Powershell-command Invoke-webrequestログインフォームがハングする
$Url = Invoke-Webrequest -Uri "https://not-work/hello.aspx" -SessionVariable SesVar
$UrlForm = $Url.Forms[0]
このようにすると、手動で割り込みしない限りPowershellがハングして何も返されません。
VERBOSE: Get https://not-work/hello.aspx with 0-byte payload.
それが動作するGoogle Chromeの55.0.2883.87で同じWebサイトを実行:
$Url = Invoke-Webrequest -Verbose -Uri "https://not-work/hello.aspx" -SessionVariable SesVar
は、私は次のようなエラーを見ることができます使用
。別の(古いIISの可能性がある)アプリケーションコードの古いバージョンを使用するとPowershellでも動作します。
この問題がPowershellのbugと関係がある場合、私は疑問に思っていますか?
注:
$Url = Invoke-Webrequest -UseBasicParsing -Verbose -Uri "https://not-work/hello.aspx" -SessionVariable SesVar
を使用した場合でも、それが失敗しました。完全を期すために
、カールも(Chromeのような)HTTPステータスコード200を与えるが、作業バージョンと比較していくつかの違いがあります。
非稼働ウェブサイト
は、C:\Tools\curl>curl -k https://not-work/hello.aspx -I HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 12671
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319
Set-Cookie: __AntiXsrfToken=d438e79fe7004ad09d950a3b8b4e507d; path=/; HttpOnly
Set-Cookie: .ASPXAUTH=; expires=Mon, 11-Oct-1999 22:00:00 GMT; path=/; HttpOnly
X-Powered-By: ASP.NET
Date: Thu, 12 Jan 2017 13:57:33 GMT
作業するウェブサイト
C:\Tools\curl>curl -k https://works-well/hello.aspx -I HTTP/1.1 200 OK
Cache-Control: private Content-Length: 12306 Content-Type: text/html; charset=utf-8
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Server: WWW Server/1.1 X-XSS-Protection: 1; mode=block
Set-Cookie: __AntiXsrfToken=6142de1c5d474da780530da39fea033f; path=/;HttpOnly; Secure
Date: Thu, 12 Jan 2017 15:56:47 GMT
ところで、Internet Explorer(IE)11.0.9600.18537では、画像のようなオブジェクトはロードされません(IEのDLLを使ってPowershellが「フードの下で」動作すると思うように)、「砂時計」がタブの隣に永久に実行されています要求されたURI
もう一度私の質問:この問題はPowershellのbugと関係がありますか?
はい、「私の」ウェブサイトにFORMSオプションがあることを確認できます。 – Joey