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
5
votes
0 answers

How do I continuously pipe to curl and post with chunking?

I know that curl can post data to a URL: $ curl -X POST http://httpbin.org/post -d "hello" { "args": {}, "data": "", "files": {}, "form": { "hello": "" }, "headers": { "Accept": "*/*", "Content-Length": "5", …
user5406764
  • 1,627
  • 2
  • 16
  • 23
5
votes
3 answers

Using Nodejs to Serve an MP4 Video File

I am trying to serve a ~52MB mp4 video file from a nodejs server. Attached below is a screenshot of the code used to serve the file. I have an object of mime types for static file calls which contains the mime type for mp4. var mimeTypes = { html:…
isaac9A
  • 903
  • 4
  • 12
  • 30
5
votes
2 answers

Why are some servers not using CRLF after the last chunk length of zero?

I'm working with an HTTP request tool (similar to cURL) and having an issue with the server response. Either that or my understanding of the RFC for HTTP 1.1 and chunked data. What I'm seeing is chunked data should be in this…
bvstone
  • 587
  • 2
  • 6
  • 17
5
votes
1 answer

Failed to load PDF document - Angular JS - BLOB

I am trying to get PDF document from Web API, and want to show in Angular App. Getting "Failed to load PDF document error". I have followed "AngularJS: Display blob (.pdf) in an angular app" post. Whereas, i can download the same file successfully…
Mahesh Pulle
  • 173
  • 1
  • 2
  • 9
5
votes
1 answer

Anyone have sample code for doing a "chunked" HTTP streaming download of one web directly to a upload to a separate web server?

Background - I'm trying to stream an existing webpage to a separate web application, using HttpWebRequest/HttpWebResponse in C#. One issue I'm striking is that I'm trying to set the file upload request content-length using the file download's…
Greg
  • 34,042
  • 79
  • 253
  • 454
5
votes
2 answers

HTTP streaming / chunked responses on Heroku with clojure

I'm making a clojure web app that streams data to clients using chunked HTTP responses. This works great when I run it locally using foreman, but doesn't work properly when I deploy it to Heroku. A minimal example exhibiting this behaviour can be…
rufo
  • 61
  • 5
5
votes
0 answers

Chunked transfer encoding: How to make content invalid

I need to use chunked transfer encoding and I am dealing with possible error issues during generating the content. In case some error occur during the processing the content I am sending, I need to make (partial) content, which has been already…
Ωmega
  • 42,614
  • 34
  • 134
  • 203
5
votes
2 answers

Get Size of HTTP Response in Java

I would like to know how much data was sent in response to a certain http-request. What I currently do is this: HttpURLConnection con = (HttpURLConnection) feedurl.openConnection(); //check the response for the content-size int feedsize =…
er4z0r
  • 4,711
  • 8
  • 42
  • 62
5
votes
3 answers

How do I send an HTTP response without Transfer Encoding: chunked?

I have a Java Servlet that responds to the Twilio API. It appears that Twilio does not support the chunked transfer that my responses are using. How can I avoid using Transfer-Encoding: chunked? Here is my code: // response is HttpServletResponse //…
Adam
  • 43,763
  • 16
  • 104
  • 144
4
votes
1 answer

Terrible Apache Bench results on Custom CMS

Please note: This is not a complain about a shoddy CMS. Just toying with Apache Bench and got terrible results with our custom CMS, more exactly i got: Requests per second: 0.37 [#/sec] (mean) When i run another test with a plain php file i…
fabrik
  • 14,094
  • 8
  • 55
  • 71
4
votes
3 answers

How to received chunked responses in HTTP/1.1 while sending data at the same time to server in Java/Android

We're building and app on which it records the voice of the user in realtime and sends the recorded data to the server through an HTTP request. While the server processes the data in realtime it is also sending back responses in chunked. To put it…
JLT
  • 3,052
  • 9
  • 39
  • 86
4
votes
3 answers

requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(0 bytes read, 512 more expected)', IncompleteRead

I wanted to write a program to fetch tweets from Twitter and then do sentiment analysis. I wrote the following code and got the error even after importing all the necessary libraries. I'm relatively new to data science, so please help me. I could…
4
votes
1 answer

Does node js "response.on('data', func(chunk))" guarantee the chunk boundary

I am trying to implement my node js service to use http streaming (transfer-encoding: chunked) to send back response. I use "response.on('data', func(chunk))" to receive each chunk sent back from the service, and it is working now. My question is…
4
votes
1 answer

Does Apache HttpClient (4.5) support chunked data?

I have a simple method to send a POST request: public HttpResponse post(InputStream content, String contentType, URI url) { InputStreamEntity entity = new InputStreamEntity(content); entity.setChunked(true); …
Pleymor
  • 2,611
  • 1
  • 32
  • 44
4
votes
1 answer

Can I render text/plain content as it arrives?

I have an server that delivers data that it processes over about 15 seconds. The headers are as follows: Content-Type:text/plain; charset=utf-8 Transfer-Encoding:chunked With telnet I can confirm that data is sent continuously over 15 seconds. In a…
captncraig
  • 22,118
  • 17
  • 108
  • 151