-
Notifications
You must be signed in to change notification settings - Fork 7.6k
WebCmdlet unix-sockets #19343
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
WebCmdlet unix-sockets #19343
Conversation
Unrelated test error |
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/resources/WebCmdletStrings.resx
Outdated
Show resolved
Hide resolved
I wonder whether we should handle |
get => _unixSocket; | ||
set | ||
{ | ||
if (Socket.OSSupportsUnixDomainSockets is true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to create UnixSocket if Socket.OSSupportsUnixDomainSockets is false? I guess no. So it makes no sense to add the check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iSazonov unfortunately I can't check at the moment, could you test what happens if Socket.OSSupportsUnixDomainSockets is false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnixDomainSocketEndPoint throws https://source.dot.net/#System.Net.Sockets/System/Net/Sockets/UnixDomainSocketEndPoint.cs,59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually System.Net.Sockets.Socket..ctor(AddressFamily, SocketType, ProtocolType)
will throw a SocketException
with the message "An address incompatible with the requested protocol was used":
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation an Windows will attempt to create create a socket by calling the underlying Winsock API:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to create UnixSocket if Socket.OSSupportsUnixDomainSockets is false? I guess no. So it makes no sense to add the check.
We probably want to perform the check so that we can create the appropriate ErrorRecord
with a more informative message, i.e.:
if (!Socket.OSSupportsUnixDomainSockets)
ThrowTerminatingError(GetUnixDomainSocketNotSupportedError())
```</strike>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said, the error handling of System.Net.Sockets.SocketPal.CreateSocket could be improved.
…trings.resx Co-authored-by: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Co-authored-by: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Outdated
Show resolved
Hide resolved
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
@SteveL-MSFT |
I agree with @iSazonov, error handling is not required, see #19343 (comment). |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
1 similar comment
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@CarloToso The markdown spelling check failed. Please fix the markdown spelling issues. |
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
PR Summary
Replaces #18995 after the changes in #19249
HttpClientHanlder
withSocketsHttpHandler
Syntax:
curl --unix-socket /var/run/docker.sock http://v1.40/images/json
Invoke-WebRequest -Uri "http://v1.40/images/json/" -UnixSocket "/var/run/docker.sock"
TODO:
Add specific tests (Help Wanted)DONEAdd documentationDONEPR Context
fix #12060
fix #8314
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).