summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_spdy.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-09-11The HTTP/2 implementation (RFC 7240, 7241).Valentin Bartenev1-3701/+0
The SPDY support is removed, as it's incompatible with the new module.
2015-06-16Core: renamed ngx_proxy_protocol_parse to ngx_proxy_protocol_read.Roman Arutyunyan1-1/+1
The new name is consistent with the ngx_proxy_protocol_write function.
2015-03-23SPDY: always push pending data.Valentin Bartenev1-51/+40
This helps to avoid suboptimal behavior when a client waits for a control frame or more data to increase window size, but the frames have been delayed in the socket buffer. The delays can be caused by bad interaction between Nagle's algorithm on nginx side and delayed ACK on the client side or by TCP_CORK/TCP_NOPUSH if SPDY was working without SSL and sendfile() was used. The pushing code is now very similar to ngx_http_set_keepalive().
2015-03-23SPDY: fixed error handling in ngx_http_spdy_send_output_queue().Valentin Bartenev1-8/+12
2015-03-15SPDY: fixed format specifier in logging.Xiaochen Wang1-1/+1
2014-11-21SPDY: push pending data while closing a stream as with keepalive.Valentin Bartenev1-1/+51
This helps to avoid delays in sending the last chunk of data because of bad interaction between Nagle's algorithm on nginx side and delayed ACK on the client side. Delays could also be caused by TCP_CORK/TCP_NOPUSH if SPDY was working without SSL and sendfile() was used.
2014-11-07SPDY: fixed check for too long header name or value.Valentin Bartenev1-3/+3
For further progress a new buffer must be at least two bytes larger than the remaining unparsed data. One more byte is needed for null-termination and another one for further progress. Otherwise inflate() fails with Z_BUF_ERROR.
2014-11-07SPDY: improved debug logging of inflate() calls.Valentin Bartenev1-4/+16
2014-11-07SPDY: fixed "too long header line" logging.Maxim Dounin1-2/+1
This fixes possible one byte buffer overrun and makes sure ellipsis are always added, see 21043ce2a005.
2014-09-01Events: processing of posted events changed from LIFO to FIFO.Valentin Bartenev1-2/+2
In theory, this can provide a bit better distribution of latencies. Also it simplifies the code, since ngx_queue_t is now used instead of custom implementation.
2014-07-08SPDY: fix support for headers with multiple values.Piotr Sikora1-0/+2
Split SPDY header with multiple, NULL-separated values: cookie: foo\0bar into two separate HTTP headers with the same name: cookie: foo cookie: bar Even though the logic for this behavior already existed in the source code, it doesn't look that it ever worked and SPDY streams with such headers were simply rejected. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-04-30SPDY: added protection from overrun of the receive buffer.Valentin Bartenev1-0/+8
2014-04-30SPDY: added a debug point to the state buffer overflow protection.Valentin Bartenev1-0/+1
2014-04-30SPDY: refactored ngx_http_spdy_state_headers().Valentin Bartenev1-9/+4
This change is similar to d2ac5cf4056d. Special flag of completeness looks surplus when there is also a counter of frame bytes left.
2014-04-30SPDY: improved logging.Valentin Bartenev1-60/+150
2014-05-15SPDY: set log action for PROXY protocol only while parsing it.Valentin Bartenev1-8/+9
Handling of PROXY protocol for SPDY connection is currently implemented as a SPDY state. And while nginx waiting for PROXY protocol data it continues to process SPDY connection: initializes zlib context, sends control frames.
2014-04-30SPDY: ngx_http_spdy_state_headers() error handling cleanup.Valentin Bartenev1-39/+61
- Specification-friendly handling of invalid header block or special headers. Such errors are not fatal for session and shouldn't lead to connection close; - Avoid mix of NGX_HTTP_PARSE_INVALID_REQUEST/NGX_HTTP_PARSE_INVALID_HEADER.
2014-04-30SPDY: improved error handling of header block decompression.Valentin Bartenev1-17/+43
Now cases when decompression failed due to internal error and when a client sent corrupted data are distinguished.
2014-04-30SPDY: removed ngx_http_spdy_state_headers_error().Valentin Bartenev1-20/+6
The function just calls ngx_http_spdy_state_headers_skip() most of the time. There was also an attempt of optimization to stop parsing if the client already closed connection, but it looks strange and unfinished anyway.
2014-05-15SPDY: prevented creation of RST_STREAM in protocol error state.Valentin Bartenev1-0/+1
Previously, the frame wasn't sent anyway (and had a wrong status code).
2014-04-30SPDY: improved ngx_http_spdy_state_protocol_error().Valentin Bartenev1-9/+15
Now ngx_http_spdy_state_protocol_error() is able to close stream, so there is no need in a separate call for this. Also fixed zero status code in logs for some cases.
2014-04-30SPDY: fixed one case of improper memory allocation error handling.Valentin Bartenev1-1/+2
Now ngx_http_spdy_construct_request_line() doesn't try to finalize request in case of failed memory allocation.
2014-04-21SPDY: avoid sending RST_STREAM on WINDOW_UPDATE with unknown SID.Valentin Bartenev1-10/+2
There's a race condition between closing a stream by one endpoint and sending a WINDOW_UPDATE frame by another. So it would be better to just skip such frames for unknown streams, like is already done for the DATA frames.
2014-04-21SPDY: Stream-ID restrictions according to specification.Valentin Bartenev1-2/+21
2014-04-16SPDY: fixed typo in log message.Valentin Bartenev1-1/+1
2014-04-09SPDY: moved a variable initialization near to its check.Valentin Bartenev1-2/+2
This should prevent attempts of using pointer before it was checked, since all modern compilers are able to spot access to uninitialized variable. No functional changes.
2014-04-08SPDY: fixed arguments supplied for an error message.Valentin Bartenev1-1/+1
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-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-19SPDY: improved ngx_http_spdy_state_save() again.Maxim Dounin1-2/+2
2014-03-19SPDY: improved ngx_http_spdy_state_save() check.Maxim Dounin1-3/+5
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 Arutyunyan1-0/+23
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-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-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-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 Bartenev1-77/+656
2014-01-20SPDY: use ngx_queue_t to queue streams for post processing.Valentin Bartenev1-19/+13
It simplifies the code and allows easy reuse the same queue pointer to store streams in various queues with different requirements. Future implementation of SPDY/3.1 will take advantage of this quality.
2014-01-22SPDY: store the length of frame instead of its whole size.Valentin Bartenev1-11/+9
The "length" value better corresponds with the specification and reduces confusion about whether frame's header is included in "size" or not. Also this change simplifies some parts of code, since in more cases the length of frame is more useful than its actual size, especially considering that the size of frame header is constant.
2014-01-22SPDY: use frame->next pointer to chain free frames.Valentin Bartenev1-5/+5
There is no need in separate "free" pointer and like it is for ngx_chain_t the "next" pointer can be used. But after this change successfully handled frame should not be accessed, so the frame handling cycle was improved to store pointer to the next frame before processing. Also worth noting that initializing "free" pointer to NULL in the original code was surplus.
2014-01-22SPDY: proper handling of all RST_STREAM statuses.Valentin Bartenev1-39/+28
Previously, only stream CANCEL and INTERNAL_ERROR were handled right.
2014-01-22SPDY: removed state to check first SETTINGS frame.Valentin Bartenev1-58/+15
That code was based on misunderstanding of spdy specification about configuration applicability in the SETTINGS frames. The original interpretation was that configuration is assigned for the whole SPDY connection, while it is only for the endpoint. Moreover, the strange thing is that specification forbids multiple entries in the SETTINGS frame with the same ID even if flags are different. As a result, Chrome sends two SETTINGS frames: one with its own configuration, and another one with configuration stored for a server (when the FLAG_SETTINGS_PERSIST_VALUE flags were used by the server). To simplify implementation we refuse to use the persistent settings feature and thereby avoid all the complexity related with its proper support.
2014-01-22SPDY: better name for frame entries counter.Valentin Bartenev1-11/+12
The "headers" is not a good term, since it is used not only to count name/value pairs in the HEADERS block but to count SETTINGS entries too. Moreover, one name/value pair in HEADERS can contain multiple http headers with the same name. No functional changes.
2014-01-22SPDY: fixed possible segfault.Valentin Bartenev1-0/+4
While processing a DATA frame, the link to related stream is stored in spdy connection object as part of connection state. But this stream can be closed between receiving parts of the frame.