Add some Http3 skeleton

This commit is contained in:
Alex Hultman
2022-05-02 23:32:55 +02:00
parent e4c6fbf8de
commit b46a456393
7 changed files with 88 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
#include "App.h"
#include "Http3Response.h"
#include "Http3Request.h"
#include "Http3Context.h"
namespace uWS {
struct QuicApp {
Http3Context *http3Context;
QuicApp(SocketContextOptions options = {}) {
/* Create the http3 context */
http3Context = Http3Context::create((us_loop_t *)Loop::get(), options);
}
QuicApp &listen(int port, std::function<void(void *)> cb) {
return *this;
}
QuicApp &get(std::string path, std::function<void(Http3Response *, Http3Request *)> cb) {
// http3Context->onHttp, internally using httprouter
return *this;
}
void run() {
}
};
}
+17
View File
@@ -0,0 +1,17 @@
namespace uWS {
struct Http3Context {
static Http3Context *create(us_loop_t *loop, us_socket_context_options_t options) {
return nullptr;
// call init here after setting the ext to Http3ContextData
}
void init() {
// set all callbacks here
}
void onHttp() {
// modifies the router we own as part of Http3ContextData, used in callbacks set in init
}
};
}
View File
+6
View File
@@ -0,0 +1,6 @@
namespace uWS {
struct Http3Request {
// really the same thing as HttpRequest with same rules
};
}
+11
View File
@@ -0,0 +1,11 @@
namespace uWS {
struct Http3Response {
// has a quic stream
void end(std::string_view data) {
}
};
}