Files
bun.sh/packages/bun-uws/src/Http3Request.h
Jarred Sumner a2ddfe6913 Bring uSockets & uWebSockets forks into Bun's repository (#4372)
* Move uWebSockets and uSockets forks into Bun's repository

* Update Makefile

* Update settings.json

* Update libuwsockets.cpp

* Remove backends we won't be using

* Update bindings.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-28 08:38:30 -07:00

22 lines
665 B
C++

extern "C" {
#include "quic.h"
}
namespace uWS {
struct Http3Request {
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 == (int) key.length() && !memcmp(name, key.data(), key.length())) {
return {value, (size_t) value_length};
}
}
}
return {nullptr, 0};
}
};
}