Save-WebFile: curl download fails in WinPE proxy environment while Invoke-WebRequest works

オープン
#400 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
57/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
powershell
領域
backend

調査の方向性

Start with Public\Functions\Save-WebFile.ps1 and trace how Save-WebFile selects the WebClient and curl branches, including the header request and download command. Reproduce the reported failure in WinPE with a proxy, then compare it with the Invoke-WebRequest download that succeeds. Done means the download works through the WinPE proxy with a consistent configuration or a usable option to select the download method.

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

When using Save-WebFile from OSD 26.10.16.1 during the WinPE phase in a proxy environment, the download through curl.exe does not work.

Replacing the curl download command with Invoke-WebRequest allows the download to work in this environment.

The function already uses Invoke-WebRequest to retrieve the HTTP headers in the curl branch, but then uses curl.exe for the actual download. These two clients may use different proxy configurations.

To Reproduce

  1. Boot into WinPE in an environment where internet access requires a proxy.

  2. Load OSD 26.10.16.1.

  3. Run Save-WebFile to download a file, taking the curl download branch.

  4. The download through curl.exe fails.

  5. Replace the $curlCommandExpression assignment with:

    $curlCommandExpression = "iwr -uri `"$SourceUrl`" -outfile `"$DestinationFullName`" -UseBasicParsing"
    
  6. Repeat the download. It works using Invoke-WebRequest.

Expected behavior

Save-WebFile should download files reliably through the proxy available in the WinPE environment.

The HTTP header request and the actual download should use a consistent proxy configuration. Alternatively, the function could provide an option to use Invoke-WebRequest as the download method.

Screenshots

Not available.

Desktop (please complete the following information):

  • OS: Windows PE (WinPE), deployment phase
  • Browser: Not applicable
  • Version: OSD 26.10.16.1
  • WinPE build: Not provided
  • PowerShell version: Not provided

Smartphone (please complete the following information):

Not applicable.

Additional context

Affected function:
Save-WebFile.ps1, OSD 26.10.16.1

The function selects the WebClient branch when DefaultWebProxy.Address is populated, when -WebClient is specified, or when curl.exe is unavailable. Otherwise, it uses the curl branch.

The exact reason why the proxy configuration is usable by Invoke-WebRequest but not by the curl download still needs investigation.

This issue concerns the download implementation in Save-WebFile, independently of the direct TCP precheck in Test-WebConnection.

主要言語
PowerShell
スター
251
フォーク
102
平均マージ
2分
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OSDeploy/OSD のほかの issue

OSDeploy/OSD の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。