summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-05-25HTTP/2: invalid connection preface logging (ticket #1981).Maxim Dounin1-6/+4
Previously, invalid connection preface errors were only logged at debug level, providing no visible feedback, in particular, when a plain text HTTP/2 listening socket is erroneously used for HTTP/1.x connections. Now these are explicitly logged at the info level, much like other client-related errors.
2020-05-23Fixed format specifiers.Sergey Kandaurov1-2/+2
2020-05-22OCSP: certificate status cache.Roman Arutyunyan4-5/+401
When enabled, certificate status is stored in cache and is used to validate the certificate in future requests. New directive ssl_ocsp_cache is added to configure the cache.
2020-05-22SSL: client certificate validation with OCSP (ticket #1534).Roman Arutyunyan6-20/+681
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-22OCSP stapling: iterate over all responder addresses.Roman Arutyunyan1-13/+54
Previously only the first responder address was used per each stapling update. Now, in case of a network or parsing error, next address is used. This also fixes the issue with unsupported responder address families (ticket #1330).
2020-05-17OCSP stapling: keep extra chain in the staple object.Roman Arutyunyan1-29/+18
2020-05-14HTTP/3: reallocate strings inserted into the dynamic table.Roman Arutyunyan1-3/+30
They should always be allocated from the main QUIC connection pool.
2020-05-19Fixed client buffer reallocation for HTTP/3.Roman Arutyunyan2-29/+20
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 Arutyunyan4-13/+19
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 Arutyunyan3-8/+54
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 Arutyunyan3-68/+77
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-05-14HTTP/3: move body parser call out of ngx_http_parse_chunked().Roman Arutyunyan2-8/+20
The function ngx_http_parse_chunked() is also called from the proxy module to parse the upstream response. It should always parse HTTP/1 body in this case.
2020-05-19HTTP/3: prevent array access by negative index for unknown streams.Roman Arutyunyan1-1/+3
Currently there are no such streams, but the function ngx_http_v3_get_uni_stream() supports them.
2020-05-21Style.Vladimir Homutov1-4/+4
Rephrased error message and removed trailing space. Long comments were shortened/rephrased.
2020-05-22Added sending of extra CONNECTION_CLOSE frames.Vladimir Homutov1-27/+36
According to quic-transport draft 28 section 10.3.1: When sending CONNECTION_CLOSE, the goal is to ensure that the peer will process the frame. Generally, this means sending the frame in a packet with the highest level of packet protection to avoid the packet being discarded. After the handshake is confirmed (see Section 4.1.2 of [QUIC-TLS]), an endpoint MUST send any CONNECTION_CLOSE frames in a 1-RTT packet. However, prior to confirming the handshake, it is possible that more advanced packet protection keys are not available to the peer, so another CONNECTION_CLOSE frame MAY be sent in a packet that uses a lower packet protection level.
2020-05-22Added more context to CONNECTION CLOSE frames.Vladimir Homutov1-21/+45
Now it is possible to specify frame type that caused an error and a human-readable reason phrase.
2020-05-21Fixed retransmission of frames after closing connection.Vladimir Homutov1-0/+7
Frames in sent queues are discarded, as no acknowledgment is expected if the connection is closing.
2020-05-21Avoided excessive definitions for connection state.Vladimir Homutov1-31/+13
There is no need in a separate type for the QUIC connection state. The only state not found in the SSL library is NGX_QUIC_ST_UNAVAILABLE, which is actually a flag used by the ngx_quic_close_quic() function to prevent cleanup of uninitialized connection.
2020-05-20Assorted fixes.Sergey Kandaurov3-5/+5
Found by Clang Static Analyzer.
2020-05-18Avoid retransmitting of packets with discarded keys.Vladimir Homutov1-8/+15
Sections 4.10.1 and 4.10.2 of quic transport describe discarding of initial and handshake keys. Since the keys are discarded, we no longer need to retransmit packets and corresponding queues should be emptied. This patch removes previously added workaround that did not require acknowledgement for initial packets, resulting in avoiding retransmission, which is wrong because a packet could be lost and we have to retransmit it.
2020-05-18Fixed frame retransmissions.Vladimir Homutov1-1/+3
It was possible that retransmit timer was not set after the first retransmission attempt, due to ngx_quic_retransmit() did not set wait time properly, and the condition in retransmit handler was incorrect.
2020-05-14Removed outdated debug.Vladimir Homutov1-2/+0
2020-05-12Fixed time comparison.Vladimir Homutov1-1/+1
2020-05-14Added tests for connection id lengths in initial packet.Vladimir Homutov3-1/+24
2020-05-14Discard packets without fixed bit or reserved bits set.Vladimir Homutov4-13/+64
Section 17.2 and 17.3 of QUIC transport: Fixed bit: Packets containing a zero value for this bit are not valid packets in this version and MUST be discarded. Reserved bit: An endpoint MUST treat receipt of a packet that has a non-zero value for these bits, after removing both packet and header protection, as a connection error of type PROTOCOL_VIOLATION.
2020-05-14Added generation of CC frames with error on connection termination.Vladimir Homutov3-33/+58
When an error occurs, then c->quic->error field may be populated with an appropriate error code, and the CONNECTION CLOSE frame will be sent to the peer before the connection is closed. Otherwise, the error treated as internal and INTERNAL_ERROR code is sent. The pkt->error field is populated by functions processing packets to indicate an error when it does not fit into pass/fail return status.
2020-05-14Address validation using NEW_TOKEN frame.Sergey Kandaurov3-1/+86
2020-05-14Address validation using Retry packets.Sergey Kandaurov6-9/+497
The behaviour is toggled with the new directive "quic_retry on|off". QUIC token construction is made suitable for issuing with NEW_TOKEN.
2020-05-13Server CID change refactored.Sergey Kandaurov1-19/+21
2020-05-12Preserve original DCID and unbreak parsing 0-RTT packets.Sergey Kandaurov1-3/+15
As per QUIC transport, the first flight of 0-RTT packets obviously uses same Destination and Source Connection ID values as the client's first Initial. The fix is to match 0-RTT against original DCID after it has been switched.
2020-05-09Removed redundant long packet type checks.Sergey Kandaurov1-12/+0
2020-05-09Removed redundant SSL_do_handshake call before any handshake data.Sergey Kandaurov1-23/+0
2020-05-08Cleaned up reordering code.Vladimir Homutov1-20/+16
The ordered frame handler is always called for the existing stream, as it is allocated from this stream. Instead of searching stream by id, pointer to the stream node is passed.
2020-05-07Cleaned up firefox workaround.Vladimir Homutov1-10/+17
The idea is to skip any zeroes that follow valid QUIC packet. Currently such behavior can be only observed with Firefox which sends zero-padded initial packets.
2020-05-06OCSP stapling: moved response verification to a separate function.Roman Arutyunyan1-136/+154
2020-05-13Upstream: jump out of loop after matching the status code.Jinhua Tan1-0/+2
2020-05-08Variables: fixed buffer over-read when evaluating "$arg_".Sergey Kandaurov1-1/+1
2020-05-06Restored ngx_quic_encrypt return type.Sergey Kandaurov2-7/+6
It was inadvertently changed while working on removing memory allocations.
2020-04-30Store clearflags in pkt->flags after decryption.Vladimir Homutov1-0/+1
It doesn't make sense to store protected flags.
2020-04-30Configure: unbreak with old OpenSSL, --with-http_v3_module added.Sergey Kandaurov1-0/+2
2020-04-29Removed outdated/incorrect comments and fixed style.Vladimir Homutov3-9/+7
- we need transport parameters early to get packet size limits at least.
2020-04-30Reworked macros for parsing/assembling packet types.Vladimir Homutov4-110/+105
Previously, macros checking a packet type with the long header also checked whether this is a long header. Now it requires a separate preceding check.
2020-04-29Renamed retransmit event object in preparation for retry support.Sergey Kandaurov1-10/+10
2020-04-28Server CID change.Sergey Kandaurov1-5/+32
2020-04-28Factored out sending ACK from payload handler.Sergey Kandaurov1-39/+46
Now there's no need to annotate every frame in ACK-eliciting packet. Sending ACK was moved to the first place, so that queueing ACK frame no longer postponed up to the next packet after pushing STREAM frames.
2020-04-28Respect MAX_DATA and MAX_STREAM_DATA from QUIC client.Roman Arutyunyan2-18/+156
2020-04-28QUIC basic congestion control.Roman Arutyunyan2-10/+212
2020-04-24Fixed packet retransmission.Roman Arutyunyan1-9/+10
Previously frames in ctx->sent queue could be lost.
2020-04-23Assign connection number to every QUIC stream log.Roman Arutyunyan3-3/+2
2020-04-24Error messages cleanup.Vladimir Homutov2-187/+135
+ added "quic" prefix to all error messages + rephrased some messages + removed excessive error logging from frame parser + added ngx_quic_check_peer() function to check proper source/destination match and do it one place