Lines Matching defs:stream

908   nghttp2_stream *stream;
928 /* stream 1 is not opened, so it must be responded with connection
944 /* Create stream 1 with CLOSING state. DATA is ignored. */
945 stream = open_sent_stream2(session, 1, NGHTTP2_STREAM_CLOSING);
947 /* Set initial window size 16383 to check stream flow control,
949 stream->local_window_size = 16383;
962 stream->state = NGHTTP2_STREAM_OPENED;
990 stream->local_window_size = 1 << 20;
1004 /* Reception of DATA with stream ID = 0 causes connection error */
1024 /* Check window_update_queued flag in both session and stream */
1033 stream = open_recv_stream(session, 1);
1048 /* Now 2 WINDOW_UPDATEs for session and stream should be queued. */
1049 CU_ASSERT(0 == stream->recv_window_size);
1051 CU_ASSERT(1 == stream->window_update_queued);
1064 /* WINDOW_UPDATE is blocked for session and stream, so
1066 CU_ASSERT(32768 == stream->recv_window_size);
1068 CU_ASSERT(1 == stream->window_update_queued);
1075 stream, and send them at once. */
1079 CU_ASSERT(0 == stream->recv_window_size);
1081 CU_ASSERT(0 == stream->window_update_queued);
1097 nghttp2_stream *stream;
1119 /* First create stream 1, then close it. Check that data is
1131 /* close stream here */
1135 /* stream 1 has been closed, and we disabled auto flow-control, so
1152 DATA for that stream is illegal. */
1153 stream = open_recv_stream(session, 1);
1154 stream->http_flags |= NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE;
1165 /* Check window_update_queued flag in both session and stream */
1168 stream = open_recv_stream(session, 1);
1189 CU_ASSERT(65535 == stream->recv_window_size);
1197 CU_ASSERT(65535 == stream->recv_window_size);
1199 CU_ASSERT(0 == stream->window_update_queued);
1207 CU_ASSERT(65535 == stream->recv_window_size);
1209 CU_ASSERT(0 == stream->window_update_queued);
1212 /* Do the same for stream */
1217 CU_ASSERT(32768 == stream->recv_window_size);
1219 CU_ASSERT(1 == stream->window_update_queued);
1225 CU_ASSERT(0 == stream->recv_window_size);
1227 CU_ASSERT(0 == stream->window_update_queued);
1442 nghttp2_stream *stream;
1484 stream = nghttp2_session_get_stream(session, 3);
1486 CU_ASSERT(99 == stream->weight);
1487 CU_ASSERT(1 == stream->dep_prev->stream_id);
1521 stream = nghttp2_session_get_stream(session, 5);
1523 CU_ASSERT(NULL == stream);
1566 stream = nghttp2_session_get_stream(session, 1);
1568 CU_ASSERT(NULL == stream);
1647 /* promised stream ID field */
1699 nghttp2_stream *stream;
1741 stream = nghttp2_session_get_stream_raw(session, 1);
1743 CU_ASSERT(stream->flags & NGHTTP2_STREAM_FLAG_CLOSED);
1761 nghttp2_stream *stream;
1777 stream */
1803 stream = nghttp2_session_get_stream(session, 1);
1805 CU_ASSERT(NULL != stream);
1816 stream = nghttp2_session_get_stream(session, 1);
1818 CU_ASSERT(NULL == stream);
1845 nghttp2_stream *stream;
1886 stream = nghttp2_session_get_stream(session, 1);
1888 CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri));
1889 CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri));
1924 stream = nghttp2_session_get_stream(session, 2);
1927 nghttp2_extpri_uint8_urgency(stream->http_extpri));
1929 nghttp2_extpri_uint8_urgency(stream->extpri));
2508 /* non-empty origin to a stream other than 0 */
2532 /* empty origin to stream 0 */
2697 /* A frame should be ignored if it is sent to a stream other than
2698 stream 0. */
2785 nghttp2_stream *stream;
2832 stream = nghttp2_session_get_stream_raw(session, 1);
2834 CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri));
2835 CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri));
2861 stream = nghttp2_session_get_stream_raw(session, 1);
2863 CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state);
2864 CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri));
2865 CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri));
2881 CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state);
2882 CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri));
2883 CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri));
2909 stream = nghttp2_session_get_stream_raw(session, 1);
2911 CU_ASSERT(NGHTTP2_EXTPRI_DEFAULT_URGENCY == stream->extpri);
3207 /* check stream id */
3218 nghttp2_stream *stream;
3244 stream = nghttp2_session_get_stream(session, stream_id);
3245 CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state);
3246 CU_ASSERT(255 == stream->weight);
3278 /* Stream ID is our side and it is idle stream ID, then treat it as
3314 /* Receiving peer's idle stream ID is subject to connection error */
3330 /* Receiving our's idle stream ID is subject to connection error */
3349 /* Stream ID which is not idle and not in stream map is just
3376 /* If GOAWAY has been sent, new stream is ignored */
3393 /* HEADERS to closed stream */
3394 stream = open_recv_stream(session, 1);
3395 nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
3415 nghttp2_stream *stream;
3424 stream = open_sent_stream2(session, 1, NGHTTP2_STREAM_OPENING);
3432 stream));
3434 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
3445 nghttp2_stream *stream;
3454 stream = open_sent_stream2(session, 1, NGHTTP2_STREAM_OPENED);
3455 nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR);
3462 CU_ASSERT(0 == nghttp2_session_on_headers_received(session, &frame, stream));
3464 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
3466 /* stream closed */
3469 CU_ASSERT(0 == nghttp2_session_on_headers_received(session, &frame, stream));
3474 stream = open_sent_stream2(session, 3, NGHTTP2_STREAM_CLOSING);
3478 nghttp2_session_on_headers_received(session, &frame, stream));
3483 /* Server initiated stream */
3484 stream = open_recv_stream(session, 2);
3489 CU_ASSERT(0 == nghttp2_session_on_headers_received(session, &frame, stream));
3491 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
3493 nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
3495 /* Further reception of HEADERS is subject to stream error */
3497 nghttp2_session_on_headers_received(session, &frame, stream));
3510 nghttp2_stream *stream;
3521 stream = open_recv_stream2(session, 2, NGHTTP2_STREAM_RESERVED);
3525 stream's state is NGHTTP2_STREAM_RESERVED and session->server is
3533 session, &frame, stream));
3536 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
3538 CU_ASSERT(0 == (stream->flags & NGHTTP2_STREAM_FLAG_PUSH));
3543 stream = open_recv_stream2(session, 4, NGHTTP2_STREAM_RESERVED);
3547 stream));
3561 stream = open_recv_stream2(session, 6, NGHTTP2_STREAM_RESERVED);
3566 stream));
3582 nghttp2_stream *stream, *dep_stream;
3591 stream = open_recv_stream(session, 1);
3597 /* depend on stream 0 */
3600 CU_ASSERT(2 == stream->weight);
3602 stream = open_sent_stream(session, 2);
3607 /* using dependency stream */
3611 CU_ASSERT(dep_stream == stream->dep_prev);
3613 /* PRIORITY against idle stream */
3619 stream = nghttp2_session_get_stream_raw(session, frame.hd.stream_id);
3621 CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state);
3622 CU_ASSERT(dep_stream == stream->dep_prev);
3695 nghttp2_stream *stream;
3844 /* Check the case where stream window size overflows */
3924 stream = open_recv_stream(session, 1);
3941 CU_ASSERT((int32_t)hd.length == stream->recv_window_size);
3942 CU_ASSERT((int32_t)hd.length == stream->consumed_size);
3949 CU_ASSERT(1024 == stream->local_window_size);
3950 CU_ASSERT(0 == stream->recv_window_size);
3951 CU_ASSERT(0 == stream->consumed_size);
3992 nghttp2_stream *stream, *promised_stream;
4008 stream = open_sent_stream(session, 1);
4025 nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
4047 stream = open_sent_stream(session, 1);
4049 /* Attempt to PUSH_PROMISE against stream in closing state */
4050 stream->state = NGHTTP2_STREAM_CLOSING;
4067 /* Attempt to PUSH_PROMISE against idle stream */
4089 stream = open_sent_stream(session, 1);
4136 /* Attempt to PUSH_PROMISE against reserved (remote) stream */
4333 /* on_stream_close should be callsed for 2 times (stream 5 and 7) */
4376 nghttp2_stream *stream;
4390 stream = open_sent_stream(session, 1);
4394 CU_ASSERT(0 == nghttp2_stream_attach_item(stream, data_item));
4402 stream->remote_window_size);
4404 nghttp2_stream_defer_item(stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL);
4409 stream->remote_window_size);
4410 CU_ASSERT(0 == (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL));
4414 /* Receiving WINDOW_UPDATE on reserved (remote) stream is a
4429 /* Receiving WINDOW_UPDATE on reserved (local) stream is allowed */
4432 stream = open_sent_stream2(session, 2, NGHTTP2_STREAM_RESERVED);
4440 CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 4096 == stream->remote_window_size);
4452 nghttp2_stream *stream;
4458 stream = open_recv_stream(session, 2);
4463 CU_ASSERT(0 == stream->shut_flags);
4468 CU_ASSERT(NGHTTP2_SHUT_RD == stream->shut_flags);
4479 /* Check INVALID_STREAM case: DATA frame with stream ID which does
4486 /* DATA against nonexistent stream is just ignored for now. */
4496 nghttp2_stream *stream;
4508 stream = open_recv_stream(session, 1);
4509 nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
4523 /* DATA to closed stream with explicit closed (remote) */
4524 stream = open_recv_stream(session, 1);
4525 nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD);
4572 /* Receiving empty origin with stream ID == 0 */
4588 /* Receiving non-empty origin with stream ID != 0 */
4606 /* Receiving empty origin with stream ID != 0; this is OK */
4648 nghttp2_stream *stream;
4671 stream = nghttp2_session_get_stream(session, 1);
4672 CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state);
4682 nghttp2_stream *stream;
4703 stream = nghttp2_session_get_stream(session, 1);
4704 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
4776 nghttp2_stream *stream;
4799 stream = nghttp2_session_get_stream(session, 2);
4800 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
4801 CU_ASSERT(0 == (stream->flags & NGHTTP2_STREAM_FLAG_PUSH));
4840 nghttp2_stream *stream;
4868 stream = nghttp2_session_get_stream(session, 2);
4869 CU_ASSERT(NGHTTP2_STREAM_RESERVED == stream->state);
4946 nghttp2_stream *stream;
4971 stream = nghttp2_session_get_stream(session, 1);
4972 CU_ASSERT(stream != NULL);
4973 CU_ASSERT(&callbacks == stream->stream_user_data);
4974 CU_ASSERT(NGHTTP2_SHUT_WR == stream->shut_flags);
4997 stream = nghttp2_session_get_stream(session, 1);
4999 CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state);
5012 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
5024 stream = nghttp2_session_get_stream(session, 1);
5025 CU_ASSERT(stream != NULL);
5026 CU_ASSERT(NULL == stream->stream_user_data);
5027 CU_ASSERT(NGHTTP2_SHUT_RD == stream->shut_flags);
5051 nghttp2_stream *stream;
5061 stream = open_recv_stream(session, 1);
5065 rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5068 CU_ASSERT(10 == stream->weight);
5069 CU_ASSERT(&session->root == stream->dep_prev);
5071 /* If dependency to idle stream which is not in dependency tree yet */
5075 rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5078 CU_ASSERT(99 == stream->weight);
5079 CU_ASSERT(3 == stream->dep_prev->stream_id);
5090 rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5093 CU_ASSERT(128 == stream->weight);
5094 CU_ASSERT(dep_stream == stream->dep_prev);
5099 rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5102 CU_ASSERT(100 == stream->weight);
5103 CU_ASSERT(dep_stream == stream->dep_prev);
5106 /* Test circular dependency; stream 1 is first removed and becomes
5107 root. Then stream 3 depends on it. */
5114 CU_ASSERT(stream == dep_stream->dep_prev);
5116 /* Making priority to closed stream will result in default
5122 rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5125 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
5131 /* circular dependency; in case of stream which is not a direct
5133 stream = open_recv_stream(session, 1);
5134 stream = open_recv_stream_with_dep(session, 3, stream);
5135 stream = open_recv_stream_with_dep(session, 5, stream);
5136 stream = open_recv_stream_with_dep(session, 7, stream);
5137 open_recv_stream_with_dep(session, 9, stream);
5141 stream = nghttp2_session_get_stream(session, 3);
5142 rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5145 CU_ASSERT(7 == stream->dep_prev->stream_id);
5147 stream = nghttp2_session_get_stream(session, 7);
5149 CU_ASSERT(1 == stream->dep_prev->stream_id);
5151 stream = nghttp2_session_get_stream(session, 9);
5153 CU_ASSERT(3 == stream->dep_prev->stream_id);
5155 stream = nghttp2_session_get_stream(session, 5);
5157 CU_ASSERT(3 == stream->dep_prev->stream_id);
5163 /* circular dependency; in case of stream which is not a direct
5165 stream = open_recv_stream(session, 1);
5166 stream = open_recv_stream_with_dep(session, 3, stream);
5167 stream = open_recv_stream_with_dep(session, 5, stream);
5168 stream = open_recv_stream_with_dep(session, 7, stream);
5169 open_recv_stream_with_dep(session, 9, stream);
5173 stream = nghttp2_session_get_stream(session, 3);
5174 rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5177 CU_ASSERT(7 == stream->dep_prev->stream_id);
5179 stream = nghttp2_session_get_stream(session, 7);
5181 CU_ASSERT(1 == stream->dep_prev->stream_id);
5183 stream = nghttp2_session_get_stream(session, 9);
5185 CU_ASSERT(7 == stream->dep_prev->stream_id);
5187 stream = nghttp2_session_get_stream(session, 5);
5189 CU_ASSERT(3 == stream->dep_prev->stream_id);
5197 nghttp2_stream *stream;
5205 stream = open_recv_stream(session, 1);
5211 nghttp2_session_reprioritize_stream(session, stream, &pri_spec);
5213 /* idle stream is not counteed to max concurrent streams */
5215 CU_ASSERT(10 == stream->weight);
5216 CU_ASSERT(101 == stream->dep_prev->stream_id);
5218 stream = nghttp2_session_get_stream_raw(session, 101);
5220 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
5717 /* Specifying stream ID <= 0 is error */
5758 nghttp2_stream *stream;
5779 /* The transimission will be canceled because the stream 1 is not
5784 stream = open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING);
5791 CU_ASSERT(stream->shut_flags & NGHTTP2_SHUT_WR);
5800 nghttp2_stream *stream;
5808 stream = open_sent_stream2(session, 2, NGHTTP2_STREAM_RESERVED);
5817 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
5818 CU_ASSERT(&foo == stream->stream_user_data);
5822 /* Sending HEADERS from client against stream in reserved state is
5842 nghttp2_stream *stream;
5875 /* The transimission will be canceled because the stream 1 is not
5880 stream = open_sent_stream(session, 1);
5887 CU_ASSERT(stream->shut_flags & NGHTTP2_SHUT_WR);
5919 /* Error cases with invalid stream ID */
5928 /* Sending stream ID <= 0 is error */
6023 nghttp2_stream *stream;
6032 stream = open_sent_stream(session, 1);
6036 /* depends on stream 0 */
6040 CU_ASSERT(3 == stream->weight);
6042 /* submit against idle stream */
6192 nghttp2_stream *stream;
6208 stream = open_recv_stream(session, 1);
6209 stream->local_window_size = NGHTTP2_INITIAL_WINDOW_SIZE + 100;
6210 stream->recv_window_size = 32768;
6218 stream = nghttp2_session_get_stream(session, 1);
6219 CU_ASSERT(0 == stream->recv_window_size);
6220 CU_ASSERT(16 * 1024 + 100 == stream->local_window_size);
6222 stream = nghttp2_session_get_stream(session, 3);
6223 CU_ASSERT(16 * 1024 == stream->local_window_size);
6239 stream = open_recv_stream(session, 1);
6240 stream->local_window_size = NGHTTP2_INITIAL_WINDOW_SIZE + 100;
6241 stream->recv_window_size = 32768;
6247 stream = nghttp2_session_get_stream(session, 1);
6249 CU_ASSERT(32768 == stream->recv_window_size);
6250 CU_ASSERT(16 * 1024 + 100 == stream->local_window_size);
6260 stream = open_recv_stream(session, 1);
6261 stream->local_window_size = NGHTTP2_MAX_WINDOW_SIZE;
6356 nghttp2_stream *stream;
6368 stream = nghttp2_session_get_stream(session, 2);
6370 CU_ASSERT(NULL != stream);
6371 CU_ASSERT(NGHTTP2_STREAM_RESERVED == stream->state);
6381 stream = nghttp2_session_get_stream(session, 2);
6383 CU_ASSERT(NGHTTP2_STREAM_RESERVED == stream->state);
6386 /* submit PUSH_PROMISE while associated stream is not opened */
6404 nghttp2_stream *stream;
6410 stream = open_recv_stream(session, 2);
6411 stream->recv_window_size = 4096;
6419 CU_ASSERT(3072 == stream->recv_window_size);
6427 CU_ASSERT(0 == stream->recv_window_size);
6435 CU_ASSERT(0 == stream->recv_window_size);
6439 /* It is ok if stream is closed or does not exist at the call
6451 nghttp2_stream *stream;
6457 stream = open_recv_stream(session, 2);
6458 stream->recv_window_size = 4096;
6461 stream->recv_window_size + 1));
6462 CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 1 == stream->local_window_size);
6463 CU_ASSERT(0 == stream->recv_window_size);
6471 stream->recv_window_size = 4096;
6473 -stream->local_window_size / 2));
6474 CU_ASSERT(32768 == stream->local_window_size);
6475 CU_ASSERT(-28672 == stream->recv_window_size);
6476 CU_ASSERT(32768 == stream->recv_reduction);
6484 CU_ASSERT(49152 == stream->local_window_size);
6485 CU_ASSERT(-12288 == stream->recv_window_size);
6486 CU_ASSERT(16384 == stream->recv_reduction);
6963 /* Sending RST_STREAM to idle stream (local) is ignored */
6977 /* Sending RST_STREAM to idle stream (remote) is ignored */
6991 /* Sending RST_STREAM to non-idle stream (local) */
7009 /* Sending RST_STREAM to non-idle stream (remote) */
7027 /* Sending RST_STREAM to pending stream */
7058 nghttp2_stream *stream;
7066 stream = nghttp2_session_open_stream(session, 1, NGHTTP2_STREAM_FLAG_NONE,
7070 CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state);
7071 CU_ASSERT(245 == stream->weight);
7072 CU_ASSERT(&session->root == stream->dep_prev);
7073 CU_ASSERT(NGHTTP2_SHUT_NONE == stream->shut_flags);
7075 stream = nghttp2_session_open_stream(session, 2, NGHTTP2_STREAM_FLAG_NONE,
7080 CU_ASSERT(&session->root == stream->dep_prev);
7081 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
7082 CU_ASSERT(NGHTTP2_SHUT_NONE == stream->shut_flags);
7084 stream = nghttp2_session_open_stream(session, 4, NGHTTP2_STREAM_FLAG_NONE,
7089 CU_ASSERT(&session->root == stream->dep_prev);
7090 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
7091 CU_ASSERT(NGHTTP2_SHUT_RD == stream->shut_flags);
7095 stream = nghttp2_session_open_stream(session, 3, NGHTTP2_STREAM_FLAG_NONE,
7097 CU_ASSERT(17 == stream->weight);
7098 CU_ASSERT(1 == stream->dep_prev->stream_id);
7100 /* Dependency to idle stream */
7103 stream = nghttp2_session_open_stream(session, 5, NGHTTP2_STREAM_FLAG_NONE,
7105 CU_ASSERT(240 == stream->weight);
7106 CU_ASSERT(1000000007 == stream->dep_prev->stream_id);
7108 stream = nghttp2_session_get_stream_raw(session, 1000000007);
7110 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
7111 CU_ASSERT(&session->root == stream->dep_prev);
7113 /* Dependency to closed stream which is not in dependency tree */
7118 stream = nghttp2_session_open_stream(session, 9, NGHTTP2_FLAG_NONE, &pri_spec,
7121 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
7122 CU_ASSERT(&session->root == stream->dep_prev);
7127 stream = nghttp2_session_open_stream(session, 4, NGHTTP2_STREAM_FLAG_NONE,
7132 CU_ASSERT(&session->root == stream->dep_prev);
7133 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
7134 CU_ASSERT(NGHTTP2_SHUT_WR == stream->shut_flags);
7142 nghttp2_stream *stream;
7148 /* Dependency to idle stream */
7151 stream = nghttp2_session_open_stream(session, 1, NGHTTP2_STREAM_FLAG_NONE,
7154 CU_ASSERT(245 == stream->weight);
7155 CU_ASSERT(101 == stream->dep_prev->stream_id);
7157 stream = nghttp2_session_get_stream_raw(session, 101);
7159 CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state);
7160 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
7164 /* stream 101 was already created as idle. */
7165 stream = nghttp2_session_open_stream(session, 101, NGHTTP2_STREAM_FLAG_NONE,
7168 CU_ASSERT(1 == stream->weight);
7169 CU_ASSERT(211 == stream->dep_prev->stream_id);
7171 stream = nghttp2_session_get_stream_raw(session, 211);
7173 CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state);
7174 CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight);
7202 /* Incoming stream does not affect the number of outgoing max
7270 /* Incoming stream does not affect the number of outgoing max
7273 /* In-flight outgoing stream */
7397 /* With RST_STREAM, stream is canceled and further DATA on that
7398 stream are not sent. */
7412 nghttp2_stream *stream;
7423 stream = open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING);
7426 stream->remote_window_size = 1 << 20;
7445 item = stream->item;
7479 nghttp2_stream *stream;
7509 /* Back 32KiB in stream window */
7526 stream = nghttp2_session_get_stream(session, 1);
7530 stream->remote_window_size =
7533 stream->remote_window_size);
7536 CU_ASSERT(-48 * 1024 == stream->remote_window_size);
7538 /* Back 48KiB to stream window */
7547 /* Back 16KiB in stream window */
7595 nghttp2_stream *stream;
7603 stream = open_sent_stream(session, 1);
7605 nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR);
7608 stream->local_window_size = NGHTTP2_MAX_PAYLOADLEN;
7621 /* Since this is the last frame, stream-level WINDOW_UPDATE is not
7630 /* Receive DATA for closed stream. They are still subject to under
7653 nghttp2_stream *stream;
7669 stream = open_sent_stream(session, 1);
7684 CU_ASSERT((int32_t)hd.length == stream->recv_window_size);
7686 CU_ASSERT(256 == stream->consumed_size);
7688 CU_ASSERT(357 == stream->recv_window_size);
7695 CU_ASSERT(258 == stream->consumed_size);
7697 CU_ASSERT(460 == stream->recv_window_size);
7702 CU_ASSERT(512 == stream->consumed_size);
7704 CU_ASSERT(714 == stream->recv_window_size);
7712 CU_ASSERT(513 == stream->consumed_size);
7714 CU_ASSERT(816 == stream->recv_window_size);
7719 CU_ASSERT(768 == stream->consumed_size);
7721 CU_ASSERT(1071 == stream->recv_window_size);
7729 CU_ASSERT(769 == stream->consumed_size);
7731 CU_ASSERT(1122 == stream->recv_window_size);
7736 CU_ASSERT(1024 == stream->consumed_size);
7738 CU_ASSERT(1428 == stream->recv_window_size);
7749 nghttp2_stream *stream;
7768 stream = nghttp2_session_get_stream(session, 1);
7769 CU_ASSERT(NGHTTP2_DATA == stream->item->frame.hd.type);
7771 stream->item->aux_data.data.data_prd.read_callback =
7775 stream-wise window */
7783 /* Sending data will fail (soft fail) and treated as stream error */
7803 nghttp2_stream *stream;
7810 stream =
7813 CU_ASSERT(stream != NULL);
7823 nghttp2_stream *stream;
7833 stream =
7838 /* Send bogus stream ID */
7848 stream->shut_flags |= NGHTTP2_SHUT_WR;
7856 stream->shut_flags = NGHTTP2_SHUT_NONE;
7915 nghttp2_stream *stream;
7920 stream = open_sent_stream(session, 1);
7967 /* Check stream flow control */
7968 stream->recv_window_size = 100;
7979 /* Now stream->recv_window_size = -50 */
7987 stream->recv_window_size += 50;
7988 /* Now stream->recv_window_size = 0 */
8079 nghttp2_stream *stream;
8098 stream = nghttp2_session_get_stream(session, 1);
8099 stream->remote_window_size = 1 << 20;
8117 CU_ASSERT(stream->shut_flags & NGHTTP2_SHUT_WR);
8379 /* Remove right most stream */
8420 /* Remove left most stream */
8460 /* Remove middle stream */
8624 /* Remove left most stream */
8661 /* Remove right most stream */
8700 /* Remove middle stream */
9522 nghttp2_stream *stream;
9540 /* stream 1 HEADERS; without END_STREAM flag set */
9549 stream = nghttp2_session_find_stream(session, 1);
9551 CU_ASSERT(NULL != stream);
9552 CU_ASSERT(1 == stream->stream_id);
9553 CU_ASSERT(NGHTTP2_STREAM_STATE_OPEN == nghttp2_stream_get_state(stream));
9557 /* stream 3 HEADERS; with END_STREAM flag set */
9567 stream = nghttp2_session_find_stream(session, 3);
9569 CU_ASSERT(NULL != stream);
9570 CU_ASSERT(3 == stream->stream_id);
9572 nghttp2_stream_get_state(stream));
9576 /* Respond to stream 1 */
9583 stream = nghttp2_session_find_stream(session, 1);
9586 nghttp2_stream_get_state(stream));
9588 /* Respond to stream 3 */
9595 stream = nghttp2_session_find_stream(session, 3);
9597 CU_ASSERT(NGHTTP2_STREAM_STATE_CLOSED == nghttp2_stream_get_state(stream));
9599 /* stream 5 HEADERS; with END_STREAM flag set */
9611 /* Push stream 2 associated to stream 5 */
9621 stream = nghttp2_session_find_stream(session, 2);
9624 nghttp2_stream_get_state(stream));
9626 /* Send response to push stream 2 with END_STREAM set */
9633 stream = nghttp2_session_find_stream(session, 2);
9635 /* At server, pushed stream object is not retained after closed */
9636 CU_ASSERT(NULL == stream);
9638 /* Push stream 4 associated to stream 5 */
9648 stream = nghttp2_session_find_stream(session, 4);
9651 nghttp2_stream_get_state(stream));
9653 /* Send response to push stream 4 without closing */
9662 stream = nghttp2_session_find_stream(session, 4);
9665 nghttp2_stream_get_state(stream));
9667 /* Create idle stream by PRIORITY frame */
9679 stream = nghttp2_session_find_stream(session, 7);
9681 CU_ASSERT(NGHTTP2_STREAM_STATE_IDLE == nghttp2_stream_get_state(stream));
9699 /* Receive PUSH_PROMISE 2 associated to stream 1 */
9708 stream = nghttp2_session_find_stream(session, 2);
9711 nghttp2_stream_get_state(stream));
9715 /* Receive push response for stream 2 without END_STREAM set */
9724 stream = nghttp2_session_find_stream(session, 2);
9727 nghttp2_stream_get_state(stream));
9777 nghttp2_stream *stream;
9785 stream = nghttp2_session_find_stream(session, 1);
9787 CU_ASSERT(NULL != stream);
9788 CU_ASSERT(1 == stream->stream_id);
9790 stream = nghttp2_session_find_stream(session, 0);
9792 CU_ASSERT(&session->root == stream);
9793 CU_ASSERT(0 == stream->stream_id);
9795 stream = nghttp2_session_find_stream(session, 2);
9797 CU_ASSERT(NULL == stream);
9862 /* server initiated stream is not counted to max concurrent limit */
9922 nghttp2_stream *stream;
9936 /* Detach middle stream */
9937 stream = nghttp2_session_get_stream_raw(session, 2);
9939 CU_ASSERT(session->idle_stream_head == stream->closed_prev);
9940 CU_ASSERT(session->idle_stream_tail == stream->closed_next);
9941 CU_ASSERT(stream == session->idle_stream_head->closed_next);
9942 CU_ASSERT(stream == session->idle_stream_tail->closed_prev);
9944 nghttp2_session_detach_idle_stream(session, stream);
9948 CU_ASSERT(NULL == stream->closed_prev);
9949 CU_ASSERT(NULL == stream->closed_next);
9956 /* Detach head stream */
9957 stream = session->idle_stream_head;
9959 nghttp2_session_detach_idle_stream(session, stream);
9967 /* Detach last stream */
9969 stream = session->idle_stream_head;
9971 nghttp2_session_detach_idle_stream(session, stream);
9985 /* Detach tail stream */
9987 stream = session->idle_stream_tail;
9989 nghttp2_session_detach_idle_stream(session, stream);
10005 nghttp2_stream *stream;
10020 stream = nghttp2_session_get_stream(session, stream_id);
10021 CU_ASSERT(nghttp2_stream_dep_find_ancestor(stream, &session->root));
10022 CU_ASSERT(nghttp2_stream_in_dep_tree(stream));
10263 nghttp2_stream *stream;
10278 stream = nghttp2_session_get_stream_raw(session, 1);
10280 CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state);
10281 CU_ASSERT(NULL == stream->closed_prev);
10282 CU_ASSERT(NULL == stream->closed_next);
10284 CU_ASSERT(session->idle_stream_head == stream);
10285 CU_ASSERT(session->idle_stream_tail == stream);
10289 CU_ASSERT(stream == opened_stream);
10290 CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state);
10303 nghttp2_stream *stream;
10322 stream = open_recv_stream2(session, 2, NGHTTP2_STREAM_RESERVED);
10326 CU_ASSERT(NGHTTP2_STREAM_CLOSING == stream->state);
10344 /* stream is not dangling, so assign NULL */
10345 stream = NULL;
10347 /* No RST_STREAM or GOAWAY is generated since stream should be in
10383 nghttp2_stream *stream;
10409 stream = nghttp2_session_get_stream(session, stream_id);
10411 CU_ASSERT(NULL == stream);
10425 stream = nghttp2_session_get_stream(session, stream_id);
10427 CU_ASSERT(NULL == stream);
10596 // Attempt to submit response or data to the stream being closed
10716 /* Cannot change stream which does not exist */
10724 /* It is an error to change priority of root stream (0) */
10728 /* Depends on the non-existing idle stream. This creates that idle
10729 stream. */
10776 nghttp2_stream *stream;
10801 stream = nghttp2_session_get_stream(session, 1);
10804 nghttp2_extpri_uint8_urgency(stream->extpri));
10805 CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri));
10807 /* Client can still update stream priority. */
10817 CU_ASSERT(2 == stream->extpri);
10819 /* Start to ignore client priority signal for this stream. */
10825 stream = nghttp2_session_get_stream(session, 1);
10828 nghttp2_extpri_uint8_urgency(stream->extpri));
10829 CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri));
10836 nghttp2_extpri_uint8_urgency(stream->extpri));
10837 CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri));
10872 /* If pri_spec->stream_id does not exist, and it is idle stream, it
10891 stream */
10902 /* It is an error to create root stream (0) as idle stream */
10906 /* It is an error to create non-idle stream */
10937 /* Check that idle stream is reduced when nghttp2_session_send() is
10959 /* Check that idle stream is reduced when nghttp2_session_mem_recv() is
11085 nghttp2_stream *stream;
11091 stream = open_sent_stream(session, 1);
11092 stream->recv_window_size = 4096;
11097 stream->local_window_size);
11098 CU_ASSERT(4096 == stream->recv_window_size);
11113 CU_ASSERT(32768 == stream->local_window_size);
11114 CU_ASSERT(-28672 == stream->recv_window_size);
11115 CU_ASSERT(32768 == stream->recv_reduction);
11126 CU_ASSERT(49152 == stream->local_window_size);
11127 CU_ASSERT(-12288 == stream->recv_window_size);
11128 CU_ASSERT(16384 == stream->recv_reduction);
11136 CU_ASSERT(65537 == stream->local_window_size);
11137 CU_ASSERT(4096 == stream->recv_window_size);
11138 CU_ASSERT(0 == stream->recv_reduction);
11203 WINDOW_UPDATE if necessary to increase stream-level window. */
11205 stream = open_sent_stream(session, 1);
11206 stream->recv_window_size = NGHTTP2_INITIAL_WINDOW_SIZE;
11210 CU_ASSERT(0 == stream->recv_window_size);
11212 /* This should submit WINDOW_UPDATE frame because stream-level
11217 CU_ASSERT(0 == stream->recv_window_size);
11267 nghttp2_stream *stream;
11314 stream = nghttp2_session_get_stream_raw(session, stream_id);
11316 CU_ASSERT(NULL == stream);
11340 stream = nghttp2_session_get_stream_raw(session, stream_id);
11342 CU_ASSERT(NULL == stream);
11417 nghttp2_stream *stream;
11458 /* Receiving stream 5 will erase stream 3 from closed stream list */
11464 stream = nghttp2_session_get_stream_raw(session, 3);
11466 CU_ASSERT(NULL == stream);
11469 NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS, receiving frame on stream
11538 stream 3 is ignored because we have no stream object for stream
11797 nghttp2_stream *anchor_stream, *stream;
11866 stream = nghttp2_session_get_stream(session, 1);
11868 CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state);
11869 CU_ASSERT(!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES));
11870 CU_ASSERT(anchor_stream == stream->dep_prev);
11872 /* Make sure that PRIORITY frame updates stream priority. */
11889 CU_ASSERT(anchor_stream == stream->dep_prev);
11904 CU_ASSERT(NGHTTP2_EXTPRI_DEFAULT_URGENCY == stream->extpri);
11959 stream = nghttp2_session_get_stream(session, 1);
11961 CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state);
11962 CU_ASSERT(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES);
12457 nghttp2_stream *stream;
12476 stream = open_sent_stream2(session, 1, NGHTTP2_STREAM_OPENING);
12487 CU_ASSERT(9000000000LL == stream->content_length);
12488 CU_ASSERT(200 == stream->status_code);
12510 stream = nghttp2_session_get_stream(session, 1);
12513 CU_ASSERT(9000000000LL == stream->content_length);
12637 /* After sending RST_STREAM, stream must be closed */
12665 /* After sending RST_STREAM, stream must be closed */
12693 /* After sending RST_STREAM, stream must be closed */
13018 /* Without on_invalid_frame_recv_callback, bad header causes stream
13066 /* make sure that we can reset stream from
13101 nghttp2_stream *stream;
13131 stream = open_sent_stream2(session, 3, NGHTTP2_STREAM_OPENING);
13132 stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_CONNECT;
13144 CU_ASSERT(-1 == stream->content_length);
13168 stream = nghttp2_session_get_stream(session, 1);
13170 CU_ASSERT(-1 == stream->content_length);
13171 CU_ASSERT((stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) > 0);
13185 nghttp2_stream *stream;
13207 stream = nghttp2_session_get_stream(session, 1);
13209 CU_ASSERT(NGHTTP2_HTTP_FLAG_METH_CONNECT == stream->http_flags);
13220 CU_ASSERT((NGHTTP2_HTTP_FLAG_METH_CONNECT & stream->http_flags) > 0);
13221 CU_ASSERT(-1 == stream->content_length);
13240 nghttp2_stream *stream;
13268 stream = nghttp2_session_get_stream(session, 2);
13269 CU_ASSERT(NULL != stream);
13285 CU_ASSERT(200 == stream->status_code);
13321 nghttp2_stream *stream;
13345 stream = nghttp2_session_get_stream(session, 1);
13347 CU_ASSERT(-1 == stream->content_length);