aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure.ac1
-rw-r--r--lib/dynbuf.h2
-rw-r--r--lib/vquic/quiche.c43
3 files changed, 44 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 768f52f4c..aa79cfa42 100755
--- a/configure.ac
+++ b/configure.ac
@@ -3814,6 +3814,7 @@ if test X"$want_quiche" != Xno; then
QUICHE_ENABLED=1
AC_DEFINE(USE_QUICHE, 1, [if quiche is in use])
AC_SUBST(USE_QUICHE, [1])
+ AC_CHECK_FUNCS([quiche_conn_set_qlog_fd])
CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_QUICHE"
export CURL_LIBRARY_PATH
AC_MSG_NOTICE([Added $DIR_QUICHE to CURL_LIBRARY_PATH]),
diff --git a/lib/dynbuf.h b/lib/dynbuf.h
index 427269c68..b4932b535 100644
--- a/lib/dynbuf.h
+++ b/lib/dynbuf.h
@@ -58,5 +58,5 @@ size_t Curl_dyn_len(const struct dynbuf *s);
#define DYN_RTSP_REQ_HEADER (64*1024)
#define DYN_TRAILERS (64*1024)
#define DYN_PROXY_CONNECT_HEADERS 16384
-
+#define DYN_QLOG_NAME 1024
#endif
diff --git a/lib/vquic/quiche.c b/lib/vquic/quiche.c
index c40e5e937..38c0a0a3f 100644
--- a/lib/vquic/quiche.c
+++ b/lib/vquic/quiche.c
@@ -34,6 +34,10 @@
#include "multiif.h"
#include "connect.h"
#include "strerror.h"
+#include "dynbuf.h"
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -64,7 +68,6 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
static Curl_recv h3_stream_recv;
static Curl_send h3_stream_send;
-
static int quiche_getsock(struct connectdata *conn, curl_socket_t *socks)
{
struct SingleRequest *k = &conn->data->req;
@@ -199,6 +202,44 @@ CURLcode Curl_quic_connect(struct connectdata *conn, curl_socket_t sockfd,
return CURLE_OUT_OF_MEMORY;
}
+ /* Known to not work on Windows */
+#if !defined(WIN32) && defined(HAVE_QUICHE_CONN_SET_QLOG_FD)
+#ifdef O_BINARY
+#define QLOGMODE O_WRONLY|O_CREAT|O_BINARY
+#else
+#define QLOGMODE O_WRONLY|O_CREAT
+#endif
+ {
+ const char *qlog_dir = getenv("QLOGDIR");
+ if(qlog_dir) {
+ struct dynbuf fname;
+ unsigned int i;
+ Curl_dyn_init(&fname, DYN_QLOG_NAME);
+ result = Curl_dyn_add(&fname, qlog_dir);
+ if(!result)
+ result = Curl_dyn_add(&fname, "/");
+ for(i = 0; (i < sizeof(qs->scid)) && !result; i++) {
+ char hex[3];
+ msnprintf(hex, 3, "%02x", qs->scid[i]);
+ result = Curl_dyn_add(&fname, hex);
+ }
+ if(!result)
+ result = Curl_dyn_add(&fname, ".qlog");
+
+ if(!result) {
+ int qlogfd = open(Curl_dyn_ptr(&fname), QLOGMODE,
+ data->set.new_file_perms);
+ if(qlogfd != -1)
+ quiche_conn_set_qlog_fd(qs->conn, qlogfd,
+ "qlog title", "curl qlog");
+ }
+ Curl_dyn_free(&fname);
+ if(result)
+ return result;
+ }
+ }
+#endif
+
result = flush_egress(conn, sockfd, qs);
if(result)
return result;