diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-09-30 13:18:28 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-09-30 13:18:28 +0400 |
commit | f3ae6a6102256421bc0739ba4816fdd17ceda106 (patch) | |
tree | 499b551cb40ad69799c7396a979b0127b4921933 /src/http/modules | |
parent | a40e7eed307d3344b45be3ca9f9f6143f1df3a96 (diff) |
Using strtod() instead of atofp() to support a lot of digits after dot in
"start" parameter value.
Diffstat (limited to 'src/http/modules')
-rw-r--r-- | src/http/modules/ngx_http_mp4_module.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c index 1bc13a62e..1140d9174 100644 --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c @@ -499,9 +499,16 @@ ngx_http_mp4_handler(ngx_http_request_t *r) if (ngx_http_arg(r, (u_char *) "start", 5, &value) == NGX_OK) { - start = ngx_atofp(value.data, value.len, 3); + /* + * A Flash player may send start value with a lot of digits + * after dot so strtod() is used instead of atofp(). NaNs and + * infinities become negative numbers after (int) conversion. + */ - if (start != NGX_ERROR) { + ngx_set_errno(0); + start = (int) (strtod((char *) value.data, NULL) * 1000); + + if (ngx_errno == 0 && start >= 0) { r->allow_ranges = 0; mp4 = ngx_pcalloc(r->pool, sizeof(ngx_http_mp4_file_t)); |