Skip to content

How to send an HTTP POST request without buffering or setting Content-Length? #28828

Answered by Tratcher
AArnott asked this question in Q&A
Discussion options

You must be logged in to vote

This is due to #24984.

tested with requests that lack a Content-Length header (or with an incorrect one)

All HTTP/1.1 requests must have a valid Content-Length header or a Transfer-Encoding: chunked header. That's enforced by the server. TestServer was updated to more closely mirror a valid client and generate the expected headers.

It seems the request stream is buffered on the client and the determined length is then used as the header.

That shouldn't be happening. Can you show how you created the non-seekable stream? The ContentLength property is checked, but that shouldn't trigger full buffering. For a streaming request you can avoid any of the new logic by setting HttpRequestMessa…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@AArnott
Comment options

AArnott Dec 27, 2020
Collaborator Author

@Tratcher
Comment options

Answer selected by AArnott
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants