aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/vquic/ngtcp2.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/lib/vquic/ngtcp2.c b/lib/vquic/ngtcp2.c
index cdba49b75..aa4e7305b 100644
--- a/lib/vquic/ngtcp2.c
+++ b/lib/vquic/ngtcp2.c
@@ -43,7 +43,9 @@
#include "memdebug.h"
/* #define DEBUG_NGTCP2 */
+#ifdef CURLDEBUG
#define DEBUG_HTTP3
+#endif
#ifdef DEBUG_HTTP3
#define H3BUGF(x) x
#else
@@ -204,7 +206,7 @@ static int quic_add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
qs->qconn, level, (uint8_t *)(&crypto_data->buf[crypto_data->len] - len),
len);
if(rv) {
- fprintf(stderr, "write_client_handshake failed\n");
+ H3BUGF(fprintf(stderr, "write_client_handshake failed\n"));
}
assert(0 == rv);
@@ -597,12 +599,11 @@ CURLcode Curl_quic_connect(struct connectdata *conn,
ngtcp2_conn_get_local_transport_params(qs->qconn, &params);
nwrite = ngtcp2_encode_transport_params(
- paramsbuf, sizeof(paramsbuf), NGTCP2_TRANSPORT_PARAMS_TYPE_CLIENT_HELLO,
- &params);
+ paramsbuf, sizeof(paramsbuf), NGTCP2_TRANSPORT_PARAMS_TYPE_CLIENT_HELLO,
+ &params);
if(nwrite < 0) {
- fprintf(stderr, "ngtcp2_encode_transport_params: %s\n",
- ngtcp2_strerror((int)nwrite));
-
+ failf(data, "ngtcp2_encode_transport_params: %s\n",
+ ngtcp2_strerror((int)nwrite));
return CURLE_FAILED_INIT;
}
@@ -699,7 +700,7 @@ static int cb_h3_stream_close(nghttp3_conn *conn, int64_t stream_id,
(void)stream_id;
(void)app_error_code;
(void)user_data;
- fprintf(stderr, "cb_h3_stream_close CALLED\n");
+ H3BUGF(infof(data, "cb_h3_stream_close CALLED\n"));
stream->closed = TRUE;
Curl_expire(data, 0, EXPIRE_QUIC);
@@ -715,7 +716,7 @@ static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream_id,
struct Curl_easy *data = stream_user_data;
struct HTTP *stream = data->req.protop;
(void)conn;
- fprintf(stderr, "cb_h3_recv_data CALLED with %d bytes\n", buflen);
+ H3BUGF(infof(data, "cb_h3_recv_data CALLED with %d bytes\n", buflen));
/* TODO: this needs to be handled properly */
DEBUGASSERT(buflen <= stream->len);
@@ -749,7 +750,6 @@ static int cb_h3_deferred_consume(nghttp3_conn *conn, int64_t stream_id,
struct quicsocket *qs = user_data;
(void)conn;
(void)stream_user_data;
- fprintf(stderr, "cb_h3_deferred_consume CALLED\n");
ngtcp2_conn_extend_max_stream_offset(qs->qconn, stream_id, consumed);
ngtcp2_conn_extend_max_offset(qs->qconn, consumed);
@@ -818,8 +818,6 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
(void)flags;
(void)user_data;
- fprintf(stderr, "cb_h3_recv_header called!\n");
-
if(h3name.len == sizeof(":status") - 1 &&
!memcmp(":status", h3name.base, h3name.len)) {
int status = decode_status_code(h3val.base, h3val.len);
@@ -849,7 +847,6 @@ static int cb_h3_send_stop_sending(nghttp3_conn *conn, int64_t stream_id,
(void)app_error_code;
(void)user_data;
(void)stream_user_data;
- fprintf(stderr, "cb_h3_send_stop_sending CALLED\n");
return 0;
}
@@ -947,9 +944,6 @@ static ssize_t ngh3_stream_recv(struct connectdata *conn,
struct HTTP *stream = conn->data->req.protop;
struct quicsocket *qs = conn->quic;
- fprintf(stderr, "ngh3_stream_recv CALLED (easy %p, socket %d)\n",
- conn->data, sockfd);
-
if(!stream->memlen) {
/* remember where to store incoming data for this stream and how big the
buffer is */
@@ -1003,8 +997,9 @@ static int cb_h3_acked_stream_data(nghttp3_conn *conn, int64_t stream_id,
if(!data->set.postfields) {
stream->h3out->used -= datalen;
- fprintf(stderr, "cb_h3_acked_stream_data, %zd bytes, %zd left unacked\n",
- datalen, stream->h3out->used);
+ H3BUGF(infof(data,
+ "cb_h3_acked_stream_data, %zd bytes, %zd left unacked\n",
+ datalen, stream->h3out->used));
DEBUGASSERT(stream->h3out->used < H3_SEND_SIZE);
}
return 0;
@@ -1057,9 +1052,9 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
if(!stream->upload_left)
*pflags = NGHTTP3_DATA_FLAG_EOF;
}
- fprintf(stderr, "cb_h3_readfunction %zd bytes%s (at %zd unacked)\n",
- nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
- out->used);
+ H3BUGF(infof(data, "cb_h3_readfunction %zd bytes%s (at %zd unacked)\n",
+ nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
+ out->used));
}
if(stream->upload_done && !stream->upload_len &&
(stream->upload_left <= 0)) {
@@ -1333,7 +1328,8 @@ static ssize_t ngh3_stream_send(struct connectdata *conn,
sent = len;
}
else {
- fprintf(stderr, "ngh3_stream_send() wants to send %zd bytes\n", len);
+ H3BUGF(infof(conn->data, "ngh3_stream_send() wants to send %zd bytes\n",
+ len));
if(!stream->upload_len) {
stream->upload_mem = mem;
stream->upload_len = len;
@@ -1590,8 +1586,6 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
/* only for HTTP/3 transfers */
struct HTTP *stream = conn->data->req.protop;
struct quicsocket *qs = conn->quic;
- fprintf(stderr, "!!! Curl_quic_done_sending stream %zu\n",
- stream->stream3_id);
stream->upload_done = TRUE;
(void)nghttp3_conn_resume_stream(qs->h3conn, stream->stream3_id);
}