Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save & restore the state of [Net.ServicePointManager]::SecurityProtocol #240

Conversation

giuseppecampanelli
Copy link
Contributor

@giuseppecampanelli giuseppecampanelli commented Jun 14, 2020

Description

Save & restore the state of [Net.ServicePointManager]::SecurityProtocol

Issues Fixed

Fixes #230

References

Checklist

  • You actually ran the code that you just wrote, especially if you did just "one last quick change".
  • Comment-based help added/updated, including examples.
  • Static analysis is reporting back clean.
  • New/changed code adheres to our coding guidelines.
  • Changes to the manifest file follow the manifest guidance.
  • Unit tests were added/updated and are all passing. See testing guidelines.
  • Relevant usage examples have been added/updated in USAGE.md.
  • If desired, ensure your name is added to our Contributors list

Copy link
Member

@HowardWolosky HowardWolosky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking on this change!

Invoke-WebRequest will throw an exception if it doesn't return back a successful result. You're going to need to capture the current securityProtocol outside the scope of the try, and then you'll need to restore it within the context of a finally for that try/catch/finally expression in order for the change to be robust.

Thanks again!

@HowardWolosky HowardWolosky added the bug This relates to a bug in the existing module. label Jun 15, 2020
GitHubCore.ps1 Outdated Show resolved Hide resolved
GitHubCore.ps1 Outdated Show resolved Hide resolved
Copy link
Member

@HowardWolosky HowardWolosky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on! Will get it merged shortly.

@HowardWolosky
Copy link
Member

/azp run PowerShellForGitHub-CI

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@HowardWolosky
Copy link
Member

/azp run PowerShellForGitHub-CI

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@HowardWolosky HowardWolosky merged commit 618398e into microsoft:master Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This relates to a bug in the existing module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Net.ServicePointManager]::SecurityProtocol is Globally Modified by the Module
2 participants