Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_range_filter_module.c @ 4056:e9213133993a
Now unsatisfiable ranges are processed according to RFC 2616.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 30 Aug 2011 13:01:55 +0000 |
parents | 9cce506be97d |
children | 3205a6d6c6ec |
comparison
equal
deleted
inserted
replaced
4055:9cce506be97d | 4056:e9213133993a |
---|---|
262 if (*p++ != '-') { | 262 if (*p++ != '-') { |
263 return NGX_HTTP_RANGE_NOT_SATISFIABLE; | 263 return NGX_HTTP_RANGE_NOT_SATISFIABLE; |
264 } | 264 } |
265 | 265 |
266 if (start >= r->headers_out.content_length_n) { | 266 if (start >= r->headers_out.content_length_n) { |
267 return NGX_HTTP_RANGE_NOT_SATISFIABLE; | 267 goto skip; |
268 } | 268 } |
269 | 269 |
270 while (*p == ' ') { p++; } | 270 while (*p == ' ') { p++; } |
271 | 271 |
272 if (*p == ',' || *p == '\0') { | 272 if (*p == ',' || *p == '\0') { |
297 start = r->headers_out.content_length_n - end; | 297 start = r->headers_out.content_length_n - end; |
298 end = r->headers_out.content_length_n - 1; | 298 end = r->headers_out.content_length_n - 1; |
299 } | 299 } |
300 | 300 |
301 if (start > end) { | 301 if (start > end) { |
302 return NGX_HTTP_RANGE_NOT_SATISFIABLE; | 302 goto skip; |
303 } | 303 } |
304 | 304 |
305 if (end >= r->headers_out.content_length_n) { | 305 if (end >= r->headers_out.content_length_n) { |
306 /* | |
307 * Download Accelerator sends the last byte position | |
308 * that equals to the file length | |
309 */ | |
310 end = r->headers_out.content_length_n; | 306 end = r->headers_out.content_length_n; |
311 | 307 |
312 } else { | 308 } else { |
313 end++; | 309 end++; |
314 } | 310 } |
323 range->start = start; | 319 range->start = start; |
324 range->end = end; | 320 range->end = end; |
325 | 321 |
326 size += end - start; | 322 size += end - start; |
327 | 323 |
324 skip: | |
325 | |
328 if (*p++ != ',') { | 326 if (*p++ != ',') { |
329 break; | 327 break; |
330 } | 328 } |
329 } | |
330 | |
331 if (ctx->ranges.nelts == 0) { | |
332 return NGX_HTTP_RANGE_NOT_SATISFIABLE; | |
331 } | 333 } |
332 | 334 |
333 if (size > r->headers_out.content_length_n) { | 335 if (size > r->headers_out.content_length_n) { |
334 return NGX_DECLINED; | 336 return NGX_DECLINED; |
335 } | 337 } |