Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions example/server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <boost/capy/read.hpp>
#include <boost/corosio/signal_set.hpp>
#include <boost/http/json/json_sink.hpp>
#include <boost/http/server/flat_router.hpp>
#include <boost/http/server/serve_static.hpp>
#include <boost/http/request_parser.hpp>
#include <boost/http/serializer.hpp>
Expand Down Expand Up @@ -128,15 +127,14 @@ void install_services()
#endif
}

class application : public http::router
class application : public http::router<http::route_params>
{
struct impl;
impl* impl_;

public:
void listen(unsigned short)
{
http::flat_router fr(std::move(*this));
}
};

Expand Down Expand Up @@ -188,7 +186,7 @@ int server_main( int argc, char* argv[] )
co_return http::route_done;
});
#endif
http_server hs1(ioc, 40, http::flat_router(std::move(rr1)),
http_server hs1(ioc, 40, std::move(rr1),
http::make_parser_config(http::parser_config(true)),
http::make_serializer_config(http::serializer_config()));
auto ec = hs1.bind(corosio::endpoint(ep, 80));
Expand All @@ -206,7 +204,7 @@ int server_main( int argc, char* argv[] )
rr2.use( http::cors() );
rr2.use( "/", http::serve_static( argv[2] ) );
https_server hs2(ioc, std::atoi(argv[1]), tls,
http::flat_router(std::move(rr2)),
std::move(rr2),
http::make_parser_config(http::parser_config(true)),
http::make_serializer_config(http::serializer_config()));
ec = hs2.bind(corosio::endpoint(ep, 443));
Expand Down
2 changes: 1 addition & 1 deletion example/server/serve_log_admin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace boost {
namespace beast2 {

http::router
http::router<http::route_params>
serve_log_admin();

} // beast2
Expand Down
6 changes: 3 additions & 3 deletions include/boost/beast2/http_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include <boost/corosio/tcp_server.hpp>
#include <boost/corosio/io_context.hpp>
#include <boost/http/config.hpp>
#include <boost/http/server/router.hpp>
#include <cstddef>

namespace boost {
namespace http { class flat_router; }
namespace beast2 {

/** An HTTP server for handling requests with coroutine-based I/O.
Expand All @@ -34,7 +34,7 @@ namespace beast2 {
@par Example
@code
corosio::io_context ctx;
http::flat_router router;
http::router<http::route_params> router;
router.add( http::verb::get, "/", my_handler );

http_server srv(
Expand Down Expand Up @@ -73,7 +73,7 @@ class BOOST_BEAST2_DECL
http_server(
corosio::io_context& ctx,
std::size_t num_workers,
http::flat_router router,
http::router<http::route_params> router,
http::shared_parser_config parser_cfg,
http::shared_serializer_config serializer_cfg);
};
Expand Down
7 changes: 3 additions & 4 deletions include/boost/beast2/http_worker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <boost/http/config.hpp>
#include <boost/http/request_parser.hpp>
#include <boost/http/serializer.hpp>
#include <boost/http/server/flat_router.hpp>
#include <boost/http/server/router.hpp>

namespace boost {
Expand Down Expand Up @@ -51,7 +50,7 @@ namespace beast2 {

my_worker(
corosio::io_context& ctx,
http::flat_router const& router,
http::router<http::route_params> const& router,
http::shared_parser_config parser_cfg,
http::shared_serializer_config serializer_cfg)
: http_worker(router, parser_cfg, serializer_cfg)
Expand Down Expand Up @@ -81,7 +80,7 @@ namespace beast2 {
class BOOST_BEAST2_DECL http_worker
{
public:
http::flat_router fr;
http::router<http::route_params> fr;
http::route_params rp;
capy::any_read_stream stream;
http::request_parser parser;
Expand All @@ -95,7 +94,7 @@ class BOOST_BEAST2_DECL http_worker
serializer.
*/
http_worker(
http::flat_router fr_,
http::router<http::route_params> fr_,
http::shared_parser_config parser_cfg,
http::shared_serializer_config serializer_cfg);

Expand Down
6 changes: 3 additions & 3 deletions include/boost/beast2/https_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include <boost/corosio/io_context.hpp>
#include <boost/corosio/tls_context.hpp>
#include <boost/http/config.hpp>
#include <boost/http/server/router.hpp>
#include <cstddef>

namespace boost {
namespace http { class flat_router; }
namespace beast2 {

/** An HTTPS server for handling requests with coroutine-based I/O.
Expand All @@ -42,7 +42,7 @@ namespace beast2 {
tls_ctx.use_certificate_chain_file("server.crt", corosio::tls_file_format::pem);
tls_ctx.use_private_key_file("server.key", corosio::tls_file_format::pem);

http::flat_router router;
http::router<http::route_params> router;
router.add( http::verb::get, "/", my_handler );

https_server srv(
Expand Down Expand Up @@ -86,7 +86,7 @@ class BOOST_BEAST2_DECL
corosio::io_context& ctx,
std::size_t num_workers,
corosio::tls_context tls_ctx,
http::flat_router router,
http::router<http::route_params> router,
http::shared_parser_config parser_cfg,
http::shared_serializer_config serializer_cfg);
};
Expand Down
8 changes: 3 additions & 5 deletions src/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <boost/beast2/http_server.hpp>
#include <boost/beast2/http_worker.hpp>
#include <boost/http/server/flat_router.hpp>
#include <boost/capy/task.hpp>
#include <boost/capy/cond.hpp>
#include <boost/capy/ex/strand.hpp>
Expand All @@ -21,7 +20,6 @@
#include <boost/http/server/router.hpp>
#include <boost/http/serializer.hpp>
#include <boost/http/string_body.hpp>
#include <boost/http/server/basic_router.hpp>
#include <boost/http/error.hpp>
#include <boost/url/parse.hpp>
#include <iostream>
Expand All @@ -31,11 +29,11 @@ namespace beast2 {

struct http_server::impl
{
http::flat_router router;
http::router<http::route_params> router;
http::shared_parser_config parser_cfg;
http::shared_serializer_config serializer_cfg;

impl(http::flat_router r)
impl(http::router<http::route_params> r)
: router(std::move(r))
{
}
Expand Down Expand Up @@ -99,7 +97,7 @@ http_server::
http_server(
corosio::io_context& ctx,
std::size_t num_workers,
http::flat_router router,
http::router<http::route_params> router,
http::shared_parser_config parser_cfg,
http::shared_serializer_config serializer_cfg)
: tcp_server(ctx, ctx.get_executor())
Expand Down
2 changes: 1 addition & 1 deletion src/http_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace beast2 {

http_worker::
http_worker(
http::flat_router fr_,
http::router<http::route_params> fr_,
http::shared_parser_config parser_cfg,
http::shared_serializer_config serializer_cfg)
: fr(std::move(fr_))
Expand Down
8 changes: 3 additions & 5 deletions src/https_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <boost/beast2/https_server.hpp>
#include <boost/beast2/http_worker.hpp>
#include <boost/http/server/flat_router.hpp>
#include <boost/capy/task.hpp>
#include <boost/capy/cond.hpp>
#include <boost/capy/ex/strand.hpp>
Expand All @@ -22,7 +21,6 @@
#include <boost/http/server/router.hpp>
#include <boost/http/serializer.hpp>
#include <boost/http/string_body.hpp>
#include <boost/http/server/basic_router.hpp>
#include <boost/http/error.hpp>
#include <boost/url/parse.hpp>
#include <iostream>
Expand All @@ -34,13 +32,13 @@ namespace beast2 {
struct https_server::impl
{
corosio::tls_context tls_ctx;
http::flat_router router;
http::router<http::route_params> router;
http::shared_parser_config parser_cfg;
http::shared_serializer_config serializer_cfg;

impl(
corosio::tls_context tc,
http::flat_router r)
http::router<http::route_params> r)
: tls_ctx(std::move(tc))
, router(std::move(r))
{
Expand Down Expand Up @@ -132,7 +130,7 @@ https_server(
corosio::io_context& ctx,
std::size_t num_workers,
corosio::tls_context tls_ctx,
http::flat_router router,
http::router<http::route_params> router,
http::shared_parser_config parser_cfg,
http::shared_serializer_config serializer_cfg)
: tcp_server(ctx, ctx.get_executor())
Expand Down
Loading