summaryrefslogtreecommitdiffhomepage
path: root/src/http (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-04-07SPDY: avoid creating flush frames.Valentin Bartenev1-33/+42
Previously, an empty frame object was created for an output chain that contains only sync or flush empty buffers. But since 39d7eef2e332 every DATA frame has the flush flag set on its last buffer, so there's no need any more in additional flush buffers in the output queue and they can be skipped. Note that such flush frames caused an incorrect $body_bytes_sent value.
2014-04-07SPDY: consistently handle control frames with unknown type.Valentin Bartenev1-5/+10
The SPDY draft 2 specification requires that if an endpoint receives a control frame for a type it does not recognize, it must ignore the frame. But the 3 and 3.1 drafts don't seem to declare any behavior for such case. Then sticking with the previous draft in this matter looks to be right. But previously, only 8 least significant bits of the type field were parsed while the rest of 16 bits of the field were checked against zero. Though there are no known frame types bigger than 255, this resulted in inconsistency in handling of such frames: they were not recognized as valid frames at all, and the connection was closed.
2014-04-07SPDY: refactored ngx_http_spdy_state_read_data().Valentin Bartenev1-7/+2
There's no more need in a separate indicator of frame completeness after d74889fbf06d.
2014-04-07SPDY: better detect premature closing of stream.Valentin Bartenev1-0/+10
Following a24f88eff684, now the case when the FIN flag is set in SYN_STREAM is also covered.
2014-04-01Mp4: allow end values bigger than track duration.Roman Arutyunyan1-4/+14
If start time is within the track but end time is out of it, error "end time is out mp4 stts samples" is generated. However it's better to ignore the error and output the track until its end.
2014-03-31Adjusted default value of types_hash_bucket_size (ticket #352).Maxim Dounin1-2/+1
The ngx_cacheline_size may be too low on some platforms, resulting in unexpected hash build problems (as no collisions are tolerated due to low bucket_size, and max_size isn't big enough to build a hash without collisions). These problems aren't fatal anymore but nevertheless need to be addressed.
2014-03-31Core: slab log_nomem flag.Maxim Dounin1-0/+4
The flag allows to suppress "ngx_slab_alloc() failed: no memory" messages from a slab allocator, e.g., if an LRU expiration is used by a consumer and allocation failures aren't fatal. The flag is now used in the SSL session cache code, and in the limit_req module.
2014-03-31Mp4: improved logging after adding "end" support.Roman Arutyunyan1-27/+71
Despite introducing start and end crop operations existing log messages still mostly refer only to start. Logging is improved to match both cases. New debug logging is added to track entry count in atoms after cropping. Two format type mismatches are fixed as well.
2014-03-31Mp4: fixed seeking to a track end.Roman Arutyunyan1-2/+2
When "start" value is equal to a track duration the request fails with "time is out mp4 stts" like it did before track duration check was added. Now such tracks are considered short and skipped.
2014-03-28SPDY: detect premature closing of stream.Valentin Bartenev1-4/+13
The SPDY/3.1 specification requires that the server must respond with a 400 "Bad request" error if the sum of the data frame payload lengths does not equal the size of the Content-Length header. This also fixes "zero size buf in output" alert, that might be triggered if client sends a greater than zero Content-Length header and closes stream using the FIN flag with an empty request body.
2014-03-28SPDY: fixed the DATA frame length handling in case of some errors.Valentin Bartenev1-1/+2
There are a few cases in ngx_http_spdy_state_read_data() related to error handling when ngx_http_spdy_state_skip() might be called with an inconsistent state between *pos and sc->length, that leads to violation of frame layout parsing and resuted in corruption of spdy connection. Based on a patch by Xiaochen Wang.
2014-03-26SPDY: better detect if headers block has wrong entries count.Valentin Bartenev1-4/+4
Previously, only one case was checked: if there's more data to parse in a r->header_in buffer, but the buffer can be filled to the end by the last parsed entry, so we also need to check that there's no more data to inflate.
2014-03-26SPDY: detect premature end of frame while start parsing headers.Valentin Bartenev1-0/+9
2014-03-24Apply underscores_in_headers also to the first character.Piotr Sikora1-0/+13
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-03-25Increased default value of variables_hash_max_size.Andrei Belov1-1/+1
2014-03-24Mp4: skipped empty stss atom table in output.Sergey Kandaurov1-8/+13
The atom may have no data entries after cropping. This fixes "zero size buf in output" alerts.
2014-03-21Range filter: single_range flag in request.Maxim Dounin4-2/+11
If set, it means that response body is going to be in more than one buffer, hence only range requests with a single range should be honored. The flag is now used by mp4 and cacheable upstream responses, thus allowing range requests of mp4 files with start/end, as well as range processing on a first request to a not-yet-cached files with proxy_cache. Notably this makes it possible to play mp4 files (with proxy_cache, or with mp4 module) on iOS devices, as byte-range support is required by Apple.
2014-03-20Mp4: added "end" argument support.Roman Arutyunyan1-89/+377
2014-03-20Mp4: moved atom cropping code out of update functions.Roman Arutyunyan1-85/+176
It can now be reused for implementing mp4 end.
2014-03-19SPDY: improved ngx_http_spdy_state_save() again.Maxim Dounin1-2/+2
2014-03-19Macros used for initialization in ngx_http_core_init_main_conf().Maxim Dounin1-14/+5
2014-03-19SPDY: improved ngx_http_spdy_state_save() check.Maxim Dounin1-3/+5
2014-03-19SPDY: macro used for recv_buffer_size initialization.Maxim Dounin1-3/+1
2014-03-18SPDY: always check size of data to be saved into state buffer.Maxim Dounin1-1/+1
2014-03-17Added server-side support for PROXY protocol v1 (ticket #355).Roman Arutyunyan8-4/+131
Client address specified in the PROXY protocol header is now saved in the $proxy_protocol_addr variable and can be used in the realip module. This is currently not implemented for mail.
2014-03-17FastCGI: f->split_parts reset on request start.Maxim Dounin1-0/+11
Additionally, make sure to check for errors from ngx_http_parse_header_line() call after joining saved parts. There shouldn't be any errors, though check may help to catch bugs like missing f->split_parts reset. Reported by Lucas Molas.
2014-03-03SPDY: fixed potential integer overflow while parsing headers.Valentin Bartenev1-34/+24
Previously r->header_size was used to store length for a part of value that represents an individual already parsed HTTP header, while r->header_end pointed to the end of the whole value. Instead of storing length of a following name or value as pointer to a potential end address (r->header_name_end and r->header_end) that might be overflowed, now r->lowercase_index counter is used to store remaining length of a following unparsed field. It also fixes incorrect $body_bytes_sent value if a request is closed while parsing of the request header. Since r->header_size is intended for counting header size, thus abusing it for header parsing purpose was certainly a bad idea.
2014-03-03SPDY: constant number of preallocated structures for headers.Valentin Bartenev1-1/+1
2014-03-03Request body: avoid potential overflow.Maxim Dounin1-4/+4
2014-03-03Gzip static: fixed NGX_CONF_FLAG misuse.Valentin Bartenev1-1/+1
2014-02-27Disabled redirects to named locations if URI is not set.Maxim Dounin1-0/+8
If something like "error_page 400 @name" is used in a configuration, a request could be passed to a named location without URI set, and this in turn might result in segmentation faults or other bad effects as most of the code assumes URI is set. With this change nginx will catch such configuration problems in ngx_http_named_location() and will stop request processing if URI is not set, returning 500.
2014-02-20Upstream: fixed error message wording.Konstantin Pavlov1-1/+1
2014-02-19Access: supplemented the obfuscated code with a comment.Ruslan Ermilov1-1/+5
2014-02-18Upstream: ngx_post_event() instead of upgraded call (ticket #503).Maxim Dounin1-0/+2
If a request is finalized in the first call to the ngx_http_upstream_process_upgraded() function, e.g., because upstream server closed the connection for some reason, in the second call the u->peer.connection pointer will be null, resulting in segmentation fault. Fix is to avoid second direct call, and post event instead. This ensures that ngx_http_upstream_process_upgraded() won't be called again if a request is finalized.
2014-02-14Mp4: remove useless leading stsc entry in result mp4.Roman Arutyunyan1-1/+1
The fix removes useless stsc entry in result mp4. If start_sample == n then current stsc entry should be skipped and the result stsc should start with the next entry. The reason for that is start_sample starts from 0, not 1.
2014-02-12SPDY: fixed reversed priority order in window waiting queue.Valentin Bartenev2-1/+7
2014-02-11Upstream: fix $upstream_status variable.Piotr Sikora4-6/+6
Previously, upstream's status code was overwritten with cached response's status code when STALE or REVALIDATED response was sent to the client. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-02-11SPDY: fixed parsing of http version.Xiaochen Wang1-0/+4
There is an error while parsing multi-digit minor version numbers (e.g. "HTTP/1.10").
2014-02-11SSL: the $ssl_session_reused variable.Maxim Dounin1-0/+3
2014-02-04Range filter: fixed duplicate charset.Ruslan Ermilov1-4/+8
If a proxied response had charset in Content-Type, the charset was duplicated in a response to client request with byte ranges.
2014-02-03Use ngx_socket_errno where appropriate.Piotr Sikora2-3/+3
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-02-04SPDY: fixed parsing of the priority field.Shigeki Ohtsu1-1/+1
The size of the priority field is increased by one bit in spdy/3, and now it's a 3-bit field followed by 5 bits of unused space. But a shift of these bits hasn't been adjusted in 39d7eef2e332 accordingly.
2014-01-31SPDY: protocol implementation switched to spdy/3.1.Valentin Bartenev4-135/+815
2014-01-31Fixed false compiler warning.Vladimir Homutov1-0/+4
Newer gcc versions (4.7+) report possible use of uninitialized variable if nginx is being compiled with -O3.
2014-01-30Fixed a compile warning introduced by 01e2a5bcdd8f.Ruslan Ermilov1-3/+4
On systems with OpenSSL that has NPN support but lacks ALPN support, some compilers emitted a warning about possibly uninitialized "data" variable.
2014-01-30Proxy: fixed upstream search by proxy_pass with variables.Ruslan Ermilov1-1/+1
If "proxy_pass" is specified with variables, the resulting hostname is looked up in the list of upstreams defined in configuration. The search was case-sensitive, as opposed to the case of "proxy_pass" specified without variables.
2014-01-28SSL: support ALPN (IETF's successor to NPN).Piotr Sikora4-9/+89
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-01-29Mp4: fix seeks to standalone last chunk.Roman Arutyunyan1-1/+1
If seek position is within the last track chunk and that chunk is standalone (stsc entry describes only this chunk) such seek generates stsc seek error. The problem is that chunk numbers start with 1, not with 0.
2014-01-29Mp4: skip tracks shorter than seek position (ticket #414).Roman Arutyunyan1-6/+31
Mp4 module does not check movie and track durations when reading file. Instead it generates errors when track metadata is shorter than seek position. Now such tracks are skipped and movie duration check is performed at file read stage.
2014-01-29Mp4: fix seeks after the last key frame.Roman Arutyunyan1-5/+2
Mp4 module does not allow seeks after the last key frame. Since stss atom only contains key frames it's usually shorter than other track atoms. That leads to stss seek error when seek position is close to the end of file. The fix outputs empty stss frame instead of generating error.