Lines Matching refs:stream

64 /* A stream window is the maximum amount we need to buffer for
70 /* The pool keeps spares around and half of a full stream windows
72 * The benefit of the pool is that stream buffer to not keep
211 /* QUIC stream (not necessarily H3) */
292 size_t max_stream_window; /* max flow window for one stream */
358 CURL_TRC_CF(data, cf, "[%" PRId64 "] rejecting additional remote stream",
369 CURL_TRC_CF(data, cf, "[%" PRId64 "] accepted new remote uni stream",
375 " stream", stream_id);
477 * All about the H3 internals of a stream
487 uint64_t error3; /* HTTP/3 stream error code */
492 bool closed; /* TRUE on stream close */
493 bool reset; /* TRUE on stream reset */
494 bool send_closed; /* stream is local closed */
495 BIT(quic_flow_blocked); /* stream is blocked by QUIC flow control */
509 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
516 if(stream)
519 stream = calloc(1, sizeof(*stream));
520 if(!stream)
523 stream->s.id = -1;
525 Curl_bufq_initp(&stream->sendbuf, &ctx->stream_bufcp,
527 stream->sendbuf_len_in_flight = 0;
530 Curl_bufq_initp(&stream->recvbuf, &ctx->stream_bufcp,
532 stream->recv_buf_nonflow = 0;
533 Curl_h1_req_parse_init(&stream->h1, H1_PARSE_DEFAULT_MAX_LINE_LEN);
535 H3_STREAM_LCTX(data) = stream;
542 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
545 if(stream) {
546 CURL_TRC_CF(data, cf, "[%"PRId64"] easy handle is done", stream->s.id);
547 if(ctx->h3.conn && !stream->closed) {
548 nghttp3_conn_shutdown_stream_read(ctx->h3.conn, stream->s.id);
549 nghttp3_conn_close_stream(ctx->h3.conn, stream->s.id,
551 nghttp3_conn_set_stream_user_data(ctx->h3.conn, stream->s.id, NULL);
552 stream->closed = TRUE;
555 cf_osslq_stream_cleanup(&stream->s);
556 Curl_bufq_free(&stream->sendbuf);
557 Curl_bufq_free(&stream->recvbuf);
558 Curl_h1_req_parse_free(&stream->h1);
559 free(stream);
569 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
572 if(stream && stream->s.id == stream_id) {
573 return &stream->s;
588 stream = H3_STREAM_CTX(sdata);
589 return stream? &stream->s : NULL;
599 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
604 if(stream && stream->upload_left && !stream->send_closed)
630 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
635 if(!stream)
638 stream->closed = TRUE;
639 stream->error3 = app_error_code;
640 if(stream->error3 != NGHTTP3_H3_NO_ERROR) {
641 stream->reset = TRUE;
642 stream->send_closed = TRUE;
644 stream->s.id, stream->error3);
647 CURL_TRC_CF(data, cf, "[%" PRId64 "] CLOSED", stream->s.id);
663 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
668 if(!stream) {
671 nwritten = Curl_bufq_write(&stream->recvbuf, mem, memlen, &result);
677 stream->recv_buf_nonflow += (size_t)nwritten;
694 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
700 if(!stream)
706 stream->s.id, buflen, result);
709 stream->download_recvd += (curl_off_t)buflen;
711 stream->s.id, buflen, stream->download_recvd);
722 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
726 if(stream)
728 stream->s.id, consumed);
741 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
750 if(!stream)
757 result = Curl_http_decode_status(&stream->status_code,
762 stream->status_code);
799 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
806 if(!stream)
815 stream_id, stream->status_code);
816 if(stream->status_code / 100 != 1) {
817 stream->resp_hds_complete = TRUE;
829 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
833 if(!stream || !stream->s.ssl)
837 cf_osslq_stream_close(&stream->s);
846 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
850 if(stream && stream->s.ssl) {
853 rv = !SSL_stream_reset(stream->s.ssl, &args, sizeof(args));
870 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
879 if(!stream)
888 if(stream->sendbuf_len_in_flight < Curl_bufq_len(&stream->sendbuf)) {
891 Curl_bufq_peek_at(&stream->sendbuf,
892 stream->sendbuf_len_in_flight,
895 stream->sendbuf_len_in_flight += vec[nvecs].len;
902 if(nwritten > 0 && stream->upload_left != -1)
903 stream->upload_left -= nwritten;
907 if(stream->upload_left == 0) {
909 stream->send_closed = TRUE;
914 stream->s.id);
921 stream->s.id, (int)nvecs,
923 nwritten, Curl_bufq_len(&stream->sendbuf),
924 stream->upload_left);
934 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
938 if(!stream)
943 if(datalen >= (uint64_t)stream->sendbuf_len_in_flight)
944 skiplen = stream->sendbuf_len_in_flight;
947 Curl_bufq_skip(&stream->sendbuf, skiplen);
948 stream->sendbuf_len_in_flight -= skiplen;
951 if(!stream->sendbuf_len_in_flight) {
1247 CURL_TRC_CF(data, cf, "[%" PRId64 "] close nghttp3 stream -> %d",
1301 struct h3_stream_ctx *stream;
1306 stream = H3_STREAM_CTX(sdata);
1307 if(stream && !stream->closed &&
1308 !Curl_bufq_is_full(&stream->recvbuf)) {
1309 result = cf_osslq_stream_recv(&stream->s, cf, sdata);
1328 struct h3_stream_ctx *stream;
1333 stream = H3_STREAM_CTX(sdata);
1334 if(stream && stream->s.ssl && stream->s.send_blocked &&
1335 !SSL_want_write(stream->s.ssl)) {
1336 nghttp3_conn_unblock_stream(ctx->h3.conn, stream->s.id);
1337 stream->s.send_blocked = FALSE;
1379 /* Get the stream for this data */
1382 failf(data, "nghttp3_conn_writev_stream gave unknown stream %" PRId64,
1387 /* Now write the data to the stream's SSL*, it may not all fit! */
1393 /* Without stream->s.ssl, we closed that already, so
1448 /* wrote everything and H3 indicates end of stream */
1449 CURL_TRC_CF(data, cf, "[%" PRId64 "] closing QUIC stream", s->id);
1645 struct h3_stream_ctx *stream = NULL;
1660 stream = H3_STREAM_CTX(data);
1661 DEBUGASSERT(stream);
1662 if(!stream) {
1667 nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, err);
1670 if(!stream->h1.done) {
1674 DEBUGASSERT(stream->h1.req);
1676 *err = Curl_http_req_to_h2(&h2_headers, stream->h1.req, data);
1682 Curl_h1_req_parse_free(&stream->h1);
1701 DEBUGASSERT(stream->s.id == -1);
1702 *err = cf_osslq_stream_open(&stream->s, ctx->tls.ssl, 0,
1717 stream->upload_left = data->state.infilesize;
1720 stream->upload_left = -1; /* unknown */
1724 stream->upload_left = 0; /* no request body */
1728 stream->send_closed = (stream->upload_left == 0);
1729 if(!stream->send_closed) {
1734 rc = nghttp3_conn_submit_request(ctx->h3.conn, stream->s.id,
1740 "connection is closing", stream->s.id);
1744 stream->s.id, rc, nghttp3_strerror(rc));
1753 infof(data, "[HTTP/3] [%" PRId64 "] OPENED stream for %s",
1754 stream->s.id, data->state.url);
1756 infof(data, "[HTTP/3] [%" PRId64 "] [%.*s: %.*s]", stream->s.id,
1772 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
1797 if(!stream || stream->s.id < 0) {
1800 CURL_TRC_CF(data, cf, "failed to open stream -> %d", *err);
1803 stream = H3_STREAM_CTX(data);
1805 else if(stream->upload_blocked_len) {
1808 DEBUGASSERT(len >= stream->upload_blocked_len);
1809 if(len < stream->upload_blocked_len) {
1817 nwritten = (ssize_t)stream->upload_blocked_len;
1818 stream->upload_blocked_len = 0;
1820 else if(stream->closed) {
1821 if(stream->resp_hds_complete) {
1822 /* Server decided to close the stream after having sent us a final
1828 "on closed stream with response", stream->s.id);
1834 "-> stream closed", stream->s.id, len);
1840 nwritten = Curl_bufq_write(&stream->sendbuf, buf, len, err);
1843 stream->s.id, len, nwritten, *err);
1848 (void)nghttp3_conn_resume_stream(ctx->h3.conn, stream->s.id);
1857 if(stream && nwritten > 0 && stream->sendbuf_len_in_flight) {
1861 stream->upload_blocked_len = nwritten;
1863 "%zu bytes in flight -> EGAIN", stream->s.id, len,
1864 stream->sendbuf_len_in_flight);
1872 stream? stream->s.id : -1, len, nwritten, *err);
1879 struct h3_stream_ctx *stream,
1885 if(stream->reset) {
1887 "HTTP/3 stream %" PRId64 " reset by server", stream->s.id);
1888 *err = stream->resp_hds_complete? CURLE_PARTIAL_FILE : CURLE_HTTP3;
1891 else if(!stream->resp_hds_complete) {
1893 "HTTP/3 stream %" PRId64 " was closed cleanly, but before getting"
1895 stream->s.id);
1910 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
1923 if(!stream) {
1928 if(!Curl_bufq_is_empty(&stream->recvbuf)) {
1929 nread = Curl_bufq_read(&stream->recvbuf,
1933 "-> %zd, %d", stream->s.id, len, nread, *err);
1946 if(nread < 0 && !Curl_bufq_is_empty(&stream->recvbuf)) {
1947 nread = Curl_bufq_read(&stream->recvbuf,
1951 "-> %zd, %d", stream->s.id, len, nread, *err);
1960 if(stream->closed) {
1961 nread = recv_closed_stream(cf, data, stream, err);
1981 stream? stream->s.id : -1, len, nread, *err);
1993 const struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
1995 return stream && !Curl_bufq_is_empty(&stream->recvbuf);
2022 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
2023 if(stream && !stream->send_closed) {
2024 stream->send_closed = TRUE;
2025 stream->upload_left = Curl_bufq_len(&stream->sendbuf);
2026 (void)nghttp3_conn_resume_stream(ctx->h3.conn, stream->s.id);
2031 struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
2033 if(stream && !stream->closed) {