Hook up h3 router and callbacks

This commit is contained in:
Alex Hultman
2022-05-15 14:39:34 +02:00
parent 7da868a57d
commit 73c9262f34
9 changed files with 205 additions and 88 deletions
+8 -4
View File
@@ -1,3 +1,7 @@
extern "C" {
#include "quic.h"
}
namespace uWS {
/* Is a quic stream */
@@ -14,16 +18,16 @@ namespace uWS {
// if not already written status then write status
/* Write headers */
us_quic_socket_context_set_header(context, 0, ":status", 7, "200", 3);
us_quic_socket_context_set_header(nullptr, 0, (char *) ":status", 7, "200", 3);
//us_quic_socket_context_set_header(context, 1, "content-length", 14, "11", 2);
//us_quic_socket_context_set_header(context, 2, "content-type", 12, "text/html", 9);
us_quic_socket_context_send_headers(context, this, 1, 1);
us_quic_socket_context_send_headers(nullptr, (us_quic_stream_t *) this, 1, 1);
/* Write body and shutdown (unknown if content-length must be present?) */
us_quic_stream_write(this, "Hello quic!", 11);
us_quic_stream_write((us_quic_stream_t *) this, (char *) data.data(), data.length());
/* Every request has its own stream, so we conceptually serve requests like in HTTP 1.0 */
us_quic_stream_shutdown(this);
us_quic_stream_shutdown((us_quic_stream_t *) this);
}
};