diff --git a/src/Http3App.h b/src/Http3App.h index 23c3c2a..534edb7 100644 --- a/src/Http3App.h +++ b/src/Http3App.h @@ -25,8 +25,37 @@ namespace uWS { other.http3Context = nullptr; } - H3App &&listen(int port, std::function cb) { + /* Host, port, callback */ + H3App &&listen(std::string host, int port, MoveOnlyFunction &&handler) { + if (!host.length()) { + return listen(port, std::move(handler)); + } http3Context->listen(); + //handler(httpContext ? httpContext->listen(host.c_str(), port, 0) : nullptr); + return std::move(*this); + } + + /* Host, port, options, callback */ + H3App &&listen(std::string host, int port, int options, MoveOnlyFunction &&handler) { + if (!host.length()) { + return listen(port, options, std::move(handler)); + } + http3Context->listen(); + //handler(httpContext ? httpContext->listen(host.c_str(), port, options) : nullptr); + return std::move(*this); + } + + /* Port, callback */ + H3App &&listen(int port, MoveOnlyFunction &&handler) { + http3Context->listen(); + //handler(httpContext ? httpContext->listen(nullptr, port, 0) : nullptr); + return std::move(*this); + } + + /* Port, options, callback */ + H3App &&listen(int port, int options, MoveOnlyFunction &&handler) { + http3Context->listen(); + //handler(http3Context ? http3Context->listen(nullptr, port, options) : nullptr); return std::move(*this); } diff --git a/src/Http3Request.h b/src/Http3Request.h index 0cae22d..70b016b 100644 --- a/src/Http3Request.h +++ b/src/Http3Request.h @@ -12,7 +12,7 @@ namespace uWS { 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 {value, (size_t) value_length}; } } }