More listen overloads
This commit is contained in:
+30
-1
@@ -25,8 +25,37 @@ namespace uWS {
|
||||
other.http3Context = nullptr;
|
||||
}
|
||||
|
||||
H3App &&listen(int port, std::function<void(void *)> cb) {
|
||||
/* Host, port, callback */
|
||||
H3App &&listen(std::string host, int port, MoveOnlyFunction<void(us_listen_socket_t *)> &&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<void(us_listen_socket_t *)> &&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<void(us_listen_socket_t *)> &&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<void(us_listen_socket_t *)> &&handler) {
|
||||
http3Context->listen();
|
||||
//handler(http3Context ? http3Context->listen(nullptr, port, options) : nullptr);
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user