-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Small changes in Webcmdlets #19109
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
Small changes in Webcmdlets #19109
Conversation
| currentUri = new Uri(request.RequestUri, response.Headers.Location); | ||
|
|
||
| // Continue to handle redirection | ||
| using (client = GetHttpClient(handleRedirect)) |
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.
Good step for #12764 (comment) You could continue...
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.
I will try to continue, can you give me a more detailed to-do list?
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.
I laid out there already. The goal is to cache HttpClient/HttpClientHandler in WebSession. These HttpClient/HttpClientHandler cannot be changed after they start. So if a cmdlet is called with modified arguments when there is a WebSession, we have to recreate them. This makes me think that our first step is to move all initialization to BeginProcessing. If it's possible, we can then implement caching.
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
| response = GetResponse(client, redirectRequest, handleRedirect); | ||
| } | ||
| using HttpRequestMessage redirectRequest = GetRequest(currentUri); | ||
| response = GetResponse(client, redirectRequest, handleRedirect); |
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.
Nit: it would great to inspect how we dispose HttpResponseMessage
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.
I noticed that:
response = GetResponse(client, redirectRequest, handleRedirect);line 1275return GetResponse(client, requestWithoutRange, handleRedirect);line 1309
are doing the same thing, I think they should have similar formatting, which one is better?
To dispose of HttpResponseMessage we could add using on line 1422, and it might be enough
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.
I don't understand the question about formatting.
To dispose of HttpResponseMessage we could add using on line 1422
Yes. And I see two callsites return GetResponse - I guess we need to dispose previous response before return new one.
In follow PR please.
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.
I'm sorry, I meant they should have the same syntax (not formatting) . And I wanted to know which syntax was more clear. In the next PR
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.
I still don't understand. Feel free to pull PR with your preference.
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
|
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) |
|
🎉 Handy links: |
PR Summary
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).