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

Abierto
#400 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
57/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
powershell
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
PowerShell
Estrellas
251
Forks
102
Merge medio
2 min
PR fusionados (30 d)
4

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de OSDeploy/OSD

Todos los issues de OSDeploy/OSD

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.