Lines Matching refs:cf

163 static CURLcode cf_flush_egress(struct Curl_cfilter *cf,
199 static void check_resumes(struct Curl_cfilter *cf, in check_resumes() argument
202 struct cf_quiche_ctx *ctx = cf->ctx; in check_resumes()
213 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] unblock", stream->id); in check_resumes()
219 static CURLcode h3_data_setup(struct Curl_cfilter *cf, in h3_data_setup() argument
222 struct cf_quiche_ctx *ctx = cf->ctx; in h3_data_setup()
245 static void h3_data_done(struct Curl_cfilter *cf, struct Curl_easy *data) in h3_data_done() argument
247 struct cf_quiche_ctx *ctx = cf->ctx; in h3_data_done()
251 (void)cf; in h3_data_done()
253 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] easy handle is done", stream->id); in h3_data_done()
263 result = cf_flush_egress(cf, data); in h3_data_done()
265 CURL_TRC_CF(data, cf, "data_done, flush egress -> %d", result); in h3_data_done()
271 static void h3_drain_stream(struct Curl_cfilter *cf, in h3_drain_stream() argument
274 struct cf_quiche_ctx *ctx = cf->ctx; in h3_drain_stream()
278 (void)cf; in h3_drain_stream()
288 static struct Curl_easy *get_stream_easy(struct Curl_cfilter *cf, in get_stream_easy() argument
293 struct cf_quiche_ctx *ctx = cf->ctx; in get_stream_easy()
296 (void)cf; in get_stream_easy()
320 static void cf_quiche_expire_conn_closed(struct Curl_cfilter *cf, in cf_quiche_expire_conn_closed() argument
326 CURL_TRC_CF(data, cf, "conn closed, expire all transfers"); in cf_quiche_expire_conn_closed()
331 CURL_TRC_CF(sdata, cf, "conn closed, expire transfer"); in cf_quiche_expire_conn_closed()
341 static CURLcode write_resp_raw(struct Curl_cfilter *cf, in write_resp_raw() argument
345 struct cf_quiche_ctx *ctx = cf->ctx; in write_resp_raw()
350 (void)cf; in write_resp_raw()
367 struct Curl_cfilter *cf; member
376 struct cf_quiche_ctx *ctx = x->cf->ctx; in cb_each_header()
384 CURL_TRC_CF(x->data, x->cf, "[%" FMT_PRIu64 "] status: %.*s", in cb_each_header()
386 result = write_resp_raw(x->cf, x->data, "HTTP/3 ", sizeof("HTTP/3 ") - 1); in cb_each_header()
388 result = write_resp_raw(x->cf, x->data, value, value_len); in cb_each_header()
390 result = write_resp_raw(x->cf, x->data, " \r\n", 3); in cb_each_header()
393 CURL_TRC_CF(x->data, x->cf, "[%" FMT_PRIu64 "] header: %.*s: %.*s", in cb_each_header()
396 result = write_resp_raw(x->cf, x->data, name, name_len); in cb_each_header()
398 result = write_resp_raw(x->cf, x->data, ": ", 2); in cb_each_header()
400 result = write_resp_raw(x->cf, x->data, value, value_len); in cb_each_header()
402 result = write_resp_raw(x->cf, x->data, "\r\n", 2); in cb_each_header()
405 CURL_TRC_CF(x->data, x->cf, "[%"FMT_PRIu64"] on header error %d", in cb_each_header()
416 struct cf_quiche_ctx *ctx = x->cf->ctx; in stream_resp_read()
437 static CURLcode cf_recv_body(struct Curl_cfilter *cf, in cf_recv_body() argument
440 struct cf_quiche_ctx *ctx = cf->ctx; in cf_recv_body()
450 result = write_resp_raw(cf, data, "\r\n", 2); in cf_recv_body()
456 cb_ctx.cf = cf; in cf_recv_body()
462 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] recv_body error %zd", in cf_recv_body()
469 streamclose(cf->conn, "Reset of stream"); in cf_recv_body()
497 static CURLcode h3_process_event(struct Curl_cfilter *cf, in h3_process_event() argument
511 cb_ctx.cf = cf; in h3_process_event()
519 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] <- [HEADERS]", stream->id); in h3_process_event()
524 result = cf_recv_body(cf, data); in h3_process_event()
529 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] RESET", stream->id); in h3_process_event()
533 streamclose(cf->conn, "Reset of stream"); in h3_process_event()
537 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] CLOSED", stream->id); in h3_process_event()
539 result = write_resp_raw(cf, data, "\r\n", 2); in h3_process_event()
545 streamclose(cf->conn, "End of stream"); in h3_process_event()
549 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] <- [GOAWAY]", stream->id); in h3_process_event()
553 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] recv, unhandled event %d", in h3_process_event()
560 static CURLcode cf_poll_events(struct Curl_cfilter *cf, in cf_poll_events() argument
563 struct cf_quiche_ctx *ctx = cf->ctx; in cf_poll_events()
576 CURL_TRC_CF(data, cf, "error poll: %"FMT_PRId64, stream3_id); in cf_poll_events()
580 sdata = get_stream_easy(cf, data, stream3_id, &stream); in cf_poll_events()
582 CURL_TRC_CF(data, cf, "discard event %s for unknown [%"FMT_PRId64"]", in cf_poll_events()
586 result = h3_process_event(cf, sdata, stream, ev); in cf_poll_events()
587 h3_drain_stream(cf, sdata); in cf_poll_events()
589 CURL_TRC_CF(data, cf, "error processing event %s " in cf_poll_events()
607 struct Curl_cfilter *cf; member
618 struct cf_quiche_ctx *ctx = r->cf->ctx; in recv_pkt()
635 CURL_TRC_CF(r->data, r->cf, "ingress, connection is draining"); in recv_pkt()
639 CURL_TRC_CF(r->data, r->cf, "ingress, connection is closed"); in recv_pkt()
642 CURL_TRC_CF(r->data, r->cf, "ingress, quiche is DONE"); in recv_pkt()
659 CURL_TRC_CF(r->data, r->cf, "ingress, quiche only read %zd/%zu bytes", in recv_pkt()
666 static CURLcode cf_process_ingress(struct Curl_cfilter *cf, in cf_process_ingress() argument
669 struct cf_quiche_ctx *ctx = cf->ctx; in cf_process_ingress()
674 result = Curl_vquic_tls_before_recv(&ctx->tls, cf, data); in cf_process_ingress()
678 rctx.cf = cf; in cf_process_ingress()
682 result = vquic_recv_packets(cf, data, &ctx->q, 1000, recv_pkt, &rctx); in cf_process_ingress()
689 check_resumes(cf, data); in cf_process_ingress()
691 return cf_poll_events(cf, data); in cf_process_ingress()
695 struct Curl_cfilter *cf; member
705 struct cf_quiche_ctx *ctx = x->cf->ctx; in read_pkt_to_send()
727 static CURLcode cf_flush_egress(struct Curl_cfilter *cf, in cf_flush_egress() argument
730 struct cf_quiche_ctx *ctx = cf->ctx; in cf_flush_egress()
748 cf_quiche_expire_conn_closed(cf, data); in cf_flush_egress()
753 result = vquic_flush(cf, data, &ctx->q); in cf_flush_egress()
762 readx.cf = cf; in cf_flush_egress()
775 result = vquic_send(cf, data, &ctx->q, gsolen); in cf_flush_egress()
788 result = vquic_send(cf, data, &ctx->q, gsolen); in cf_flush_egress()
809 static ssize_t recv_closed_stream(struct Curl_cfilter *cf, in recv_closed_stream() argument
813 struct cf_quiche_ctx *ctx = cf->ctx; in recv_closed_stream()
822 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] cf_recv, was reset -> %d", in recv_closed_stream()
832 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] cf_recv, closed incomplete" in recv_closed_stream()
842 static ssize_t cf_quiche_recv(struct Curl_cfilter *cf, struct Curl_easy *data, in cf_quiche_recv() argument
845 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_recv()
860 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] read recvbuf(len=%zu) " in cf_quiche_recv()
866 if(cf_process_ingress(cf, data)) { in cf_quiche_recv()
867 CURL_TRC_CF(data, cf, "cf_recv, error on ingress"); in cf_quiche_recv()
877 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] read recvbuf(len=%zu) " in cf_quiche_recv()
885 h3_drain_stream(cf, data); in cf_quiche_recv()
889 nread = recv_closed_stream(cf, data, err); in cf_quiche_recv()
903 result = cf_flush_egress(cf, data); in cf_quiche_recv()
905 CURL_TRC_CF(data, cf, "cf_recv, flush egress failed"); in cf_quiche_recv()
911 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] cf_recv(total=%" in cf_quiche_recv()
917 static ssize_t cf_quiche_send_body(struct Curl_cfilter *cf, in cf_quiche_send_body() argument
923 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_send_body()
932 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] send_body(len=%zu) " in cf_quiche_send_body()
940 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] send_body(len=%zu) " in cf_quiche_send_body()
946 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] send_body(len=%zu) " in cf_quiche_send_body()
952 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] send_body(len=%zu) " in cf_quiche_send_body()
960 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] send body(len=%zu, " in cf_quiche_send_body()
972 static ssize_t h3_open_stream(struct Curl_cfilter *cf, in h3_open_stream() argument
977 struct cf_quiche_ctx *ctx = cf->ctx; in h3_open_stream()
986 *err = h3_data_setup(cf, data); in h3_open_stream()
1039 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] blocked", stream->id); in h3_open_stream()
1046 CURL_TRC_CF(data, cf, "send_request(%s) -> %" FMT_PRIu64, in h3_open_stream()
1076 bwritten = cf_quiche_send_body(cf, data, stream, in h3_open_stream()
1093 static ssize_t cf_quiche_send(struct Curl_cfilter *cf, struct Curl_easy *data, in cf_quiche_send() argument
1097 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_send()
1104 *err = cf_process_ingress(cf, data); in cf_quiche_send()
1111 nwritten = h3_open_stream(cf, data, buf, len, eos, err); in cf_quiche_send()
1126 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] discarding data" in cf_quiche_send()
1132 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] send_body(len=%zu) " in cf_quiche_send()
1139 nwritten = cf_quiche_send_body(cf, data, stream, buf, len, eos, err); in cf_quiche_send()
1143 result = cf_flush_egress(cf, data); in cf_quiche_send()
1148 CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] cf_send(len=%zu) -> %zd, %d", in cf_quiche_send()
1153 static bool stream_is_writeable(struct Curl_cfilter *cf, in stream_is_writeable() argument
1156 struct cf_quiche_ctx *ctx = cf->ctx; in stream_is_writeable()
1163 static void cf_quiche_adjust_pollset(struct Curl_cfilter *cf, in cf_quiche_adjust_pollset() argument
1167 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_adjust_pollset()
1181 (stream->quic_flow_blocked || !stream_is_writeable(cf, data)); in cf_quiche_adjust_pollset()
1194 static bool cf_quiche_data_pending(struct Curl_cfilter *cf, in cf_quiche_data_pending() argument
1197 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_data_pending()
1199 (void)cf; in cf_quiche_data_pending()
1203 static CURLcode h3_data_pause(struct Curl_cfilter *cf, in h3_data_pause() argument
1210 h3_drain_stream(cf, data); in h3_data_pause()
1216 static CURLcode cf_quiche_data_event(struct Curl_cfilter *cf, in cf_quiche_data_event() argument
1220 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_data_event()
1229 result = h3_data_pause(cf, data, (arg1 != 0)); in cf_quiche_data_event()
1232 h3_data_done(cf, data); in cf_quiche_data_event()
1235 h3_data_done(cf, data); in cf_quiche_data_event()
1245 sent = cf_quiche_send(cf, data, body, 0, TRUE, &result); in cf_quiche_data_event()
1246 CURL_TRC_CF(data, cf, "[%"FMT_PRIu64"] DONE_SEND -> %zd, %d", in cf_quiche_data_event()
1254 result = cf_flush_egress(cf, data); in cf_quiche_data_event()
1256 CURL_TRC_CF(data, cf, "data idle, flush egress -> %d", result); in cf_quiche_data_event()
1266 static CURLcode cf_quiche_ctx_open(struct Curl_cfilter *cf, in cf_quiche_ctx_open() argument
1269 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_ctx_open()
1281 result = Curl_ssl_peer_init(&ctx->peer, cf, TRNSPRT_QUIC); in cf_quiche_ctx_open()
1313 result = Curl_vquic_tls_init(&ctx->tls, cf, data, &ctx->peer, in cf_quiche_ctx_open()
1316 NULL, NULL, cf); in cf_quiche_ctx_open()
1324 Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd, &sockaddr, NULL); in cf_quiche_ctx_open()
1354 result = cf_flush_egress(cf, data); in cf_quiche_ctx_open()
1369 CURL_TRC_CF(data, cf, "Sent QUIC client Initial, ALPN: %s", in cf_quiche_ctx_open()
1376 static CURLcode cf_quiche_verify_peer(struct Curl_cfilter *cf, in cf_quiche_verify_peer() argument
1379 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_verify_peer()
1381 cf->conn->bits.multiplex = TRUE; /* at least potentially multiplexed */ in cf_quiche_verify_peer()
1382 cf->conn->httpversion = 30; in cf_quiche_verify_peer()
1384 return Curl_vquic_tls_verify_peer(&ctx->tls, cf, data, &ctx->peer); in cf_quiche_verify_peer()
1387 static CURLcode cf_quiche_connect(struct Curl_cfilter *cf, in cf_quiche_connect() argument
1391 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_connect()
1394 if(cf->connected) { in cf_quiche_connect()
1400 if(!cf->next->connected) { in cf_quiche_connect()
1401 result = Curl_conn_cf_connect(cf->next, data, blocking, done); in cf_quiche_connect()
1410 result = cf_quiche_ctx_open(cf, data); in cf_quiche_connect()
1414 result = cf_flush_egress(cf, data); in cf_quiche_connect()
1419 result = cf_process_ingress(cf, data); in cf_quiche_connect()
1423 result = cf_flush_egress(cf, data); in cf_quiche_connect()
1429 CURL_TRC_CF(data, cf, "handshake complete after %dms", in cf_quiche_connect()
1431 result = cf_quiche_verify_peer(cf, data); in cf_quiche_connect()
1433 CURL_TRC_CF(data, cf, "peer verified"); in cf_quiche_connect()
1446 cf->connected = TRUE; in cf_quiche_connect()
1447 cf->conn->alpn = CURL_HTTP_VERSION_3; in cf_quiche_connect()
1449 connkeep(cf->conn, "HTTP/3 default"); in cf_quiche_connect()
1465 Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip); in cf_quiche_connect()
1473 static CURLcode cf_quiche_shutdown(struct Curl_cfilter *cf, in cf_quiche_shutdown() argument
1476 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_shutdown()
1479 if(cf->shutdown || !ctx || !ctx->qconn) { in cf_quiche_shutdown()
1492 CURL_TRC_CF(data, cf, "error %d adding shutdown packet, " in cf_quiche_shutdown()
1500 CURL_TRC_CF(data, cf, "shutdown, flushing sendbuf"); in cf_quiche_shutdown()
1501 result = cf_flush_egress(cf, data); in cf_quiche_shutdown()
1509 CURL_TRC_CF(data, cf, "shutdown completely sent off, done"); in cf_quiche_shutdown()
1513 CURL_TRC_CF(data, cf, "shutdown sending blocked"); in cf_quiche_shutdown()
1520 static void cf_quiche_close(struct Curl_cfilter *cf, struct Curl_easy *data) in cf_quiche_close() argument
1522 if(cf->ctx) { in cf_quiche_close()
1524 (void)cf_quiche_shutdown(cf, data, &done); in cf_quiche_close()
1525 cf_quiche_ctx_close(cf->ctx); in cf_quiche_close()
1529 static void cf_quiche_destroy(struct Curl_cfilter *cf, struct Curl_easy *data) in cf_quiche_destroy() argument
1532 if(cf->ctx) { in cf_quiche_destroy()
1533 cf_quiche_ctx_free(cf->ctx); in cf_quiche_destroy()
1534 cf->ctx = NULL; in cf_quiche_destroy()
1538 static CURLcode cf_quiche_query(struct Curl_cfilter *cf, in cf_quiche_query() argument
1542 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_query()
1546 curl_uint64_t max_streams = CONN_INUSE(cf->conn); in cf_quiche_query()
1551 CURL_TRC_CF(data, cf, "query conn[%" FMT_OFF_T "]: " in cf_quiche_query()
1553 cf->conn->connection_id, *pres1, CONN_INUSE(cf->conn)); in cf_quiche_query()
1572 if(cf->connected) in cf_quiche_query()
1579 return cf->next ? in cf_quiche_query()
1580 cf->next->cft->query(cf->next, data, query, pres1, pres2) : in cf_quiche_query()
1584 static bool cf_quiche_conn_is_alive(struct Curl_cfilter *cf, in cf_quiche_conn_is_alive() argument
1588 struct cf_quiche_ctx *ctx = cf->ctx; in cf_quiche_conn_is_alive()
1597 CURL_TRC_CF(data, cf, "connection was closed due to idle timeout"); in cf_quiche_conn_is_alive()
1599 CURL_TRC_CF(data, cf, "connection is closed"); in cf_quiche_conn_is_alive()
1603 if(!cf->next || !cf->next->cft->is_alive(cf->next, data, input_pending)) in cf_quiche_conn_is_alive()
1611 if(cf_process_ingress(cf, data)) in cf_quiche_conn_is_alive()
1646 struct Curl_cfilter *cf = NULL, *udp_cf = NULL; in Curl_cf_quiche_create() local
1658 result = Curl_cf_create(&cf, &Curl_cft_http3, ctx); in Curl_cf_quiche_create()
1666 udp_cf->conn = cf->conn; in Curl_cf_quiche_create()
1667 udp_cf->sockindex = cf->sockindex; in Curl_cf_quiche_create()
1668 cf->next = udp_cf; in Curl_cf_quiche_create()
1671 *pcf = (!result) ? cf : NULL; in Curl_cf_quiche_create()
1674 Curl_conn_cf_discard_sub(cf, udp_cf, data, TRUE); in Curl_cf_quiche_create()
1675 Curl_safefree(cf); in Curl_cf_quiche_create()
1686 struct Curl_cfilter *cf = conn ? conn->cfilter[sockindex] : NULL; in Curl_conn_is_quiche() local
1689 for(; cf; cf = cf->next) { in Curl_conn_is_quiche()
1690 if(cf->cft == &Curl_cft_http3) in Curl_conn_is_quiche()
1692 if(cf->cft->flags & CF_TYPE_IP_CONNECT) in Curl_conn_is_quiche()