summaryrefslogtreecommitdiff
path: root/lib/http.h
diff options
context:
space:
mode:
authorNick Banks <nibanks@microsoft.com>2022-04-10 18:21:37 +0200
committerDaniel Stenberg <daniel@haxx.se>2022-04-10 18:23:04 +0200
commit37492ebbfa24ba4e700e6655b3dbc2bdd65c894a (patch)
treee0850c91ec4a66c654463d2ede04cd9c038288fd /lib/http.h
parent7befbe9ce97d6f9a1525a0fcbf5cbc5ad50546e3 (diff)
downloadcurl-37492ebbfa24ba4e700e6655b3dbc2bdd65c894a.tar.gz
msh3: add support for QUIC and HTTP/3 using msh3
Considered experimental, as the other HTTP/3 backends. Closes #8517
Diffstat (limited to 'lib/http.h')
-rw-r--r--lib/http.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/http.h b/lib/http.h
index 07e963dc4..0972261e6 100644
--- a/lib/http.h
+++ b/lib/http.h
@@ -38,6 +38,10 @@ typedef enum {
#include <nghttp2/nghttp2.h>
#endif
+#if defined(_WIN32) && defined(ENABLE_QUIC)
+#include <stdint.h>
+#endif
+
extern const struct Curl_handler Curl_handler_http;
#ifdef USE_SSL
@@ -163,6 +167,29 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data);
struct h3out; /* see ngtcp2 */
#endif
+#ifdef USE_MSH3
+#ifdef _WIN32
+#define msh3_lock CRITICAL_SECTION
+#define msh3_lock_initialize(lock) InitializeCriticalSection(lock)
+#define msh3_lock_uninitialize(lock) DeleteCriticalSection(lock)
+#define msh3_lock_acquire(lock) EnterCriticalSection(lock)
+#define msh3_lock_release(lock) LeaveCriticalSection(lock)
+#else /* !_WIN32 */
+#include <pthread.h>
+#define msh3_lock pthread_mutex_t
+#define msh3_lock_initialize(lock) { \
+ pthread_mutexattr_t attr; \
+ pthread_mutexattr_init(&attr); \
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); \
+ pthread_mutex_init(lock, &attr); \
+ pthread_mutexattr_destroy(&attr); \
+}
+#define msh3_lock_uninitialize(lock) pthread_mutex_destroy(lock)
+#define msh3_lock_acquire(lock) pthread_mutex_lock(lock)
+#define msh3_lock_release(lock) pthread_mutex_unlock(lock)
+#endif /* _WIN32 */
+#endif /* USE_MSH3 */
+
/****************************************************************************
* HTTP unique setup
***************************************************************************/
@@ -228,11 +255,13 @@ struct HTTP {
#endif
#ifdef ENABLE_QUIC
+#ifndef USE_MSH3
/*********** for HTTP/3 we store stream-local data here *************/
int64_t stream3_id; /* stream we are interested in */
bool firstheader; /* FALSE until headers arrive */
bool firstbody; /* FALSE until body arrives */
bool h3req; /* FALSE until request is issued */
+#endif
bool upload_done;
#endif
#ifdef USE_NGHTTP3
@@ -240,6 +269,21 @@ struct HTTP {
struct h3out *h3out; /* per-stream buffers for upload */
struct dynbuf overflow; /* excess data received during a single Curl_read */
#endif
+#ifdef USE_MSH3
+ struct MSH3_REQUEST *req;
+ msh3_lock recv_lock;
+ /* Receive Buffer (Headers and Data) */
+ uint8_t* recv_buf;
+ size_t recv_buf_alloc;
+ /* Receive Headers */
+ size_t recv_header_len;
+ bool recv_header_complete;
+ /* Receive Data */
+ size_t recv_data_len;
+ bool recv_data_complete;
+ /* General Receive Error */
+ CURLcode recv_error;
+#endif
};
#ifdef USE_NGHTTP2