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

net/http: set Content-Length:0 for empty PATCH requests as with POST, PATCH #40991

Closed
wants to merge 1 commit into from
Closed

net/http: set Content-Length:0 for empty PATCH requests as with POST, PATCH #40991

wants to merge 1 commit into from

Conversation

Segflow
Copy link
Contributor

@Segflow Segflow commented Aug 23, 2020

Sets Content-Length:0 for nil bodies in PATCH requests, as we already do for POST and PUT requests.

RFC 2616 mentions that unless a method’s Content-Length is forbidden it can send one.
In the wild, we’ve found that Microsoft Azure’s DataLake Gen2 storage API https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update deliberately rejects PATCH requests without a Content-Length, yet there is no workaround for setting that header when trying to flush the content of a file which was uploaded in a previous request.

Fixes #40978

@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Aug 23, 2020
@gopherbot
Copy link
Contributor

This PR (HEAD: 12a3903) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/250039 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Emmanuel Odeke:

Patch Set 2:

(3 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

@Segflow Segflow changed the title net/http: set Content-Length header on PATCH requests simliar to POST and PUT net/http: set Content-Length:0 for empty PATCH requests as with POST, PATCH Aug 24, 2020
@gopherbot
Copy link
Contributor

Message from Meher Assel:

Patch Set 4:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Emmanuel Odeke:

Patch Set 4: Run-TryBot+1 Code-Review+2

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 4:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=4be3b4b0


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 4: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Emmanuel Odeke:

Patch Set 5: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=e0ec8f6d


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/250039.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Aug 24, 2020
… PATCH

Sets Content-Length:0 for nil bodies in PATCH requests, as we already do for  POST and PUT requests.

RFC 2616 mentions that unless a method’s Content-Length is forbidden it can send one.
In the wild, we’ve found that Microsoft Azure’s DataLake Gen2 storage API https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update deliberately rejects PATCH requests without a Content-Length, yet there is no workaround for setting that header when trying to flush the content of a file which was uploaded in a previous request.

Fixes #40978

Change-Id: Ib0a623b907d827a1c5ee431dca3c41024fa291c5
GitHub-Last-Rev: 12a3903
GitHub-Pull-Request: #40991
Reviewed-on: https://go-review.googlesource.com/c/go/+/250039
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/250039 has been merged.

@gopherbot gopherbot closed this Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

net/http: Content-Length: 0 is not set for PATCH requests with empty body
3 participants