Skip to content

Make all functions use the default proxy(if the proxy was enabled) when no proxy specified #44

Description

@chucklu

Expected Behavior

register the ps repository successfully

Current Behavior

nothing happened

Possible Solution

when no proxy specified, then invoke the default proxy (when the proxy was enabled)
https://stackoverflow.com/questions/571429/powershell-web-requests-and-proxies

Steps to Reproduce (for bugs)

set the proxy on computer

Context

related to PowerShell/WindowsCompatibility#45
I want to register ps repository

Your Environment

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
> Get-Module
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.0        build                               {Clear-PSRepo, Compress-TestContent, Convert-TxtResourceToXml, ConvertFrom-PesterLog...}
Script     0.0        chuck                               Reset-FolderTime
Script     0.0        Get-PSGalleryApiAvailability
Manifest   6.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty...}
Manifest   6.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty...}
Manifest   6.1.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}
Manifest   6.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Manifest   6.1.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}
Script     1.1.7.2    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}
Script     1.0.0.0    posh-git                            {Add-PoshGitToProfile, Expand-GitCommand, Format-GitBranchName, Get-GitBranchStatusColor...}
Script     2.0.1      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}
Script     2.0.0      PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler...}
> Get-Module -ListAvailable PowerShellGet,PackageManagement
ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     1.1.7.2    PackageManagement                   Desk      {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     1.6.7      PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
> Get-PackageProvider
Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            1.6.7.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, Ac...
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            1.6.7.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, Ac...

Activity

  1. chucklu commented on Sep 26, 2018

    @chucklu
    Author

    The same problem with Install-Module, I think you should make all function can work with the default proxy by default automatically(when the default proxy was enabled).

    ~\source\repos\GitHub\Other\PowerShellGet [development ≡]> ((Get-Command -Name Install-Module).Parameters).Keys
    Name
    InputObject
    MinimumVersion
    MaximumVersion
    RequiredVersion
    Repository
    Credential
    Scope
    Proxy
    ProxyCredential
    AllowClobber
    SkipPublisherCheck
    Force
    AllowPrerelease
    AcceptLicense
    Verbose
    Debug
    ErrorAction
    WarningAction
    InformationAction
    ErrorVariable
    WarningVariable
    InformationVariable
    OutVariable
    OutBuffer
    PipelineVariable
    WhatIf
    Confirm
  2. changed the title [-]Make the Register-PSRepository use the default proxy(if the proxy was enabled) when no proxy specified[/-] [+]Make all functions use the default proxy(if the proxy was enabled) when no proxy specified[/+] on Apr 2, 2019
  3. chucklu commented on Apr 2, 2019

    @chucklu
    Author

    Hi Sydney Smith (@SydneyhSmith),
    Do you have any plan about this feature? use the default proxy automatically.

  4. edyoung commented on Apr 2, 2019

    @edyoung

    I'm afraid we have no plan to implement. That doesn't mean it won't happen or we think it's a bad idea, just that everyone is working on other things at the moment (most bugs fall in to this category). Happy to consider PRs, or if this gets lots of upvotes or passionate comments it will move up the list.

  5. chucklu commented on Apr 2, 2019

    @chucklu
    Author

    Hi Edwin Young (@edyoung) ,
    I encounter the same problem again when I am using Publish-Script function, you can check more details in https://github.com/PowerShell/PowerShellGet/issues/458 .
    There is no Proxy parameter for Publish-Script, I did not have a chance to specify the proxy.

  6. chucklu commented on Apr 2, 2019

    @chucklu
    Author

    I got the error info as following after waiting 5 minutes for Publish-Script

    Publish-PSArtifactUtility : Failed to publish script 'chuck': 'info : Pushing chuck.1.0.0.nupkg to 'https://www.powershellgallery.com/api/v2/package/'...
    info :   PUT https://www.powershellgallery.com/api/v2/package/
    info : An error was encountered when fetching 'PUT https://www.powershellgallery.com/api/v2/package/'. The request will now be retried.
    info : An error occurred while sending the request.
    info :   The server returned an invalid or unrecognized response.
    info :   PUT https://www.powershellgallery.com/api/v2/package/
    info : An error was encountered when fetching 'PUT https://www.powershellgallery.com/api/v2/package/'. The request will now be retried.
    info : An error occurred while sending the request.
    info :   The server returned an invalid or unrecognized response.
    info :   PUT https://www.powershellgallery.com/api/v2/package/
    error: The operation was canceled.
    error:   Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
    error:   The I/O operation has been aborted because of either a thread exit or an application request.
    error:   Pushing took too long. You can change the default timeout of 300 seconds by using the --timeout <seconds> option with the push command.
    '.
    At C:\Program Files\PowerShell\Modules\PowerShellGet\2.1.2\PSModule.psm1:10952 char:17
    + ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToPublishTheScript,Publish-PSArtifactUtility
    
  7. Benny1007 commented on Jun 12, 2019

    @Benny1007

    Chuck LU (@chucklu) what happens if you update your nuget.config file with your proxy details?

  8. chucklu commented on Jun 13, 2019

    @chucklu
    Author

    benny1007 (@Benny1007) As I mentioned here, the NuGet works fine with my default proxy. There is no need to add proxy to nuget.config.

  9. chucklu commented on Aug 27, 2019

    @chucklu
    Author

    Hi Steve Lee (@SteveL-MSFT) ,
    Would this issue be solved by PowerShell/PowerShell#9495 ?

  10. SydneyhSmith commented on Aug 28, 2019

    @SydneyhSmith
    Collaborator

    Chuck LU (@chucklu) looking through this issue and wondering if you have had a chance to see if you are still hitting this issue on the latest versions of PowerShell(7 - preview 3) and PowerShellGet (2.2.1)?Thanks!

  11. chucklu commented on Aug 29, 2019

    @chucklu
    Author

    I will try with Powershell7-preview3 later.

    Find-Module WindowsCompatibility
  12. added this to the vNext milestone on Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions