Add some Http3 skeleton
This commit is contained in:
@@ -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() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace uWS {
|
||||
|
||||
struct Http3Request {
|
||||
// really the same thing as HttpRequest with same rules
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace uWS {
|
||||
|
||||
struct Http3Response {
|
||||
// has a quic stream
|
||||
|
||||
void end(std::string_view data) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user