aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/nghttp2/lib/nghttp2_session.c
diff options
context:
space:
mode:
authorselivni <selivni@yandex-team.ru>2022-02-10 16:47:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:47 +0300
commitfd7c757f129e0df24dd53f64c9b67053da4e8799 (patch)
tree1f07ef08e24275f10c9d0ec975c71c62abbc3d8d /contrib/libs/nghttp2/lib/nghttp2_session.c
parent0148ac5e2009a411becc605faa1e6a8801535649 (diff)
downloadydb-fd7c757f129e0df24dd53f64c9b67053da4e8799.tar.gz
Restoring authorship annotation for <selivni@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/nghttp2/lib/nghttp2_session.c')
-rw-r--r--contrib/libs/nghttp2/lib/nghttp2_session.c546
1 files changed, 273 insertions, 273 deletions
diff --git a/contrib/libs/nghttp2/lib/nghttp2_session.c b/contrib/libs/nghttp2/lib/nghttp2_session.c
index 36f1179f72..a79215cb2e 100644
--- a/contrib/libs/nghttp2/lib/nghttp2_session.c
+++ b/contrib/libs/nghttp2/lib/nghttp2_session.c
@@ -348,12 +348,12 @@ static void session_inbound_frame_reset(nghttp2_session *session) {
}
nghttp2_frame_altsvc_free(&iframe->frame.ext, mem);
break;
- case NGHTTP2_ORIGIN:
- if ((session->builtin_recv_ext_types & NGHTTP2_TYPEMASK_ORIGIN) == 0) {
- break;
- }
- nghttp2_frame_origin_free(&iframe->frame.ext, mem);
- break;
+ case NGHTTP2_ORIGIN:
+ if ((session->builtin_recv_ext_types & NGHTTP2_TYPEMASK_ORIGIN) == 0) {
+ break;
+ }
+ nghttp2_frame_origin_free(&iframe->frame.ext, mem);
+ break;
}
}
@@ -457,7 +457,7 @@ static int session_new(nghttp2_session **session_ptr,
(*session_ptr)->remote_settings.max_concurrent_streams = 100;
(*session_ptr)->max_send_header_block_length = NGHTTP2_MAX_HEADERSLEN;
- (*session_ptr)->max_outbound_ack = NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM;
+ (*session_ptr)->max_outbound_ack = NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM;
(*session_ptr)->max_settings = NGHTTP2_DEFAULT_MAX_SETTINGS;
if (option) {
@@ -518,10 +518,10 @@ static int session_new(nghttp2_session **session_ptr,
option->no_closed_streams) {
(*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_CLOSED_STREAMS;
}
-
- if (option->opt_set_mask & NGHTTP2_OPT_MAX_OUTBOUND_ACK) {
- (*session_ptr)->max_outbound_ack = option->max_outbound_ack;
- }
+
+ if (option->opt_set_mask & NGHTTP2_OPT_MAX_OUTBOUND_ACK) {
+ (*session_ptr)->max_outbound_ack = option->max_outbound_ack;
+ }
if ((option->opt_set_mask & NGHTTP2_OPT_MAX_SETTINGS) &&
option->max_settings) {
@@ -1777,13 +1777,13 @@ static int session_predicate_altsvc_send(nghttp2_session *session,
return 0;
}
-static int session_predicate_origin_send(nghttp2_session *session) {
- if (session_is_closing(session)) {
- return NGHTTP2_ERR_SESSION_CLOSING;
- }
- return 0;
-}
-
+static int session_predicate_origin_send(nghttp2_session *session) {
+ if (session_is_closing(session)) {
+ return NGHTTP2_ERR_SESSION_CLOSING;
+ }
+ return 0;
+}
+
/* Take into account settings max frame size and both connection-level
flow control here */
static ssize_t
@@ -2316,18 +2316,18 @@ static int session_prep_frame(nghttp2_session *session,
nghttp2_frame_pack_altsvc(&session->aob.framebufs, &frame->ext);
return 0;
- case NGHTTP2_ORIGIN:
- rv = session_predicate_origin_send(session);
- if (rv != 0) {
- return rv;
- }
-
- rv = nghttp2_frame_pack_origin(&session->aob.framebufs, &frame->ext);
- if (rv != 0) {
- return rv;
- }
-
- return 0;
+ case NGHTTP2_ORIGIN:
+ rv = session_predicate_origin_send(session);
+ if (rv != 0) {
+ return rv;
+ }
+
+ rv = nghttp2_frame_pack_origin(&session->aob.framebufs, &frame->ext);
+ if (rv != 0) {
+ return rv;
+ }
+
+ return 0;
default:
/* Unreachable here */
assert(0);
@@ -3634,71 +3634,71 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame,
if (call_header_cb && (inflate_flags & NGHTTP2_HD_INFLATE_EMIT)) {
rv = 0;
- if (subject_stream) {
- if (session_enforce_http_messaging(session)) {
- rv = nghttp2_http_on_header(session, subject_stream, frame, &nv,
- trailer);
-
- if (rv == NGHTTP2_ERR_IGN_HTTP_HEADER) {
- /* Don't overwrite rv here */
- int rv2;
-
- rv2 = session_call_on_invalid_header(session, frame, &nv);
- if (rv2 == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) {
- rv = NGHTTP2_ERR_HTTP_HEADER;
- } else {
- if (rv2 != 0) {
- return rv2;
- }
-
- /* header is ignored */
- DEBUGF("recv: HTTP ignored: type=%u, id=%d, header %.*s: %.*s\n",
- frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
- nv.name->base, (int)nv.value->len, nv.value->base);
-
- rv2 = session_call_error_callback(
- session, NGHTTP2_ERR_HTTP_HEADER,
- "Ignoring received invalid HTTP header field: frame type: "
- "%u, stream: %d, name: [%.*s], value: [%.*s]",
- frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
- nv.name->base, (int)nv.value->len, nv.value->base);
-
- if (nghttp2_is_fatal(rv2)) {
- return rv2;
- }
+ if (subject_stream) {
+ if (session_enforce_http_messaging(session)) {
+ rv = nghttp2_http_on_header(session, subject_stream, frame, &nv,
+ trailer);
+
+ if (rv == NGHTTP2_ERR_IGN_HTTP_HEADER) {
+ /* Don't overwrite rv here */
+ int rv2;
+
+ rv2 = session_call_on_invalid_header(session, frame, &nv);
+ if (rv2 == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) {
+ rv = NGHTTP2_ERR_HTTP_HEADER;
+ } else {
+ if (rv2 != 0) {
+ return rv2;
+ }
+
+ /* header is ignored */
+ DEBUGF("recv: HTTP ignored: type=%u, id=%d, header %.*s: %.*s\n",
+ frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
+ nv.name->base, (int)nv.value->len, nv.value->base);
+
+ rv2 = session_call_error_callback(
+ session, NGHTTP2_ERR_HTTP_HEADER,
+ "Ignoring received invalid HTTP header field: frame type: "
+ "%u, stream: %d, name: [%.*s], value: [%.*s]",
+ frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
+ nv.name->base, (int)nv.value->len, nv.value->base);
+
+ if (nghttp2_is_fatal(rv2)) {
+ return rv2;
+ }
}
- }
+ }
- if (rv == NGHTTP2_ERR_HTTP_HEADER) {
- DEBUGF("recv: HTTP error: type=%u, id=%d, header %.*s: %.*s\n",
+ if (rv == NGHTTP2_ERR_HTTP_HEADER) {
+ DEBUGF("recv: HTTP error: type=%u, id=%d, header %.*s: %.*s\n",
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
nv.name->base, (int)nv.value->len, nv.value->base);
- rv = session_call_error_callback(
+ rv = session_call_error_callback(
session, NGHTTP2_ERR_HTTP_HEADER,
- "Invalid HTTP header field was received: frame type: "
+ "Invalid HTTP header field was received: frame type: "
"%u, stream: %d, name: [%.*s], value: [%.*s]",
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
nv.name->base, (int)nv.value->len, nv.value->base);
- if (nghttp2_is_fatal(rv)) {
- return rv;
- }
-
- rv = session_handle_invalid_stream2(session,
- subject_stream->stream_id,
- frame, NGHTTP2_ERR_HTTP_HEADER);
- if (nghttp2_is_fatal(rv)) {
- return rv;
+ if (nghttp2_is_fatal(rv)) {
+ return rv;
}
- return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
+
+ rv = session_handle_invalid_stream2(session,
+ subject_stream->stream_id,
+ frame, NGHTTP2_ERR_HTTP_HEADER);
+ if (nghttp2_is_fatal(rv)) {
+ return rv;
+ }
+ return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
}
}
- if (rv == 0) {
- rv = session_call_on_header(session, frame, &nv);
- /* This handles NGHTTP2_ERR_PAUSE and
- NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE as well */
- if (rv != 0) {
+ if (rv == 0) {
+ rv = session_call_on_header(session, frame, &nv);
+ /* This handles NGHTTP2_ERR_PAUSE and
+ NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE as well */
+ if (rv != 0) {
return rv;
}
}
@@ -3803,20 +3803,20 @@ static int session_after_header_block_received(nghttp2_session *session) {
if (nghttp2_is_fatal(rv)) {
return rv;
}
-
- if (frame->hd.type == NGHTTP2_HEADERS &&
- (frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) {
- nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
- /* Don't call nghttp2_session_close_stream_if_shut_rdwr
- because RST_STREAM has been submitted. */
- }
- return 0;
+
+ if (frame->hd.type == NGHTTP2_HEADERS &&
+ (frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) {
+ nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
+ /* Don't call nghttp2_session_close_stream_if_shut_rdwr
+ because RST_STREAM has been submitted. */
+ }
+ return 0;
}
}
- rv = session_call_on_frame_received(session, frame);
- if (nghttp2_is_fatal(rv)) {
- return rv;
+ rv = session_call_on_frame_received(session, frame);
+ if (nghttp2_is_fatal(rv)) {
+ return rv;
}
if (frame->hd.type != NGHTTP2_HEADERS) {
@@ -4379,9 +4379,9 @@ int nghttp2_session_update_local_settings(nghttp2_session *session,
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
session->local_settings.max_header_list_size = iv[i].value;
break;
- case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
- session->local_settings.enable_connect_protocol = iv[i].value;
- break;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ session->local_settings.enable_connect_protocol = iv[i].value;
+ break;
}
}
@@ -4431,12 +4431,12 @@ int nghttp2_session_on_settings_received(nghttp2_session *session,
return session_call_on_frame_received(session, frame);
}
- if (!session->remote_settings_received) {
- session->remote_settings.max_concurrent_streams =
- NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS;
- session->remote_settings_received = 1;
- }
-
+ if (!session->remote_settings_received) {
+ session->remote_settings.max_concurrent_streams =
+ NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS;
+ session->remote_settings_received = 1;
+ }
+
for (i = 0; i < frame->settings.niv; ++i) {
nghttp2_settings_entry *entry = &frame->settings.iv[i];
@@ -4521,26 +4521,26 @@ int nghttp2_session_on_settings_received(nghttp2_session *session,
session->remote_settings.max_header_list_size = entry->value;
break;
- case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
-
- if (entry->value != 0 && entry->value != 1) {
- return session_handle_invalid_connection(
- session, frame, NGHTTP2_ERR_PROTO,
- "SETTINGS: invalid SETTINGS_ENABLE_CONNECT_PROTOCOL");
- }
-
- if (!session->server &&
- session->remote_settings.enable_connect_protocol &&
- entry->value == 0) {
- return session_handle_invalid_connection(
- session, frame, NGHTTP2_ERR_PROTO,
- "SETTINGS: server attempted to disable "
- "SETTINGS_ENABLE_CONNECT_PROTOCOL");
- }
-
- session->remote_settings.enable_connect_protocol = entry->value;
-
- break;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+
+ if (entry->value != 0 && entry->value != 1) {
+ return session_handle_invalid_connection(
+ session, frame, NGHTTP2_ERR_PROTO,
+ "SETTINGS: invalid SETTINGS_ENABLE_CONNECT_PROTOCOL");
+ }
+
+ if (!session->server &&
+ session->remote_settings.enable_connect_protocol &&
+ entry->value == 0) {
+ return session_handle_invalid_connection(
+ session, frame, NGHTTP2_ERR_PROTO,
+ "SETTINGS: server attempted to disable "
+ "SETTINGS_ENABLE_CONNECT_PROTOCOL");
+ }
+
+ session->remote_settings.enable_connect_protocol = entry->value;
+
+ break;
}
}
@@ -4893,11 +4893,11 @@ int nghttp2_session_on_altsvc_received(nghttp2_session *session,
return session_call_on_frame_received(session, frame);
}
-int nghttp2_session_on_origin_received(nghttp2_session *session,
- nghttp2_frame *frame) {
- return session_call_on_frame_received(session, frame);
-}
-
+int nghttp2_session_on_origin_received(nghttp2_session *session,
+ nghttp2_frame *frame) {
+ return session_call_on_frame_received(session, frame);
+}
+
static int session_process_altsvc_frame(nghttp2_session *session) {
nghttp2_inbound_frame *iframe = &session->iframe;
nghttp2_frame *frame = &iframe->frame;
@@ -4913,25 +4913,25 @@ static int session_process_altsvc_frame(nghttp2_session *session) {
return nghttp2_session_on_altsvc_received(session, frame);
}
-static int session_process_origin_frame(nghttp2_session *session) {
- nghttp2_inbound_frame *iframe = &session->iframe;
- nghttp2_frame *frame = &iframe->frame;
- nghttp2_mem *mem = &session->mem;
- int rv;
-
- rv = nghttp2_frame_unpack_origin_payload(&frame->ext, iframe->lbuf.pos,
- nghttp2_buf_len(&iframe->lbuf), mem);
- if (rv != 0) {
- if (nghttp2_is_fatal(rv)) {
- return rv;
- }
- /* Ignore ORIGIN frame which cannot be parsed. */
- return 0;
- }
-
- return nghttp2_session_on_origin_received(session, frame);
-}
-
+static int session_process_origin_frame(nghttp2_session *session) {
+ nghttp2_inbound_frame *iframe = &session->iframe;
+ nghttp2_frame *frame = &iframe->frame;
+ nghttp2_mem *mem = &session->mem;
+ int rv;
+
+ rv = nghttp2_frame_unpack_origin_payload(&frame->ext, iframe->lbuf.pos,
+ nghttp2_buf_len(&iframe->lbuf), mem);
+ if (rv != 0) {
+ if (nghttp2_is_fatal(rv)) {
+ return rv;
+ }
+ /* Ignore ORIGIN frame which cannot be parsed. */
+ return 0;
+ }
+
+ return nghttp2_session_on_origin_received(session, frame);
+}
+
static int session_process_extension_frame(nghttp2_session *session) {
int rv;
nghttp2_inbound_frame *iframe = &session->iframe;
@@ -4973,17 +4973,17 @@ int nghttp2_session_on_data_received(nghttp2_session *session,
if (nghttp2_is_fatal(rv)) {
return rv;
}
-
- nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
- /* Don't call nghttp2_session_close_stream_if_shut_rdwr because
- RST_STREAM has been submitted. */
- return 0;
+
+ nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
+ /* Don't call nghttp2_session_close_stream_if_shut_rdwr because
+ RST_STREAM has been submitted. */
+ return 0;
}
}
- rv = session_call_on_frame_received(session, frame);
- if (nghttp2_is_fatal(rv)) {
- return rv;
+ rv = session_call_on_frame_received(session, frame);
+ if (nghttp2_is_fatal(rv)) {
+ return rv;
}
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
@@ -5268,7 +5268,7 @@ static void inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe) {
case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE:
case NGHTTP2_SETTINGS_MAX_FRAME_SIZE:
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
- case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
break;
default:
DEBUGF("recv: unknown settings id=0x%02x\n", iv.settings_id);
@@ -5407,8 +5407,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
case NGHTTP2_IB_READ_CLIENT_MAGIC:
readlen = nghttp2_min(inlen, iframe->payloadleft);
- if (memcmp(&NGHTTP2_CLIENT_MAGIC[NGHTTP2_CLIENT_MAGIC_LEN -
- iframe->payloadleft],
+ if (memcmp(&NGHTTP2_CLIENT_MAGIC[NGHTTP2_CLIENT_MAGIC_LEN -
+ iframe->payloadleft],
in, readlen) != 0) {
return NGHTTP2_ERR_BAD_CLIENT_MAGIC;
}
@@ -5847,42 +5847,42 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
inbound_frame_set_mark(iframe, 2);
break;
- case NGHTTP2_ORIGIN:
- if (!(session->builtin_recv_ext_types & NGHTTP2_TYPEMASK_ORIGIN)) {
- busy = 1;
- iframe->state = NGHTTP2_IB_IGN_PAYLOAD;
- break;
- }
-
- DEBUGF("recv: ORIGIN\n");
-
- iframe->frame.ext.payload = &iframe->ext_frame_payload.origin;
-
- if (session->server || iframe->frame.hd.stream_id ||
- (iframe->frame.hd.flags & 0xf0)) {
- busy = 1;
- iframe->state = NGHTTP2_IB_IGN_PAYLOAD;
- break;
- }
-
- iframe->frame.hd.flags = NGHTTP2_FLAG_NONE;
-
- if (iframe->payloadleft) {
- iframe->raw_lbuf = nghttp2_mem_malloc(mem, iframe->payloadleft);
-
- if (iframe->raw_lbuf == NULL) {
- return NGHTTP2_ERR_NOMEM;
- }
-
- nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf,
- iframe->payloadleft);
- } else {
- busy = 1;
- }
-
- iframe->state = NGHTTP2_IB_READ_ORIGIN_PAYLOAD;
-
- break;
+ case NGHTTP2_ORIGIN:
+ if (!(session->builtin_recv_ext_types & NGHTTP2_TYPEMASK_ORIGIN)) {
+ busy = 1;
+ iframe->state = NGHTTP2_IB_IGN_PAYLOAD;
+ break;
+ }
+
+ DEBUGF("recv: ORIGIN\n");
+
+ iframe->frame.ext.payload = &iframe->ext_frame_payload.origin;
+
+ if (session->server || iframe->frame.hd.stream_id ||
+ (iframe->frame.hd.flags & 0xf0)) {
+ busy = 1;
+ iframe->state = NGHTTP2_IB_IGN_PAYLOAD;
+ break;
+ }
+
+ iframe->frame.hd.flags = NGHTTP2_FLAG_NONE;
+
+ if (iframe->payloadleft) {
+ iframe->raw_lbuf = nghttp2_mem_malloc(mem, iframe->payloadleft);
+
+ if (iframe->raw_lbuf == NULL) {
+ return NGHTTP2_ERR_NOMEM;
+ }
+
+ nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf,
+ iframe->payloadleft);
+ } else {
+ busy = 1;
+ }
+
+ iframe->state = NGHTTP2_IB_READ_ORIGIN_PAYLOAD;
+
+ break;
default:
busy = 1;
@@ -6739,44 +6739,44 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
}
rv = session_process_altsvc_frame(session);
+ if (nghttp2_is_fatal(rv)) {
+ return rv;
+ }
+
+ session_inbound_frame_reset(session);
+
+ break;
+ case NGHTTP2_IB_READ_ORIGIN_PAYLOAD:
+ DEBUGF("recv: [IB_READ_ORIGIN_PAYLOAD]\n");
+
+ readlen = inbound_frame_payload_readlen(iframe, in, last);
+
+ if (readlen > 0) {
+ iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen);
+
+ iframe->payloadleft -= readlen;
+ in += readlen;
+ }
+
+ DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
+ iframe->payloadleft);
+
+ if (iframe->payloadleft) {
+ assert(nghttp2_buf_avail(&iframe->lbuf) > 0);
+
+ break;
+ }
+
+ rv = session_process_origin_frame(session);
+
if (nghttp2_is_fatal(rv)) {
return rv;
}
- session_inbound_frame_reset(session);
-
- break;
- case NGHTTP2_IB_READ_ORIGIN_PAYLOAD:
- DEBUGF("recv: [IB_READ_ORIGIN_PAYLOAD]\n");
-
- readlen = inbound_frame_payload_readlen(iframe, in, last);
-
- if (readlen > 0) {
- iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen);
-
- iframe->payloadleft -= readlen;
- in += readlen;
- }
-
- DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
- iframe->payloadleft);
-
- if (iframe->payloadleft) {
- assert(nghttp2_buf_avail(&iframe->lbuf) > 0);
-
- break;
- }
-
- rv = session_process_origin_frame(session);
-
- if (nghttp2_is_fatal(rv)) {
- return rv;
- }
-
- if (iframe->state == NGHTTP2_IB_IGN_ALL) {
- return (ssize_t)inlen;
- }
-
+ if (iframe->state == NGHTTP2_IB_IGN_ALL) {
+ return (ssize_t)inlen;
+ }
+
session_inbound_frame_reset(session);
break;
@@ -6879,7 +6879,7 @@ int nghttp2_session_add_ping(nghttp2_session *session, uint8_t flags,
mem = &session->mem;
if ((flags & NGHTTP2_FLAG_ACK) &&
- session->obq_flood_counter_ >= session->max_outbound_ack) {
+ session->obq_flood_counter_ >= session->max_outbound_ack) {
return NGHTTP2_ERR_FLOODED;
}
@@ -7024,7 +7024,7 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
return NGHTTP2_ERR_INVALID_ARGUMENT;
}
- if (session->obq_flood_counter_ >= session->max_outbound_ack) {
+ if (session->obq_flood_counter_ >= session->max_outbound_ack) {
return NGHTTP2_ERR_FLOODED;
}
}
@@ -7100,13 +7100,13 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
}
}
- for (i = niv; i > 0; --i) {
- if (iv[i - 1].settings_id == NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL) {
- session->pending_enable_connect_protocol = (uint8_t)iv[i - 1].value;
- break;
- }
- }
-
+ for (i = niv; i > 0; --i) {
+ if (iv[i - 1].settings_id == NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL) {
+ session->pending_enable_connect_protocol = (uint8_t)iv[i - 1].value;
+ break;
+ }
+ }
+
return 0;
}
@@ -7263,42 +7263,42 @@ int nghttp2_session_set_stream_user_data(nghttp2_session *session,
int32_t stream_id,
void *stream_user_data) {
nghttp2_stream *stream;
- nghttp2_frame *frame;
- nghttp2_outbound_item *item;
-
+ nghttp2_frame *frame;
+ nghttp2_outbound_item *item;
+
stream = nghttp2_session_get_stream(session, stream_id);
- if (stream) {
- stream->stream_user_data = stream_user_data;
- return 0;
- }
-
- if (session->server || !nghttp2_session_is_my_stream_id(session, stream_id) ||
- !nghttp2_outbound_queue_top(&session->ob_syn)) {
- return NGHTTP2_ERR_INVALID_ARGUMENT;
- }
-
- frame = &nghttp2_outbound_queue_top(&session->ob_syn)->frame;
- assert(frame->hd.type == NGHTTP2_HEADERS);
-
- if (frame->hd.stream_id > stream_id ||
- (uint32_t)stream_id >= session->next_stream_id) {
+ if (stream) {
+ stream->stream_user_data = stream_user_data;
+ return 0;
+ }
+
+ if (session->server || !nghttp2_session_is_my_stream_id(session, stream_id) ||
+ !nghttp2_outbound_queue_top(&session->ob_syn)) {
return NGHTTP2_ERR_INVALID_ARGUMENT;
}
-
- for (item = session->ob_syn.head; item; item = item->qnext) {
- if (item->frame.hd.stream_id < stream_id) {
- continue;
- }
-
- if (item->frame.hd.stream_id > stream_id) {
- break;
- }
-
- item->aux_data.headers.stream_user_data = stream_user_data;
- return 0;
- }
-
- return NGHTTP2_ERR_INVALID_ARGUMENT;
+
+ frame = &nghttp2_outbound_queue_top(&session->ob_syn)->frame;
+ assert(frame->hd.type == NGHTTP2_HEADERS);
+
+ if (frame->hd.stream_id > stream_id ||
+ (uint32_t)stream_id >= session->next_stream_id) {
+ return NGHTTP2_ERR_INVALID_ARGUMENT;
+ }
+
+ for (item = session->ob_syn.head; item; item = item->qnext) {
+ if (item->frame.hd.stream_id < stream_id) {
+ continue;
+ }
+
+ if (item->frame.hd.stream_id > stream_id) {
+ break;
+ }
+
+ item->aux_data.headers.stream_user_data = stream_user_data;
+ return 0;
+ }
+
+ return NGHTTP2_ERR_INVALID_ARGUMENT;
}
int nghttp2_session_resume_data(nghttp2_session *session, int32_t stream_id) {
@@ -7415,8 +7415,8 @@ uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session,
return session->remote_settings.max_frame_size;
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
return session->remote_settings.max_header_list_size;
- case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
- return session->remote_settings.enable_connect_protocol;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ return session->remote_settings.enable_connect_protocol;
}
assert(0);
@@ -7438,8 +7438,8 @@ uint32_t nghttp2_session_get_local_settings(nghttp2_session *session,
return session->local_settings.max_frame_size;
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
return session->local_settings.max_header_list_size;
- case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
- return session->local_settings.enable_connect_protocol;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ return session->local_settings.enable_connect_protocol;
}
assert(0);