Skip to content

Commit 2d7f0c2

Browse files
committed
chore: use http_proto
1 parent 1a62e26 commit 2d7f0c2

26 files changed

+86
-4363
lines changed

example/server/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ int server_main( int argc, char* argv[] )
7373
//srv.wwwroot.use("/detach", serve_detached());
7474
srv.wwwroot.use(post_work());
7575
srv.wwwroot.use(
76-
[]( Request& req,
77-
Response& res) ->
78-
route_result
76+
[]( http_proto::Request& req,
77+
http_proto::Response& res) ->
78+
http_proto::route_result
7979
{
80-
return route::next;
80+
return http_proto::route::next;
8181
});
8282
srv.wwwroot.use("/", serve_static( argv[3] ));
8383

example/server/post_work.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ struct task
4848
std::size_t i = 10;
4949

5050
void
51-
operator()(resumer resume)
51+
operator()(http_proto::resumer resume)
5252
{
5353
if(i--)
5454
return;
55-
resume(route::next);
55+
resume(http_proto::route::next);
5656
}
5757
};
5858

5959
} // (anon)
6060

6161
//------------------------------------------------
6262

63-
route_result
63+
http_proto::route_result
6464
post_work::
6565
operator()(
66-
Request&,
67-
Response& res) const
66+
http_proto::Request&,
67+
http_proto::Response& res) const
6868
{
6969
return res.post(task());
7070
}

example/server/post_work.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define BOOST_BEAST2_SERVER_POST_WORK_HPP
1212

1313
#include <boost/beast2/detail/config.hpp>
14-
#include <boost/beast2/server/route_handler.hpp>
14+
#include <boost/http_proto/server/route_handler.hpp>
1515

1616
namespace boost {
1717
namespace beast2 {
@@ -20,8 +20,8 @@ struct post_work
2020
{
2121
system::error_code
2222
operator()(
23-
Request&,
24-
Response& res) const;
23+
http_proto::Request&,
24+
http_proto::Response& res) const;
2525
};
2626

2727
} // beast2

example/server/serve_detached.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <boost/beast2/detail/config.hpp>
1414
#include <boost/beast2/error.hpp>
15-
#include <boost/beast2/server/route_handler.hpp>
15+
#include <boost/http_proto/server/route_handler.hpp>
1616
#include <boost/asio/post.hpp>
1717
#include <boost/asio/thread_pool.hpp>
1818
#include <memory>
@@ -39,11 +39,11 @@ class serve_detached
3939

4040
system::error_code
4141
operator()(
42-
Request&,
43-
Response& res) const
42+
http_proto::Request&,
43+
http_proto::Response& res) const
4444
{
4545
return res.detach(
46-
[&](resumer resume)
46+
[&](http_proto::resumer resume)
4747
{
4848
asio::post(*tp_,
4949
[&, resume]()
@@ -52,7 +52,7 @@ class serve_detached
5252
std::this_thread::sleep_for(std::chrono::seconds(1));
5353
res.status(http_proto::status::ok);
5454
res.set_body("Hello from serve_detached!\n");
55-
resume(route::send);
55+
resume(http_proto::route::send);
5656
// resume( res.send("Hello from serve_detached!\n") );
5757
});
5858
});

example/server/serve_log_admin.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class serve_log_page
3030

3131
system::error_code
3232
operator()(
33-
Request&,
34-
Response& res) const
33+
http_proto::Request&,
34+
http_proto::Response& res) const
3535
{
3636
auto const v = ls_.get_sections();
3737
std::string s;
@@ -75,7 +75,7 @@ class serve_log_page
7575
res.status(http_proto::status::ok);
7676
res.message.set(http_proto::field::content_type, "text/html; charset=UTF-8");
7777
res.set_body(std::move(s));
78-
return error::success;
78+
return http_proto::route::send;
7979
}
8080

8181
private:
@@ -97,13 +97,13 @@ class handle_submit
9797

9898
system::error_code
9999
operator()(
100-
Request&,
101-
Response& res) const
100+
http_proto::Request&,
101+
http_proto::Response& res) const
102102
{
103103
res.status(http_proto::status::ok);
104104
res.message.set(http_proto::field::content_type, "plain/text; charset=UTF-8");
105105
res.set_body("submit");
106-
return error::success;
106+
return http_proto::route::send;
107107
}
108108

109109
private:

include/boost/beast2.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@
1111
#define BOOST_BEAST2_HPP
1212

1313
#include <boost/beast2/server/any_lambda.hpp>
14-
#include <boost/beast2/server/basic_router.hpp>
1514
#include <boost/beast2/server/call_mf.hpp>
1615
#include <boost/beast2/server/fixed_array.hpp>
1716
#include <boost/beast2/server/http_server.hpp>
1817
#include <boost/beast2/server/http_stream.hpp>
1918
//#include <boost/beast2/server/https_server.hpp>
2019
#include <boost/beast2/server/plain_worker.hpp>
21-
#include <boost/beast2/server/route_handler.hpp>
2220
#include <boost/beast2/server/route_handler_asio.hpp>
2321
#include <boost/beast2/server/router.hpp>
2422
#include <boost/beast2/server/router_asio.hpp>
25-
#include <boost/beast2/server/router_types.hpp>
2623
#include <boost/beast2/server/serve_redirect.hpp>
2724
#include <boost/beast2/server/serve_static.hpp>
2825
//#include <boost/beast2/server/worker_ssl.hpp>

0 commit comments

Comments
 (0)