More h3 wrap up

This commit is contained in:
Alex Hultman
2022-05-15 04:23:47 +02:00
parent 9f9ca6936a
commit 7da868a57d
6 changed files with 73 additions and 32 deletions
+17 -1
View File
@@ -1,6 +1,22 @@
extern "C" {
#include "quic.h"
}
namespace uWS {
struct Http3Request {
// really the same thing as HttpRequest with same rules
std::string_view getHeader(std::string_view key) {
for (int i = 0, more = 1; more; i++) {
char *name, *value;
int name_length, value_length;
if (more = us_quic_socket_context_get_header(nullptr, i, &name, &name_length, &value, &value_length)) {
if (name_length == key.length() && !memcmp(name, key.data(), key.length())) {
return {value, value_length};
}
}
return {nullptr, 0};
}
}
};
}