summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_request.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2020-09-23QUIC: unbreak client certificate verification after 0d2b2664b41c.Sergey Kandaurov1-0/+2
Initially, client certificate verification didn't work due to the missing hc->ssl on a QUIC stream, which is started to be set in 7738:7f0981be07c4. Then it was lost in 7999:0d2b2664b41c introducing "quic" listen parameter. This change re-adds hc->ssl back for all QUIC connections, similar to SSL.
2020-09-24SSL: abort handshake on SSL_set_SSL_CTX() errors.Sergey Kandaurov1-1/+4
In rare cases, such as memory allocation failure, SSL_set_SSL_CTX() returns NULL, which could mean that a different SSL configuration has not been set. Note that this new behaviour seemingly originated in OpenSSL-1.1.0 release.
2020-08-25HTTP/3: drop the unwanted remainder of the request.Roman Arutyunyan1-0/+7
As per HTTP/3 draft 29, section 4.1: When the server does not need to receive the remainder of the request, it MAY abort reading the request stream, send a complete response, and cleanly close the sending part of the stream.
2020-08-10SSL: disabled sending shutdown after ngx_http_test_reading().Maxim Dounin1-0/+6
Sending shutdown when ngx_http_test_reading() detects the connection is closed can result in "SSL_shutdown() failed (SSL: ... bad write retry)" critical log messages if there are blocked writes. Fix is to avoid sending shutdown via the c->ssl->no_send_shutdown flag, similarly to how it is done in ngx_http_keepalive_handler() for kqueue when pending EOF is detected. Reported by Jan Prachaƙ (http://mailman.nginx.org/pipermail/nginx-devel/2018-December/011702.html).
2020-08-06Added size check to ngx_http_alloc_large_header_buffer().Maxim Dounin1-0/+6
This ensures that copying won't write more than the buffer size even if the buffer comes from hc->free and it is smaller than the large client header buffer size in the virtual host configuration. This might happen if size of large client header buffers is different in name-based virtual hosts, similarly to the problem with number of buffers fixed in 6926:e662cbf1b932.
2020-08-11QUIC: fixed ngx_http_test_reading() for QUIC streams.Roman Arutyunyan1-0/+13
Previously this function generated an error trying to figure out if client shut down the write end of the connection. The reason for this error was that a QUIC stream has no socket descriptor. However checking for eof is not the right thing to do for an HTTP/3 QUIC stream since HTTP/3 clients are expected to shut down the write end of the stream after sending the request. Now the function handles QUIC streams separately. It checks if c->read->error is set. The error flags for c->read and c->write are now set for all streams when closing the QUIC connection instead of setting the pending_eof flag.
2020-07-23HTTP/3: server pushes.Roman Arutyunyan1-2/+1
New directives are added: - http3_max_concurrent_pushes - http3_push - http3_push_preload
2020-07-14HTTP/3: support $server_protocol variable.Roman Arutyunyan1-4/+0
Now it holds "HTTP/3.0". Previously it was empty.
2020-07-22HTTP/3: do not call shutdown() for QUIC streams.Roman Arutyunyan1-5/+7
Previously, this triggered an alert "shutdown() failed" in error log.
2020-07-21QUIC: eliminated connection handler argument in ngx_quic_run().Roman Arutyunyan1-1/+1
Now c->listening->handler() is called instead.
2020-07-21QUIC: added "quic" listen parameter.Roman Arutyunyan1-107/+42
The parameter allows processing HTTP/0.9-2 over QUIC. Also, introduced ngx_http_quic_module and moved QUIC settings there
2020-06-30HTTP/3: set r->headers_in.chunked flag after parsing headers.Roman Arutyunyan1-1/+6
Previously it was set when creating the request object. The side-effect was trying to discard the request body in case of header parse error.
2020-07-02HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.Roman Arutyunyan1-5/+7
Previously errors led only to closing streams. To simplify closing QUIC connection from a QUIC stream context, new macro ngx_http_v3_finalize_connection() is introduced. It calls ngx_quic_finalize_connection() for the parent connection.
2020-07-02HTTP/3: refactored dynamic table implementation.Roman Arutyunyan1-2/+19
Previously dynamic table was not functional because of zero limit on its size set by default. Now the following changes enable it: - new directives to set SETTINGS_QPACK_MAX_TABLE_CAPACITY and SETTINGS_QPACK_BLOCKED_STREAMS - send settings with SETTINGS_QPACK_MAX_TABLE_CAPACITY and SETTINGS_QPACK_BLOCKED_STREAMS to the client - send Insert Count Increment to the client - send Header Acknowledgement to the client - evict old dynamic table entries on overflow - decode Required Insert Count from client - block stream if Required Insert Count is not reached
2020-06-02Decoupled validation of Host and :authority for HTTP/2 and HTTP/3.Roman Arutyunyan1-3/+11
Previously an error was triggered for HTTP/2 when host with port was passed by client.
2020-05-29Require ":authority" or "Host" in HTTP/3 and HTTP/2 requests.Roman Arutyunyan1-0/+25
Also, if both are present, require that they have the same value. These requirements are specified in HTTP/3 draft 28. Current implementation of HTTP/2 treats ":authority" and "Host" interchangeably. New checks only make sure at least one of these values is present in the request. A similar check existed earlier and was limited only to HTTP/1.1 in 38c0898b6df7.
2020-05-22SSL: client certificate validation with OCSP (ticket #1534).Roman Arutyunyan1-0/+12
OCSP validation for client certificates is enabled by the "ssl_ocsp" directive. OCSP responder can be optionally specified by "ssl_ocsp_responder". When session is reused, peer chain is not available for validation. If the verified chain contains certificates from the peer chain not available at the server, validation will fail.
2020-05-19Fixed client buffer reallocation for HTTP/3.Roman Arutyunyan1-29/+19
Preserving pointers within the client buffer is not needed for HTTP/3 because all data is either allocated from pool or static. Unlike with HTTP/1, data typically cannot be referenced directly within the client buffer. Trying to preserve NULLs or external pointers lead to broken pointers. Also, reverted changes in ngx_http_alloc_large_header_buffer() not relevant for HTTP/3 to minimize diff to mainstream.
2020-05-19Fixed $request_length for HTTP/3.Roman Arutyunyan1-13/+14
New field r->parse_start is introduced to substitute r->request_start and r->header_name_start for request length accounting. These fields only work for this purpose in HTTP/1 because HTTP/1 request line and header line start with these values. Also, error logging is now fixed to output the right part of the request.
2020-05-19HTTP/3: restricted symbols in header names.Roman Arutyunyan1-4/+6
As per HTTP/3 draft 27, a request or response containing uppercase header field names MUST be treated as malformed. Also, existing rules applied when parsing HTTP/1 header names are also applied to HTTP/3 header names: - null character is not allowed - underscore character may or may not be treated as invalid depending on the value of "underscores_in_headers" - all non-alphanumeric characters with the exception of '-' are treated as invalid Also, the r->locase_header field is now filled while parsing an HTTP/3 header. Error logging for invalid headers is fixed as well.
2020-05-19HTTP/3: split header parser in two functions.Roman Arutyunyan1-1/+1
The first one parses pseudo-headers and is analagous to the request line parser in HTTP/1. The second one parses regular headers and is analogous to the header parser in HTTP/1. Additionally, error handling of client passing malformed uri is now fixed.
2020-04-23Assign connection number to every QUIC stream log.Roman Arutyunyan1-1/+0
2020-03-27Parsing HTTP/3 request body.Roman Arutyunyan1-0/+1
2020-03-24Removed ngx_quic_stream_node_t.Roman Arutyunyan1-1/+1
Now ngx_quic_stream_t is directly inserted into the tree.
2020-03-24QUIC streams don't need filter_need_in_memory after 7f0981be07c4.Sergey Kandaurov1-1/+0
Now they inherit c->ssl always enabled from the main connection, which makes r->main_filter_need_in_memory set for them.
2020-03-23Fixed client certificate verification.Sergey Kandaurov1-0/+1
For ngx_http_process_request() part to work, this required to set both r->http_connection->ssl and c->ssl on a QUIC stream. To avoid damaging global SSL object, ngx_ssl_shutdown() is managed to ignore QUIC streams.
2020-03-23Respect QUIC max_idle_timeout.Roman Arutyunyan1-3/+1
2020-03-20Configurable transport parameters.Vladimir Homutov1-1/+4
- integer parameters can be configured using the following directives: quic_max_idle_timeout quic_max_ack_delay quic_max_packet_size quic_initial_max_data quic_initial_max_stream_data_bidi_local quic_initial_max_stream_data_bidi_remote quic_initial_max_stream_data_uni quic_initial_max_streams_bidi quic_initial_max_streams_uni quic_ack_delay_exponent quic_active_migration quic_active_connection_id_limit - only following parameters are actually sent: active_connection_id_limit initial_max_streams_uni initial_max_streams_bidi initial_max_stream_data_bidi_local initial_max_stream_data_bidi_remote initial_max_stream_data_uni (other parameters are to be added into ngx_quic_create_transport_params() function as needed, should be easy now) - draft 24 and draft 27 are now supported (at compile-time using quic_version macro)
2020-03-18HTTP/3 $request_line variable.Roman Arutyunyan1-2/+2
2020-03-18Refactored HTTP/3 parser.Roman Arutyunyan1-4/+10
2020-03-14Temporary fix for header null-termination in HTTP/3.Roman Arutyunyan1-2/+2
2020-03-13HTTP/3.Roman Arutyunyan1-52/+126
2020-03-13Stream "connection" read/write methods.Vladimir Homutov1-0/+31
2020-03-12Fix build.Sergey Kandaurov1-1/+2
2020-03-12HTTP/QUIC interface reworked.Vladimir Homutov1-87/+18
- events handling moved into src/event/ngx_event_quic.c - http invokes once ngx_quic_run() and passes stream callback (diff to original http_request.c is now minimal) - streams are stored in rbtree using ID as a key - when a new stream is registered, appropriate callback is called - ngx_quic_stream_t type represents STREAM and stored in c->qs
2020-02-28Simplified subrequest finalization.Roman Arutyunyan1-23/+11
Now it looks similar to what it was before background subrequests were introduced in 9552758a786e.
2020-03-02Fixed premature background subrequest finalization.Dmitry Volyntsev1-9/+9
When "aio" or "aio threads" is used while processing the response body of an in-memory background subrequest, the subrequest could be finalized with an aio operation still in progress. Upon aio completion either parent request is woken or the old r->write_event_handler is called again. The latter may result in request errors. In either case post_subrequest handler is never called with the full response body, which is typically expected when using in-memory subrequests. Currently in nginx background subrequests are created by the upstream module and the mirror module. The issue does not manifest itself with these subrequests because they are header-only. But it can manifest itself with third-party modules which create in-memory background subrequests.
2020-02-28Moved all QUIC code into ngx_event_quic.cVladimir Homutov1-545/+10
Introduced ngx_quic_input() and ngx_quic_output() as interface between nginx and protocol. They are the only functions that are exported. While there, added copyrights.
2020-02-28Introduced quic_version macro, uint16/uint32 routines ported.Sergey Kandaurov1-6/+6
2020-02-28Cleanup.Sergey Kandaurov1-48/+19
2020-02-26Generic function for HKDF expansion.Vladimir Homutov1-282/+69
2020-02-28QUIC header protection routines, introduced ngx_quic_tls_hp().Sergey Kandaurov1-38/+4
2020-02-28AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().Sergey Kandaurov1-243/+27
2020-02-28Transport parameters stub, to complete handshake.Sergey Kandaurov1-1/+11
2020-02-28Introduced ngx_quic_secret_t.Sergey Kandaurov1-88/+88
2020-02-28QUIC handshake handler, draft 24 bump.Sergey Kandaurov1-3/+353
2020-02-28Fixed indentation.Sergey Kandaurov1-199/+196
2020-02-28PN-aware AEAD nonce, feeding proper CRYPTO length.Sergey Kandaurov1-1/+21
2020-02-28OpenSSL compatibility.Sergey Kandaurov1-52/+199
2020-02-28QUIC add_handshake_data callback, varint routines.Sergey Kandaurov1-39/+1