Skip to content

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
Contributor

@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
Copy link
Contributor

@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
Contributor

/azp run PowerShellForGitHub-CI

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@HowardWolosky
Copy link
Contributor

/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