comparison src/http/modules/ngx_http_mp4_module.c @ 4156:67a4654ba7d9

Using strtod() instead of atofp() to support a lot of digits after dot in "start" parameter value.
author Igor Sysoev <igor@sysoev.ru>
date Fri, 30 Sep 2011 09:18:28 +0000
parents d9636bf3f159
children a12c558503f0
comparison
equal deleted inserted replaced
4155:d9636bf3f159 4156:67a4654ba7d9
497 497
498 if (r->args.len) { 498 if (r->args.len) {
499 499
500 if (ngx_http_arg(r, (u_char *) "start", 5, &value) == NGX_OK) { 500 if (ngx_http_arg(r, (u_char *) "start", 5, &value) == NGX_OK) {
501 501
502 start = ngx_atofp(value.data, value.len, 3); 502 /*
503 503 * A Flash player may send start value with a lot of digits
504 if (start != NGX_ERROR) { 504 * after dot so strtod() is used instead of atofp(). NaNs and
505 * infinities become negative numbers after (int) conversion.
506 */
507
508 ngx_set_errno(0);
509 start = (int) (strtod((char *) value.data, NULL) * 1000);
510
511 if (ngx_errno == 0 && start >= 0) {
505 r->allow_ranges = 0; 512 r->allow_ranges = 0;
506 513
507 mp4 = ngx_pcalloc(r->pool, sizeof(ngx_http_mp4_file_t)); 514 mp4 = ngx_pcalloc(r->pool, sizeof(ngx_http_mp4_file_t));
508 if (mp4 == NULL) { 515 if (mp4 == NULL) {
509 return NGX_HTTP_INTERNAL_SERVER_ERROR; 516 return NGX_HTTP_INTERNAL_SERVER_ERROR;