comparison src/http/modules/ngx_http_mp4_module.c @ 642:d3cf6c6b0043 NGINX_1_1_5

nginx 1.1.5 *) Feature: the "uwsgi_buffering" and "scgi_buffering" directives. Thanks to Peter Smit. *) Bugfix: non-cacheable responses might be cached if "proxy_cache_bypass" directive was used. Thanks to John Ferlito. *) Bugfix: in HTTP/1.1 support in the ngx_http_proxy_module. *) Bugfix: cached responses with an empty body were returned incorrectly; the bug had appeared in 0.8.31. *) Bugfix: 201 responses of the ngx_http_dav_module were incorrect; the bug had appeared in 0.8.32. *) Bugfix: in the "return" directive. *) Bugfix: the "ssl_session_cache builtin" directive caused segmentation fault; the bug had appeared in 1.1.1.
author Igor Sysoev <http://sysoev.ru>
date Wed, 05 Oct 2011 00:00:00 +0400
parents eb208e0cf44d
children 6f21ae02fb01
comparison
equal deleted inserted replaced
641:6c19b251b926 642:d3cf6c6b0043
185 + ( ((u_char *) (p))[5] << 16) \ 185 + ( ((u_char *) (p))[5] << 16) \
186 + ( ((u_char *) (p))[6] << 8) \ 186 + ( ((u_char *) (p))[6] << 8) \
187 + ( ((u_char *) (p))[7]) ) 187 + ( ((u_char *) (p))[7]) )
188 188
189 #define ngx_mp4_set_64value(p, n) \ 189 #define ngx_mp4_set_64value(p, n) \
190 ((u_char *) (p))[0] = (u_char) ((n) >> 56); \ 190 ((u_char *) (p))[0] = (u_char) ((uint64_t) (n) >> 56); \
191 ((u_char *) (p))[1] = (u_char) ((n) >> 48); \ 191 ((u_char *) (p))[1] = (u_char) ((uint64_t) (n) >> 48); \
192 ((u_char *) (p))[2] = (u_char) ((n) >> 40); \ 192 ((u_char *) (p))[2] = (u_char) ((uint64_t) (n) >> 40); \
193 ((u_char *) (p))[3] = (u_char) ((n) >> 32); \ 193 ((u_char *) (p))[3] = (u_char) ((uint64_t) (n) >> 32); \
194 ((u_char *) (p))[4] = (u_char) ((n) >> 24); \ 194 ((u_char *) (p))[4] = (u_char) ( (n) >> 24); \
195 ((u_char *) (p))[5] = (u_char) ((n) >> 16); \ 195 ((u_char *) (p))[5] = (u_char) ( (n) >> 16); \
196 ((u_char *) (p))[6] = (u_char) ((n) >> 8); \ 196 ((u_char *) (p))[6] = (u_char) ( (n) >> 8); \
197 ((u_char *) (p))[7] = (u_char) (n) 197 ((u_char *) (p))[7] = (u_char) (n)
198 198
199 #define ngx_mp4_last_trak(mp4) \ 199 #define ngx_mp4_last_trak(mp4) \
200 &((ngx_http_mp4_trak_t *) mp4->trak.elts)[mp4->trak.nelts - 1] 200 &((ngx_http_mp4_trak_t *) mp4->trak.elts)[mp4->trak.nelts - 1]
201 201
202 202
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;
1064 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, 1071 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,
1065 "mdat new offset @%O:%O", start_offset, atom_data_size); 1072 "mdat new offset @%O:%O", start_offset, atom_data_size);
1066 1073
1067 atom_header = mp4->mdat_atom_header; 1074 atom_header = mp4->mdat_atom_header;
1068 1075
1069 if (atom_data_size > 0xffffffff) { 1076 if ((uint64_t) atom_data_size > 0xffffffff) {
1070 atom_size = 1; 1077 atom_size = 1;
1071 atom_header_size = sizeof(ngx_mp4_atom_header64_t); 1078 atom_header_size = sizeof(ngx_mp4_atom_header64_t);
1072 ngx_mp4_set_64value(atom_header + sizeof(ngx_mp4_atom_header_t), 1079 ngx_mp4_set_64value(atom_header + sizeof(ngx_mp4_atom_header_t),
1073 sizeof(ngx_mp4_atom_header64_t) + atom_data_size); 1080 sizeof(ngx_mp4_atom_header64_t) + atom_data_size);
1074 } else { 1081 } else {