diff --git a/include/opendht/dht_proxy_server.h b/include/opendht/dht_proxy_server.h index 98c1f1b181bd04d6290694a8116744172a906034..4d8d00b665b84cf027647436fdcbc3e5f66a8fc3 100644 --- a/include/opendht/dht_proxy_server.h +++ b/include/opendht/dht_proxy_server.h @@ -52,28 +52,6 @@ namespace restinio { struct custom_http_methods_t; } -using RestRouter = restinio::router::express_router_t<>; - -struct RestRouterTraitsTls : public restinio::default_tls_traits_t -{ - using timer_manager_t = restinio::asio_timer_manager_t; - using http_methods_mapper_t = restinio::custom_http_methods_t; - using logger_t = restinio::opendht_logger_t; - using request_handler_t = RestRouter; - using connection_state_listener_t = http::ConnectionListener; -}; -struct RestRouterTraits : public restinio::default_traits_t -{ - using timer_manager_t = restinio::asio_timer_manager_t; - using http_methods_mapper_t = restinio::custom_http_methods_t; - using logger_t = restinio::opendht_logger_t; - using request_handler_t = RestRouter; - using connection_state_listener_t = http::ConnectionListener; -}; -using RequestStatus = restinio::request_handling_status_t; -using ResponseByParts = restinio::chunked_output_t; -using ResponseByPartsBuilder = restinio::response_builder_t<ResponseByParts>; - namespace Json { class Value; } @@ -82,6 +60,13 @@ namespace dht { class DhtRunner; +using RestRouter = restinio::router::express_router_t<>; +struct RestRouterTraitsTls; +struct RestRouterTraits; +using RequestStatus = restinio::request_handling_status_t; +using ResponseByParts = restinio::chunked_output_t; +using ResponseByPartsBuilder = restinio::response_builder_t<ResponseByParts>; + /** * Describes the REST API */ diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index 5e96321ec4765c490fdff023b37ee6dc11c92b69..0a4cc687fb2799d85d384bd1056f9bac205a1628 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -46,6 +46,27 @@ constexpr char RESP_MSG_PUT_FAILED[] = "{\"err\":\"Put failed\"}"; constexpr const std::chrono::minutes PRINT_STATS_PERIOD {2}; +struct RestRouterTraitsTls : public restinio::default_tls_traits_t +{ + using timer_manager_t = restinio::asio_timer_manager_t; +#ifdef OPENDHT_PROXY_HTTP_PARSER_FORK + using http_methods_mapper_t = restinio::custom_http_methods_t; +#endif + using logger_t = restinio::opendht_logger_t; + using request_handler_t = RestRouter; + using connection_state_listener_t = http::ConnectionListener; +}; +struct RestRouterTraits : public restinio::default_traits_t +{ + using timer_manager_t = restinio::asio_timer_manager_t; +#ifdef OPENDHT_PROXY_HTTP_PARSER_FORK + using http_methods_mapper_t = restinio::custom_http_methods_t; +#endif + using logger_t = restinio::opendht_logger_t; + using request_handler_t = RestRouter; + using connection_state_listener_t = http::ConnectionListener; +}; + DhtProxyServer::DhtProxyServer( std::shared_ptr<dht::crypto::Identity> identity, std::shared_ptr<DhtRunner> dht, in_port_t port, const std::string& pushServer,