From 8a33210d1b104db04743f127ea617ab40e2bcdda Mon Sep 17 00:00:00 2001
From: Duncan Salerno <duncan.salerno@gmail.com>
Date: Tue, 2 Oct 2012 22:22:44 +0100
Subject: [PATCH] http: prevent the Range header being sent when seekability
 probing isnt used

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavformat/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index caedf1181e..d385011203 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -419,10 +419,10 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
     if (!has_header(s->headers, "\r\nAccept: "))
         len += av_strlcpy(headers + len, "Accept: */*\r\n",
                           sizeof(headers) - len);
-    // Note: we send this on purpose even when s->off is 0,
+    // Note: we send this on purpose even when s->off is 0 when we're probing,
     // since it allows us to detect more reliably if a (non-conforming)
     // server supports seeking by analysing the reply headers.
-    if (!has_header(s->headers, "\r\nRange: ") && !post)
+    if (!has_header(s->headers, "\r\nRange: ") && !post && (s->off > 0 || s->seekable == -1))
         len += av_strlcatf(headers + len, sizeof(headers) - len,
                            "Range: bytes=%"PRId64"-\r\n", s->off);