Questions tagged [chunked-encoding]

Chunked encoding involves transferring the body of a message as a series of chunks, each with its own chunk size header.

This defined process means that an application-generated entity body, or a large entity body, can be sent in convenient segments. The client or server knows the chunked message is complete when the zero length chunk is received.

The body of a chunked message can be followed by an optional trailer that contains supplementary HTTP headers, known as trailing headers. Clients and servers are not required to accept trailers, so the supplementary HTTP headers should only provide non-essential information, unless a server knows that a client accepts trailers.

To use chunked transfer-coding, both the client and server must be using HTTP/1.1. A chunked message cannot be sent to an HTTP/1.0 client. The requirements that apply to chunked transfer-coding and the use of trailing headers are defined in the HTTP/1.1 specification

Source

421 questions
15
votes
3 answers

NGINX Error: upstream sent invalid chunked response while reading upstream

We have tomcat with Jersey serving APIs behind NGINX. A new streaming API we have developed worked great when we call Tomcat directly, but started getting no response when calling it through NGINX. Looking at NGINX logs we got: upstream sent invalid…
galusben
  • 5,948
  • 6
  • 33
  • 52
15
votes
1 answer

How to proxy HTTP requests in Spring MVC?

I have an application built on top of Spring MVC. I want to write simple proxy that processes requests as follows: send the same HTTP request to some specific server capture HTTP response from this specific server return the same answer to…
15
votes
4 answers

How can I set Transfer-Encoding to chunked, explicitly or implicitly, in an ASP.NET response?

Can I simply set the Transfer-Encoding header? Will calling Response.Flush() at some point cause this to occur implicitly? EDIT No, I Cannot call Response.Headers.Add("Transfer-Encoding","anything"); That throws. any other…
Cheeso
  • 189,189
  • 101
  • 473
  • 713
14
votes
2 answers

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

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…
Matt
  • 774
  • 1
  • 10
  • 28
14
votes
2 answers

Response sent in chunked transfer encoding and indicating errors happening after some data has already been sent

I am sending large amount of data in my response to the client in chunked transfer encoding format. How should I be dealing with any errors that occur midway during writing of the response? I would like to know if there is any HTTP Spec…
Kiran
  • 56,921
  • 15
  • 176
  • 161
13
votes
3 answers

How do disable Transfer-Encoding in Tomcat 6

I have a web application running on Tomcat 6.0.29 server and JDK 1.6. When I send the response to the client, Tomcat sends Transfer-Encoding: chunked in the headers when the response size is > 8KB. For responses < 8KB, it sends Content-Length :…
Rajendra
  • 1,703
  • 2
  • 16
  • 22
13
votes
2 answers

org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected

I am trying out RestAssured & wrote the following statements - String URL = "http://XXXXXXXX"; Response result = given(). header("Authorization","Basic xxxx"). contentType("application/json"). when(). …
12
votes
1 answer

Aborting a HTTP/1.1 chunk encoded response

Is there a standard way to handle response failure for chunked responses? I have poured through the RFCs and don't see a standard way of handling this. My understanding of chunked responses is that they're useful when we cannot process the entire…
JaredC
  • 5,150
  • 1
  • 20
  • 45
12
votes
1 answer

Avoiding ChunkedEncodingError for an empty chunk with Requests 2.3.0

I'm using Requests to download a file (several gigabytes) from a server. To provide progress updates (and to prevent the entire file from having to be stored in memory) I've set stream=True and wrote the download to a file: with open('output', 'w')…
Bailey Parker
  • 15,599
  • 5
  • 53
  • 91
12
votes
2 answers

Handling HTTP chunked encoding with django

I have a problem handeling http chunked transfer encoding. I'm using: apache. mod_wsgi plugin. django. django, is only capable of handling reqular http request with content-length header field, but when it comes to handling TE…
securecurve
  • 5,589
  • 5
  • 45
  • 80
11
votes
4 answers

Duplicate chunks on JSON response

I've got a fairly standard MEAN project setup with the angular-fullstack generator using yeoman. What I'm finding is that when GETting a largish (over 65536 bytes) json result, it is encoded using gzip and chunked, but the json returned is not valid…
Joe
  • 11,147
  • 7
  • 49
  • 60
11
votes
1 answer

Restlet streaming data

I have this task that I'm undertaking where I would be reading data from a device and make it available over a web service. The data is read 4 times a second. I want the web clients to be have an open HTTP connection and get the device readings as a…
Professor Chaos
  • 8,850
  • 8
  • 38
  • 54
10
votes
3 answers

What are alternatives to NSURLConnection for chunked transfer encoding

I've checked for other questions relevant to this, but the only answer is "Use ASIHTTPRequest" as this is no longer being developed I wanted to ask what alternatives people are using, whilst working on our SDK I came across a lot of strange…
pyr0manic
  • 103
  • 1
  • 6
10
votes
1 answer

Enabling nginx Chunked Transfer Encoding

It looks like nginx 0.8.35 may support chunked transfer encoding: Changes with nginx 0.8.35 01 Apr 2010 *) Change: now the charset filter runs before the SSI filter. *) Feature: the…
rentzsch
  • 3,548
  • 4
  • 27
  • 39
10
votes
2 answers

How to tell the HTTP server to not send chunked encoding

I am currently writing a HTTP client to do a HTTP POST on a URL that returns a HTTP response. However, for error messages code 400 and 500, it sends back non chunked HTTP response, and for success messages, 201, it sends a chunked response. In the…
roymustang86
  • 8,054
  • 22
  • 70
  • 101
1
2
3
28 29