HTTP 1.1 - Can a client request that transfers not be "chunked"?
Asked Answered
S

2

14

Is it possible for a HTTP 1.1 client to set a header value that indicates the responses to requests should not be chunked? Or is the only way to prevent this, is to send a HTTP 1.0 request? I've tried googling around, but all I can find is ways to disable chunked transfers on HTTP 1.1 servers, so I am guessing it is not possible on a client, but I thought I'd ask anyways.

Sandbox answered 21/5, 2014 at 3:39 Comment(0)
S
10

In HTTP (starting with HTTP/1.1), recipients MUST support chunked encoding. See http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p1-messaging-26.html#rfc.section.4.1.p.4.

Stupidity answered 21/5, 2014 at 5:8 Comment(7)
It seems that you are correct. Although after reading it I did notice that was a draft of the standard. In case anyone else is interested, here is the finalized standard ietf.org/rfc/rfc2616.txt see the end of section 3.6.1Sandbox
RFC 2616 is the old one. The draft is the current spec and will be published as RFC shortly.Stupidity
Looks like you're right again... if it is approved. Would you mind editing your answer so it says "In HTTP 1.1, recipients...". Chunked encoding isnt part of HTTP 1.0 and earlier. I tried, but for whatever reason it seems as if my edit was reverted.Sandbox
Hmm... it didnt show as approved before, in fact it didnt say it was waiting for peer review at all anymore when I made my previous comment. A edit does appear now, but it isnt mine. Anyways thanks again for your help.Sandbox
When I said "it is approved" I was referring to the specification. See: datatracker.ietf.org/doc/draft-ietf-httpbis-p1-messagingStupidity
Note that chunked transfer is deprecated for HTTP/2.Scraggly
@MarkMcKenna - it's not "deprecated", it simply does not exist anymoreStupidity
R
-2

To get Content-Length in bytes instead of chunked inside the response with HTTP 1.1, you have to set Content-Length header and its size (long or int) based on the file you are expecting inside the response. long will be good so it can take care small as well as big file size. response will be HttpServletResponse. response.addHeader(Content-Length, Long.toString()); Thanks,

Returnee answered 28/1, 2017 at 22:3 Comment(1)
This may be correct from the server perspective (though a little Java specific) but the question is about requesting this from the client side.Correspondent

© 2022 - 2024 — McMap. All rights reserved.