Skip to content

Commit

Permalink
Fix fuzz builds
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Jul 21, 2024
1 parent 88b15f3 commit 9411cdd
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct TemplatedApp {
}

us_socket_context_remove_server_name(SSL, (struct us_socket_context_t *) httpContext, hostname_pattern.c_str());
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&missingServerName(MoveOnlyFunction<void(const char *hostname)> handler) {
Expand All @@ -132,7 +132,7 @@ struct TemplatedApp {
});
}

return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* Returns the SSL_CTX of this app, or nullptr. */
Expand All @@ -144,7 +144,7 @@ struct TemplatedApp {
BuilderPatternReturnType &&filter(MoveOnlyFunction<void(HttpResponse<SSL> *, int)> &&filterHandler) {
httpContext->filter(std::move(filterHandler));

return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* Publishes a message to all websocket contexts - conceptually as if publishing to the one single
Expand Down Expand Up @@ -265,7 +265,7 @@ struct TemplatedApp {
us_socket_context_close(SSL, (struct us_socket_context_t *) webSocketContext);
}

return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

template <typename UserData>
Expand Down Expand Up @@ -475,49 +475,49 @@ struct TemplatedApp {
if (httpContext) {
httpContext->onHttp("OPTIONS", pattern, std::move(handler));
}
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&del(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
if (httpContext) {
httpContext->onHttp("DELETE", pattern, std::move(handler));
}
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&patch(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
if (httpContext) {
httpContext->onHttp("PATCH", pattern, std::move(handler));
}
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&put(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
if (httpContext) {
httpContext->onHttp("PUT", pattern, std::move(handler));
}
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&head(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
if (httpContext) {
httpContext->onHttp("HEAD", pattern, std::move(handler));
}
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&connect(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
if (httpContext) {
httpContext->onHttp("CONNECT", pattern, std::move(handler));
}
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&trace(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
if (httpContext) {
httpContext->onHttp("TRACE", pattern, std::move(handler));
}
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* This one catches any method */
Expand All @@ -534,7 +534,7 @@ struct TemplatedApp {
return listen(port, std::move(handler));
}
handler(httpContext ? httpContext->listen(host.c_str(), port, 0) : nullptr);
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* Host, port, options, callback */
Expand All @@ -543,7 +543,7 @@ struct TemplatedApp {
return listen(port, options, std::move(handler));
}
handler(httpContext ? httpContext->listen(host.c_str(), port, options) : nullptr);
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* Port, callback */
Expand All @@ -555,19 +555,19 @@ struct TemplatedApp {
/* Port, options, callback */
BuilderPatternReturnType &&listen(int port, int options, MoveOnlyFunction<void(us_listen_socket_t *)> &&handler) {
handler(httpContext ? httpContext->listen(nullptr, port, options) : nullptr);
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* options, callback, path to unix domain socket */
BuilderPatternReturnType &&listen(int options, MoveOnlyFunction<void(us_listen_socket_t *)> &&handler, std::string path) {
handler(httpContext ? httpContext->listen(path.c_str(), options) : nullptr);
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* callback, path to unix domain socket */
BuilderPatternReturnType &&listen(MoveOnlyFunction<void(us_listen_socket_t *)> &&handler, std::string path) {
handler(httpContext ? httpContext->listen(path.c_str(), 0) : nullptr);
return std::move(*this);
return std::move(static_cast<BuilderPatternReturnType &&>(*this));
}

/* Register event handler for accepted FD. Can be used together with adoptSocket. */
Expand Down

0 comments on commit 9411cdd

Please sign in to comment.