Lines Matching refs:stream
150 static void h3_stream_hash_free(void *stream);
210 static void h3_stream_ctx_free(struct h3_stream_ctx *stream) in h3_stream_ctx_free() argument
212 Curl_bufq_free(&stream->sendbuf); in h3_stream_ctx_free()
213 Curl_h1_req_parse_free(&stream->h1); in h3_stream_ctx_free()
214 free(stream); in h3_stream_ctx_free()
217 static void h3_stream_hash_free(void *stream) in h3_stream_hash_free() argument
219 DEBUGASSERT(stream); in h3_stream_hash_free()
220 h3_stream_ctx_free((struct h3_stream_ctx *)stream); in h3_stream_hash_free()
227 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in h3_data_setup() local
232 if(stream) in h3_data_setup()
235 stream = calloc(1, sizeof(*stream)); in h3_data_setup()
236 if(!stream) in h3_data_setup()
239 stream->id = -1; in h3_data_setup()
241 Curl_bufq_initp(&stream->sendbuf, &ctx->stream_bufcp, in h3_data_setup()
243 stream->sendbuf_len_in_flight = 0; in h3_data_setup()
244 Curl_h1_req_parse_init(&stream->h1, H1_PARSE_DEFAULT_MAX_LINE_LEN); in h3_data_setup()
246 if(!Curl_hash_offt_set(&ctx->streams, data->mid, stream)) { in h3_data_setup()
247 h3_stream_ctx_free(stream); in h3_data_setup()
256 struct h3_stream_ctx *stream) in cf_ngtcp2_stream_close() argument
260 DEBUGASSERT(stream); in cf_ngtcp2_stream_close()
261 if(!stream->closed && ctx->qconn && ctx->h3conn) { in cf_ngtcp2_stream_close()
264 nghttp3_conn_set_stream_user_data(ctx->h3conn, stream->id, NULL); in cf_ngtcp2_stream_close()
265 ngtcp2_conn_set_stream_user_data(ctx->qconn, stream->id, NULL); in cf_ngtcp2_stream_close()
266 stream->closed = TRUE; in cf_ngtcp2_stream_close()
267 (void)ngtcp2_conn_shutdown_stream(ctx->qconn, 0, stream->id, in cf_ngtcp2_stream_close()
272 stream->id, result); in cf_ngtcp2_stream_close()
279 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in h3_data_done() local
281 if(stream) { in h3_data_done()
283 stream->id); in h3_data_done()
284 cf_ngtcp2_stream_close(cf, data, stream); in h3_data_done()
295 struct h3_stream_ctx *stream; in get_stream_easy() local
298 stream = H3_STREAM_CTX(ctx, data); in get_stream_easy()
299 if(stream && stream->id == stream_id) { in get_stream_easy()
300 *pstream = stream; in get_stream_easy()
310 stream = H3_STREAM_CTX(ctx, sdata); in get_stream_easy()
311 if(stream && stream->id == stream_id) { in get_stream_easy()
312 *pstream = stream; in get_stream_easy()
325 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in h3_drain_stream() local
330 if(stream && stream->upload_left && !stream->send_closed) in h3_drain_stream()
522 struct h3_stream_ctx *stream = H3_STREAM_CTX_ID(ctx, stream_id); in cb_recv_stream_data() local
523 if(data && stream) { in cb_recv_stream_data()
526 stream_id, stream->reset, stream->closed); in cb_recv_stream_data()
663 struct h3_stream_ctx *stream; in cb_extend_max_stream_data() local
673 s_data = get_stream_easy(cf, data, stream_id, &stream); in cb_extend_max_stream_data()
674 if(s_data && stream && stream->quic_flow_blocked) { in cb_extend_max_stream_data()
676 stream->quic_flow_blocked = FALSE; in cb_extend_max_stream_data()
856 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_ngtcp2_adjust_pollset() local
863 s_exhaust = want_send && stream && stream->id >= 0 && in cf_ngtcp2_adjust_pollset()
864 stream->quic_flow_blocked; in cf_ngtcp2_adjust_pollset()
882 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cb_h3_stream_close() local
887 if(!stream) in cb_h3_stream_close()
890 stream->closed = TRUE; in cb_h3_stream_close()
891 stream->error3 = (curl_uint64_t)app_error_code; in cb_h3_stream_close()
892 if(stream->error3 != NGHTTP3_H3_NO_ERROR) { in cb_h3_stream_close()
893 stream->reset = TRUE; in cb_h3_stream_close()
894 stream->send_closed = TRUE; in cb_h3_stream_close()
896 stream->id, stream->error3); in cb_h3_stream_close()
899 CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] CLOSED", stream->id); in cb_h3_stream_close()
907 struct h3_stream_ctx *stream, in h3_xfer_write_resp_hd() argument
912 if(!stream->xfer_result) { in h3_xfer_write_resp_hd()
913 stream->xfer_result = Curl_xfer_write_resp_hd(data, buf, blen, eos); in h3_xfer_write_resp_hd()
914 if(stream->xfer_result) in h3_xfer_write_resp_hd()
916 "bytes of headers", stream->id, stream->xfer_result, blen); in h3_xfer_write_resp_hd()
922 struct h3_stream_ctx *stream, in h3_xfer_write_resp() argument
927 if(!stream->xfer_result) { in h3_xfer_write_resp()
928 stream->xfer_result = Curl_xfer_write_resp(data, buf, blen, eos); in h3_xfer_write_resp()
930 if(stream->xfer_result) { in h3_xfer_write_resp()
932 "of data", stream->id, stream->xfer_result, blen); in h3_xfer_write_resp()
944 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cb_h3_recv_data() local
949 if(!stream) in cb_h3_recv_data()
952 h3_xfer_write_resp(cf, data, stream, (char *)buf, blen, FALSE); in cb_h3_recv_data()
955 stream->id, blen); in cb_h3_recv_data()
956 ngtcp2_conn_extend_max_stream_offset(ctx->qconn, stream->id, blen); in cb_h3_recv_data()
959 CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] DATA len=%zu", stream->id, blen); in cb_h3_recv_data()
986 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cb_h3_end_headers() local
992 if(!stream) in cb_h3_end_headers()
995 h3_xfer_write_resp_hd(cf, data, stream, STRCONST("\r\n"), stream->closed); in cb_h3_end_headers()
998 stream_id, stream->status_code); in cb_h3_end_headers()
999 if(stream->status_code / 100 != 1) { in cb_h3_end_headers()
1000 stream->resp_hds_complete = TRUE; in cb_h3_end_headers()
1017 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cb_h3_recv_header() local
1026 if(!stream) in cb_h3_recv_header()
1031 result = Curl_http_decode_status(&stream->status_code, in cb_h3_recv_header()
1043 h3_xfer_write_resp_hd(cf, data, stream, Curl_dyn_ptr(&ctx->scratch), in cb_h3_recv_header()
1067 h3_xfer_write_resp_hd(cf, data, stream, Curl_dyn_ptr(&ctx->scratch), in cb_h3_recv_header()
1193 struct h3_stream_ctx *stream, in recv_closed_stream() argument
1199 if(stream->reset) { in recv_closed_stream()
1200 failf(data, "HTTP/3 stream %" FMT_PRId64 " reset by server", stream->id); in recv_closed_stream()
1204 else if(!stream->resp_hds_complete) { in recv_closed_stream()
1208 stream->id); in recv_closed_stream()
1224 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_ngtcp2_recv() local
1241 if(!stream || ctx->shutdown_started) { in cf_ngtcp2_recv()
1252 if(stream->xfer_result) { in cf_ngtcp2_recv()
1253 CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] xfer write failed", stream->id); in cf_ngtcp2_recv()
1254 cf_ngtcp2_stream_close(cf, data, stream); in cf_ngtcp2_recv()
1255 *err = stream->xfer_result; in cf_ngtcp2_recv()
1259 else if(stream->closed) { in cf_ngtcp2_recv()
1260 nread = recv_closed_stream(cf, data, stream, err); in cf_ngtcp2_recv()
1279 stream ? stream->id : -1, blen, nread, *err); in cf_ngtcp2_recv()
1291 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cb_h3_acked_req_body() local
1295 if(!stream) in cb_h3_acked_req_body()
1300 if(datalen >= (uint64_t)stream->sendbuf_len_in_flight) in cb_h3_acked_req_body()
1301 skiplen = stream->sendbuf_len_in_flight; in cb_h3_acked_req_body()
1304 Curl_bufq_skip(&stream->sendbuf, skiplen); in cb_h3_acked_req_body()
1305 stream->sendbuf_len_in_flight -= skiplen; in cb_h3_acked_req_body()
1308 if(stream->sendbuf_len_in_flight < Curl_bufq_len(&stream->sendbuf)) { in cb_h3_acked_req_body()
1326 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cb_h3_read_req_body() local
1335 if(!stream) in cb_h3_read_req_body()
1344 if(stream->sendbuf_len_in_flight < Curl_bufq_len(&stream->sendbuf)) { in cb_h3_read_req_body()
1347 Curl_bufq_peek_at(&stream->sendbuf, in cb_h3_read_req_body()
1348 stream->sendbuf_len_in_flight, in cb_h3_read_req_body()
1351 stream->sendbuf_len_in_flight += vec[nvecs].len; in cb_h3_read_req_body()
1358 if(nwritten > 0 && stream->upload_left != -1) in cb_h3_read_req_body()
1359 stream->upload_left -= nwritten; in cb_h3_read_req_body()
1363 if(stream->upload_left == 0) { in cb_h3_read_req_body()
1365 stream->send_closed = TRUE; in cb_h3_read_req_body()
1370 stream->id); in cb_h3_read_req_body()
1376 stream->id, (int)nvecs, in cb_h3_read_req_body()
1378 nwritten, Curl_bufq_len(&stream->sendbuf), in cb_h3_read_req_body()
1379 stream->upload_left); in cb_h3_read_req_body()
1393 struct h3_stream_ctx *stream = NULL; in h3_stream_open() local
1409 stream = H3_STREAM_CTX(ctx, data); in h3_stream_open()
1410 DEBUGASSERT(stream); in h3_stream_open()
1411 if(!stream) { in h3_stream_open()
1416 nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, err); in h3_stream_open()
1419 if(!stream->h1.done) { in h3_stream_open()
1423 DEBUGASSERT(stream->h1.req); in h3_stream_open()
1425 *err = Curl_http_req_to_h2(&h2_headers, stream->h1.req, data); in h3_stream_open()
1431 Curl_h1_req_parse_free(&stream->h1); in h3_stream_open()
1457 stream->id = (curl_int64_t)sid; in h3_stream_open()
1467 stream->upload_left = data->state.infilesize; in h3_stream_open()
1470 stream->upload_left = -1; /* unknown */ in h3_stream_open()
1474 stream->upload_left = 0; /* no request body */ in h3_stream_open()
1478 stream->send_closed = (stream->upload_left == 0); in h3_stream_open()
1479 if(!stream->send_closed) { in h3_stream_open()
1484 rc = nghttp3_conn_submit_request(ctx->h3conn, stream->id, in h3_stream_open()
1490 "connection is closing", stream->id); in h3_stream_open()
1494 "%d (%s)", stream->id, rc, nghttp3_strerror(rc)); in h3_stream_open()
1504 stream->id, data->state.url); in h3_stream_open()
1506 infof(data, "[HTTP/3] [%" FMT_PRId64 "] [%.*s: %.*s]", stream->id, in h3_stream_open()
1523 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_ngtcp2_send() local
1543 if(!stream || stream->id < 0) { in cf_ngtcp2_send()
1555 stream = H3_STREAM_CTX(ctx, data); in cf_ngtcp2_send()
1557 else if(stream->xfer_result) { in cf_ngtcp2_send()
1558 CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] xfer write failed", stream->id); in cf_ngtcp2_send()
1559 cf_ngtcp2_stream_close(cf, data, stream); in cf_ngtcp2_send()
1560 *err = stream->xfer_result; in cf_ngtcp2_send()
1564 else if(stream->closed) { in cf_ngtcp2_send()
1565 if(stream->resp_hds_complete) { in cf_ngtcp2_send()
1572 "on closed stream with response", stream->id); in cf_ngtcp2_send()
1578 "-> stream closed", stream->id, len); in cf_ngtcp2_send()
1590 sent = Curl_bufq_write(&stream->sendbuf, buf, len, err); in cf_ngtcp2_send()
1593 stream->id, len, sent, *err); in cf_ngtcp2_send()
1598 (void)nghttp3_conn_resume_stream(ctx->h3conn, stream->id); in cf_ngtcp2_send()
1614 stream ? stream->id : -1, len, sent, *err); in cf_ngtcp2_send()
1742 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, x->data); in read_pkt_to_send() local
1747 DEBUGASSERT(stream); in read_pkt_to_send()
1748 if(stream) in read_pkt_to_send()
1749 stream->quic_flow_blocked = TRUE; in read_pkt_to_send()
1956 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_ngtcp2_data_event() local
1957 if(stream && !stream->send_closed) { in cf_ngtcp2_data_event()
1958 stream->send_closed = TRUE; in cf_ngtcp2_data_event()
1959 stream->upload_left = Curl_bufq_len(&stream->sendbuf) - in cf_ngtcp2_data_event()
1960 stream->sendbuf_len_in_flight; in cf_ngtcp2_data_event()
1961 (void)nghttp3_conn_resume_stream(ctx->h3conn, stream->id); in cf_ngtcp2_data_event()
1966 struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_ngtcp2_data_event() local
1968 if(stream && !stream->closed) { in cf_ngtcp2_data_event()