Skip to content

Commit 60ad836

Browse files
committed
Correctly parse Range headers with multiple ranges
Correctly parse Range headers with multiple ranges that have whitespaces around the comma separating the ranges from each other by trimming the whitespace. PR: 69831 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1928901 13f79535-47bb-0310-9956-ffa450edef68
1 parent 1afebbe commit 60ad836

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

changes-entries/pr69831.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*) http: Correctly parse Range headers with multiple ranges that have
2+
whitespaces around the comma separating the ranges from each other.
3+
PR 69831 [Ruediger Pluem]

modules/http/byterange_filter.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,17 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
136136
}
137137
*indexes = apr_array_make(r->pool, ranges, sizeof(indexes_t));
138138
while ((cur = ap_getword(r->pool, &range, ','))) {
139-
char *dash;
139+
char *dash, *end_cur;
140140
apr_off_t number, start, end;
141141

142+
/* Remove leading and trailing white spaces */
143+
while (apr_isspace(*cur))
144+
++cur;
145+
/* blast trailing whitespace */
146+
end_cur = &cur[strlen(cur)];
147+
while (--end_cur >= cur && apr_isspace(*end_cur))
148+
*end_cur = '\0';
149+
142150
if (!*cur)
143151
break;
144152

0 commit comments

Comments
 (0)