-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix webcmdlets so that an empty Get does not include a content-length header
#16587
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
Conversation
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Show resolved
Hide resolved
PaulHigin
left a comment
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.
Ok, I think this makes sense. There is no content but Get request expects content (and we know this because ContentType is non null) then we return empty content, and that is Ok with most servers. It feels like there is no breaking change here since we were returning empty content before anyway.
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
|
Will pickup cgmanifest and static analysis failures from doc hyperlinks once those PRs are merged to master rather than having those fixes as part of this PR |
|
@SteveL-MSFT We get another fix for #15186 in the PR #16563. It seems it cover more scenarios but doesn't have tests. How we will resolve the situation? |
|
@iSazonov unfortunately I didn't see that issue and the PR. I think I'll combine that PR into this one to cover other |
|
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) |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
🎉 Handy links: |
|
@PowerShell/powershell-maintainers Let's give this some bake time in 7.3 and reconsider. |
|
@PowerShell/powershell-committee This issue was introduced 2 LTS (during 7.0 preview) ago and doesn't meeting the servicing criteria that the maintainers understand they have the authority to approve. Please clarify if this meets the backport criteria. |
|
@PowerShell/powershell-committee reviewed this. Given this is a regression from 5.1 and PSCore6.x as well as real world impact based on the IETF RFC that we SHOULD not be sending content-length for empty payload, we recommend taking this to 7.2 |
|
/backport to release/v7.2.4 |
|
Started backporting to release/v7.2.4: https://github.com/PowerShell/PowerShell/actions/runs/2271259009
|
|
@TravisEz13 backporting to release/v7.2.4 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix webcmdlets so that an empty `Get` does not include a zero content-length
Applying: Fix handling of empty content
Applying: update cgmanifest
Using index info to reconstruct a base tree...
A cgmanifest.json
Falling back to patching base and 3-way merge...
Auto-merging tools/cgmanifest.json
CONFLICT (content): Merge conflict in tools/cgmanifest.json
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 update cgmanifest
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
|
🎉 Handy links: |
PR Summary
This change #10034 sets an empty string for the content which results in a
content-lengthheader with value 0. This was to fix a case where a web service doesn't accept explicit empty content for aputcall. However, this broke a case with agetcall where normally you don't send content and the server side is failing the request when we specify acontent-lengthheader with value 0.So the change here is to only add the
content-lengthheader for empty content if it's not agetmethod call.I was running the tests locally and the numerous progress bars being rendered created a different problem (hitting a debug assert), so to avoid that I suppressed all progress in the tests as it's not really used for the tests. Existing
gettest was modified to check that this header isn't being added.Also had to update dotnet links so that static analysis passes as their old links no longer work.
PR Context
If you use:
This fails with the server reporting a 500 (internal server error), but works with Windows PowerShell 5.1.
Fix #15186
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).