From 2f0452916572a780d3dfcd7653ea73df568aa1a7 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Wed, 5 Feb 2014 17:32:09 -0800 Subject: [PATCH] Don't use chunked encoding on range requests If the client is requesting a partial file, don't use chunked encoding. This makes video files work in iTunes. --- src/evhttp/http.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/evhttp/http.c b/src/evhttp/http.c index 67ae250a..46bd9d4f 100644 --- a/src/evhttp/http.c +++ b/src/evhttp/http.c @@ -2014,7 +2014,9 @@ evhttp_send_reply_start(struct evhttp_request *req, int code, evhttp_connection_stop_detectclose(req->evcon); evhttp_response_code(req, code, reason); - if (req->major == 1 && req->minor == 1) { + /* If the client is requesting a partial file, don't use + * chunked encoding, or video files won't work in iTunes. */ + if (req->major == 1 && req->minor == 1 && code == 200) { /* use chunked encoding for HTTP/1.1 */ evhttp_add_header(req->output_headers, "Transfer-Encoding", "chunked");