Lines Matching defs:stream

66 /* The pool keeps spares around and half of a full stream windows
68 * The benefit of the pool is that stream buffer to not keep
138 * All about the H3 internals of a stream
141 int64_t id; /* HTTP/3 protocol stream identifier */
144 uint64_t error3; /* HTTP/3 stream error code */
146 bool closed; /* TRUE on stream close */
147 bool reset; /* TRUE on stream reset */
148 bool send_closed; /* stream is locally closed */
150 bool resp_got_header; /* TRUE when h3 stream has recvd some HEADER */
151 BIT(quic_flow_blocked); /* stream is blocked by QUIC flow control */
165 struct stream_ctx *stream;
170 stream = H3_STREAM_CTX(sdata);
171 if(stream && stream->quic_flow_blocked) {
172 stream->quic_flow_blocked = FALSE;
174 CURL_TRC_CF(data, cf, "[%"PRId64"] unblock", stream->id);
184 struct stream_ctx *stream = H3_STREAM_CTX(data);
186 if(stream)
189 stream = calloc(1, sizeof(*stream));
190 if(!stream)
193 H3_STREAM_LCTX(data) = stream;
194 stream->id = -1;
195 Curl_bufq_initp(&stream->recvbuf, &ctx->stream_bufcp,
197 Curl_h1_req_parse_init(&stream->h1, H1_PARSE_DEFAULT_MAX_LINE_LEN);
204 struct stream_ctx *stream = H3_STREAM_CTX(data);
207 if(stream) {
208 CURL_TRC_CF(data, cf, "[%"PRId64"] easy handle is done", stream->id);
209 if(ctx->qconn && !stream->closed) {
210 quiche_conn_stream_shutdown(ctx->qconn, stream->id,
212 if(!stream->send_closed) {
213 quiche_conn_stream_shutdown(ctx->qconn, stream->id,
215 stream->send_closed = TRUE;
217 stream->closed = TRUE;
219 Curl_bufq_free(&stream->recvbuf);
220 Curl_h1_req_parse_free(&stream->h1);
221 free(stream);
229 struct stream_ctx *stream = H3_STREAM_CTX(data);
234 if(stream && !stream->send_closed && stream->upload_left)
272 struct stream_ctx *stream = H3_STREAM_CTX(data);
277 if(!stream)
279 nwritten = Curl_bufq_write(&stream->recvbuf, mem, memlen, &result);
302 struct stream_ctx *stream = H3_STREAM_CTX(x->data);
305 if(!stream)
310 stream->id, (int)value_len, value);
319 stream->id, (int)name_len, name,
331 stream->id, result);
342 struct stream_ctx *stream = H3_STREAM_CTX(x->data);
345 if(!stream) {
350 nread = quiche_h3_recv_body(ctx->h3c, ctx->qconn, stream->id,
365 struct stream_ctx *stream = H3_STREAM_CTX(data);
370 if(!stream)
373 if(!stream->resp_hds_complete) {
377 stream->resp_hds_complete = TRUE;
382 nwritten = Curl_bufq_slurp(&stream->recvbuf,
387 stream->id, nwritten);
388 failf(data, "Error %d in HTTP/3 response body for stream[%"PRId64"]",
389 result, stream->id);
390 stream->closed = TRUE;
391 stream->reset = TRUE;
392 stream->send_closed = TRUE;
393 streamclose(cf->conn, "Reset of stream");
426 struct stream_ctx *stream = H3_STREAM_CTX(data);
431 if(!stream)
433 DEBUGASSERT(stream3_id == stream->id);
436 stream->resp_got_header = TRUE;
441 failf(data, "Error %d in HTTP/3 response header for stream[%"PRId64"]",
449 if(!stream->closed) {
456 stream->closed = TRUE;
457 stream->reset = TRUE;
458 stream->send_closed = TRUE;
459 streamclose(cf->conn, "Reset of stream");
464 if(!stream->resp_hds_complete) {
468 stream->resp_hds_complete = TRUE;
470 stream->closed = TRUE;
471 streamclose(cf->conn, "End of stream");
490 struct stream_ctx *stream = H3_STREAM_CTX(data);
503 stream? stream->id : -1, stream3_id);
511 stream? stream->id : -1, cf_ev_name(ev), stream3_id);
519 stream? stream->id : -1, cf_ev_name(ev),
728 struct stream_ctx *stream = H3_STREAM_CTX(data);
731 DEBUGASSERT(stream);
732 if(stream->reset) {
734 "HTTP/3 stream %" PRId64 " reset by server", stream->id);
735 *err = stream->resp_got_header? CURLE_PARTIAL_FILE : CURLE_HTTP3;
737 stream->id, *err);
739 else if(!stream->resp_got_header) {
741 "HTTP/3 stream %" PRId64 " was closed cleanly, but before getting"
743 stream->id);
747 " -> %d", stream->id, *err);
760 struct stream_ctx *stream = H3_STREAM_CTX(data);
766 if(!stream) {
771 if(!Curl_bufq_is_empty(&stream->recvbuf)) {
772 nread = Curl_bufq_read(&stream->recvbuf,
775 "-> %zd, %d", stream->id, len, nread, *err);
788 if(nread < 0 && !Curl_bufq_is_empty(&stream->recvbuf)) {
789 nread = Curl_bufq_read(&stream->recvbuf,
792 "-> %zd, %d", stream->id, len, nread, *err);
798 if(stream->closed)
802 if(stream->closed) {
827 stream->id, ctx->data_recvd, nread, *err);
841 struct stream_ctx *stream = H3_STREAM_CTX(data);
848 if(!stream) {
853 stream = H3_STREAM_CTX(data);
854 DEBUGASSERT(stream);
859 DEBUGASSERT(stream);
860 nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, err);
863 if(!stream->h1.done) {
867 DEBUGASSERT(stream->h1.req);
869 *err = Curl_http_req_to_h2(&h2_headers, stream->h1.req, data);
875 Curl_h1_req_parse_free(&stream->h1);
899 stream->upload_left = data->state.infilesize;
902 stream->upload_left = -1; /* unknown */
905 stream->upload_left = 0; /* no request body */
909 if(stream->upload_left == 0)
910 stream->send_closed = TRUE;
913 stream->send_closed);
918 CURL_TRC_CF(data, cf, "[%"PRId64"] blocked", stream->id);
919 stream->quic_flow_blocked = TRUE;
933 DEBUGASSERT(stream->id == -1);
935 stream->id = stream3_id;
936 stream->closed = FALSE;
937 stream->reset = FALSE;
940 infof(data, "[HTTP/3] [%" PRId64 "] OPENED stream for %s",
941 stream->id, data->state.url);
943 infof(data, "[HTTP/3] [%" PRId64 "] [%.*s: %.*s]", stream->id,
959 struct stream_ctx *stream = H3_STREAM_CTX(data);
971 if(!stream || stream->id < 0) {
975 stream = H3_STREAM_CTX(data);
977 else if(stream->closed) {
978 if(stream->resp_hds_complete) {
979 /* sending request body on a stream that has been closed by the
983 * of reading the full request body just closed the stream after
988 "on closed stream with response", stream->id);
994 "-> stream closed", stream->id, len);
1000 bool eof = (stream->upload_left >= 0 &&
1001 (curl_off_t)len >= stream->upload_left);
1002 nwritten = quiche_h3_send_body(ctx->h3c, ctx->qconn, stream->id,
1007 if(!quiche_conn_stream_writable(ctx->qconn, stream->id, len)) {
1009 "-> window exhausted", stream->id, len);
1010 stream->quic_flow_blocked = TRUE;
1018 "-> invalid stream state", stream->id, len);
1025 "-> exceeds size", stream->id, len);
1032 "-> quiche err %zd", stream->id, len, nwritten);
1039 if(stream->upload_left > 0) {
1040 stream->upload_left = (nwritten < stream->upload_left)?
1041 (stream->upload_left - nwritten) : 0;
1043 if(stream->upload_left == 0)
1044 stream->send_closed = TRUE;
1048 stream->id, len, stream->upload_left, nwritten);
1060 stream? stream->id : -1, len, nwritten, *err);
1068 struct stream_ctx *stream = H3_STREAM_CTX(data);
1070 return stream && (quiche_conn_stream_writable(ctx->qconn,
1071 (uint64_t)stream->id, 1) > 0);
1086 struct stream_ctx *stream = H3_STREAM_CTX(data);
1091 s_exhaust = want_send && stream && stream->id >= 0 &&
1092 (stream->quic_flow_blocked || !stream_is_writeable(cf, data));
1108 const struct stream_ctx *stream = H3_STREAM_CTX(data);
1110 return stream && !Curl_bufq_is_empty(&stream->recvbuf);
1147 struct stream_ctx *stream = H3_STREAM_CTX(data);
1148 if(stream && !stream->send_closed) {
1152 stream->send_closed = TRUE;
1153 stream->upload_left = 0;
1157 stream->id, sent, result);
1162 struct stream_ctx *stream = H3_STREAM_CTX(data);
1163 if(stream && !stream->closed) {