]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- added support for undocumented Request-Range header
authorrousskov <>
Fri, 25 Sep 1998 02:20:20 +0000 (02:20 +0000)
committerrousskov <>
Fri, 25 Sep 1998 02:20:20 +0000 (02:20 +0000)
  the header is used by Netscape (with Adobe plugin working)
  Request-Range is assumed to match Range header so only
  the former is actually used when both are provided.

src/HttpHeader.cc
src/enums.h

index 7c0f4395e9598ded4e8c145dc4163fa79ea6a3f6..5c6cd5b3176d2dc353b71cf1e83a90bf8e6f9209 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpHeader.cc,v 1.55 1998/09/15 19:37:41 wessels Exp $
+ * $Id: HttpHeader.cc,v 1.56 1998/09/24 20:20:22 rousskov Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -103,6 +103,7 @@ static const HttpHeaderFieldAttrs HeadersAttrs[] =
     {"Public", HDR_PUBLIC, ftStr},
     {"Range", HDR_RANGE, ftPRange},
     {"Referer", HDR_REFERER, ftStr},
+    {"Request-Range", HDR_REQUEST_RANGE, ftPRange}, /* usually matches HDR_RANGE */
     {"Retry-After", HDR_RETRY_AFTER, ftStr},   /* for now (ftDate_1123 or ftInt!) */
     {"Server", HDR_SERVER, ftStr},
     {"Set-Cookie", HDR_SET_COOKIE, ftStr},
@@ -186,8 +187,8 @@ static http_hdr_type RequestHeadersArr[] =
 {
     HDR_AUTHORIZATION, HDR_FROM, HDR_HOST, HDR_IF_MODIFIED_SINCE,
     HDR_IF_RANGE, HDR_MAX_FORWARDS, HDR_PROXY_CONNECTION,
-    HDR_PROXY_AUTHORIZATION, HDR_RANGE, HDR_REFERER, HDR_USER_AGENT,
-    HDR_X_FORWARDED_FOR
+    HDR_PROXY_AUTHORIZATION, HDR_RANGE, HDR_REFERER, HDR_REQUEST_RANGE, 
+    HDR_USER_AGENT, HDR_X_FORWARDED_FOR
 };
 
 /* header accounting */
@@ -677,7 +678,7 @@ httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange * range)
     Packer p;
     assert(hdr && range);
     /* remove old directives if any */
-    httpHeaderDelById(hdr, HDR_CONTENT_RANGE);
+    httpHeaderDelById(hdr, HDR_RANGE);
     /* pack into mb */
     memBufDefInit(&mb);
     packerToMemInit(&p, &mb);
@@ -777,9 +778,14 @@ httpHeaderGetRange(const HttpHeader * hdr)
 {
     HttpHdrRange *r = NULL;
     HttpHeaderEntry *e;
-    if ((e = httpHeaderFindEntry(hdr, HDR_RANGE))) {
+    /* some clients will send "Request-Range" _and_ *matching* "Range"
+     * who knows, some clients might send Request-Range only;
+     * this "if" should work correctly in both cases;
+     * hopefully no clients send mismatched headers! */
+    if ((e = httpHeaderFindEntry(hdr, HDR_RANGE)) ||
+       (e = httpHeaderFindEntry(hdr, HDR_REQUEST_RANGE))) {
        r = httpHdrRangeParseCreate(&e->value);
-       httpHeaderNoteParsedEntry(HDR_RANGE, e->value, !r);
+       httpHeaderNoteParsedEntry(e->id, e->value, !r);
     }
     return r;
 }
index 69629f12986f420debec84fec14837265c020d2f..8d4880580b9b92ad0313ddaeac232e1f756e8998 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.131 1998/09/19 20:51:21 wessels Exp $
+ * $Id: enums.h,v 1.132 1998/09/24 20:20:20 rousskov Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -212,6 +212,7 @@ typedef enum {
     HDR_PROXY_CONNECTION,
     HDR_PUBLIC,
     HDR_RANGE,
+    HDR_REQUEST_RANGE,          /* some clients use this, sigh */
     HDR_REFERER,
     HDR_RETRY_AFTER,
     HDR_SERVER,