httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27715] - Client sending misformed Range "bytes = 0-100" instead "bytes=0-100"
Date Thu, 20 Oct 2005 17:14:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27715>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27715





------- Additional Comments From rcritten@redhat.com  2005-10-20 19:14 -------
The space parsing problem also affects how the range is determined. If one
specifies a negative range like -10, to fetch the last 10 bytes, and it is
preceeded by a space, the current code treats the space as a 0 so instead of the
last 10 bytes, you get the first 10. 

So this request:

GET /small.html HTTP/1.1
Host: localhost
Range: bytes= -10
Connection: close

returns bytes 0-9 instead of the the last 10.

A patch to fix both issues is:

--- http_protocol.c.orig        2005-10-20 11:54:44.000000000 -0400
+++ http_protocol.c     2005-10-20 11:55:57.000000000 -0400
@@ -3033,7 +3033,8 @@
 
 static int ap_set_byterange(request_rec *r)
 {
-    const char *range;
+    const char *tmphdr;
+    char *range;
     const char *if_range;
     const char *match;
     const char *ct;
@@ -3053,8 +3054,14 @@
      * Navigator 2-3 and MSIE 3.
      */
 
-    if (!(range = apr_table_get(r->headers_in, "Range"))) {
-        range = apr_table_get(r->headers_in, "Request-Range");
+    if (!(tmphdr = apr_table_get(r->headers_in, "Range"))) {
+        tmphdr = apr_table_get(r->headers_in, "Request-Range");
+    }
+
+    range = NULL;
+    if (tmphdr) {
+        range = apr_palloc(r->pool, strlen(tmphdr));
+        apr_collapse_spaces(range, tmphdr);
     }
 
     if (!range || strncasecmp(range, "bytes=", 6) || r->status != HTTP_OK) {

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message