Skip to content

Commit

Permalink
-updated hot_teacup, now http request has access to fastcgi params
Browse files Browse the repository at this point in the history
  • Loading branch information
kamchatka-volcano committed Dec 9, 2024
1 parent 5b64a52 commit 87d4fa9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/requestproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
#include <asyncgi/http/request_view.h>
#include <asyncgi/types.h>
#include <fcgi_responder/request.h>
#include <unordered_map>

namespace asyncgi::detail {

RequestProxy::RequestProxy(const fcgi::Request& request)
: fcgiRequest_{fastcgi::detail::RequestView{request}}
, httpRequest_{[this]
{
, httpRequest_{
[this]
{
auto fcgiParams = std::unordered_map<std::string_view, std::string_view>{};
for (const auto& [key, value] : fcgiRequest_.params())
fcgiParams.emplace(key, value);

return http::Request{http::RequestView{
fcgiRequest_.hasParam("REQUEST_METHOD") ? fcgiRequest_.param("REQUEST_METHOD")
: std::string_view{},
Expand All @@ -20,7 +26,8 @@ RequestProxy::RequestProxy(const fcgi::Request& request)
fcgiRequest_.hasParam("HTTP_COOKIE") ? fcgiRequest_.param("HTTP_COOKIE") : std::string_view{},
fcgiRequest_.hasParam("CONTENT_TYPE") ? fcgiRequest_.param("CONTENT_TYPE")
: std::string_view{},
fcgiRequest_.stdIn()}};
fcgiRequest_.stdIn(),
std::move(fcgiParams)}};
}}
{
}
Expand Down

0 comments on commit 87d4fa9

Please sign in to comment.