Mercurial > hg > nginx
annotate src/os/unix/ngx_udp_send.c @ 8795:278ab0ed24f2 quic
HTTP/3: generate more H3_FRAME_UNEXPECTED.
As per quic-http-34, these are the cases when this error should be generated:
If an endpoint receives a second SETTINGS frame
on the control stream, the endpoint MUST respond with a connection
error of type H3_FRAME_UNEXPECTED
SETTINGS frames MUST NOT be sent on any stream other than the control
stream. If an endpoint receives a SETTINGS frame on a different
stream, the endpoint MUST respond with a connection error of type
H3_FRAME_UNEXPECTED.
A client MUST NOT send a PUSH_PROMISE frame. A server MUST treat the
receipt of a PUSH_PROMISE frame as a connection error of type
H3_FRAME_UNEXPECTED; see Section 8.
The MAX_PUSH_ID frame is always sent on the control stream. Receipt
of a MAX_PUSH_ID frame on any other stream MUST be treated as a
connection error of type H3_FRAME_UNEXPECTED.
Receipt of an invalid sequence of frames MUST be treated as a
connection error of type H3_FRAME_UNEXPECTED; see Section 8. In
particular, a DATA frame before any HEADERS frame, or a HEADERS or
DATA frame after the trailing HEADERS frame, is considered invalid.
A CANCEL_PUSH frame is sent on the control stream. Receiving a
CANCEL_PUSH frame on a stream other than the control stream MUST be
treated as a connection error of type H3_FRAME_UNEXPECTED.
The GOAWAY frame is always sent on the control stream.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 11 Jun 2021 12:11:08 +0300 |
parents | 8f038068f4bc |
children |
rev | line source |
---|---|
6436 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_event.h> | |
11 | |
12 | |
13 ssize_t | |
14 ngx_udp_unix_send(ngx_connection_t *c, u_char *buf, size_t size) | |
15 { | |
16 ssize_t n; | |
17 ngx_err_t err; | |
18 ngx_event_t *wev; | |
19 | |
20 wev = c->write; | |
21 | |
22 for ( ;; ) { | |
23 n = sendto(c->fd, buf, size, 0, c->sockaddr, c->socklen); | |
24 | |
25 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
26 "sendto: fd:%d %z of %uz to \"%V\"", | |
27 c->fd, n, size, &c->addr_text); | |
28 | |
29 if (n >= 0) { | |
30 if ((size_t) n != size) { | |
31 wev->error = 1; | |
32 (void) ngx_connection_error(c, 0, "sendto() incomplete"); | |
33 return NGX_ERROR; | |
34 } | |
35 | |
36 c->sent += n; | |
37 | |
38 return n; | |
39 } | |
40 | |
41 err = ngx_socket_errno; | |
42 | |
43 if (err == NGX_EAGAIN) { | |
44 wev->ready = 0; | |
45 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, NGX_EAGAIN, | |
46 "sendto() not ready"); | |
47 return NGX_AGAIN; | |
48 } | |
49 | |
50 if (err != NGX_EINTR) { | |
51 wev->error = 1; | |
52 (void) ngx_connection_error(c, err, "sendto() failed"); | |
53 return NGX_ERROR; | |
54 } | |
55 } | |
56 } |