GCC Code Coverage Report


Directory: ./
File: libs/beast2/include/boost/beast2/server/http_server.hpp
Date: 2026-01-15 20:49:56
Exec Total Coverage
Lines: 0 2 0.0%
Functions: 0 2 0.0%
Branches: 0 1 0.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/cppalliance/beast2
8 //
9
10 #ifndef BOOST_BEAST2_SERVER_HTTP_SERVER_HPP
11 #define BOOST_BEAST2_SERVER_HTTP_SERVER_HPP
12
13 #include <boost/beast2/detail/config.hpp>
14 #include <boost/beast2/server/router_corosio.hpp>
15 #include <boost/capy/application.hpp>
16 #include <boost/corosio/endpoint.hpp>
17
18 namespace boost {
19 namespace beast2 {
20
21 /** An HTTP server using Corosio for I/O.
22 */
23 class http_server
24 {
25 public:
26 virtual ~http_server() = default;
27
28 http_server() = default;
29
30 /** The router for handling HTTP requests.
31 */
32 router_corosio wwwroot;
33
34 /** Run the server.
35
36 This function attaches the current thread to the I/O context
37 so that it may be used for executing operations. Blocks the
38 calling thread until the server is stopped and has no
39 outstanding work.
40 */
41 virtual void run() = 0;
42
43 /** Stop the server.
44
45 Signals the server to stop accepting new connections and
46 cancel outstanding operations.
47 */
48 virtual void stop() = 0;
49 };
50
51 //------------------------------------------------
52
53 /** Install a plain (non-TLS) HTTP server into an application.
54
55 @param app The application to install the server into.
56 @param addr The address to bind to (e.g. "0.0.0.0").
57 @param port The port to listen on.
58 @param num_workers The number of worker sockets to preallocate.
59
60 @return A reference to the installed server.
61 */
62 BOOST_BEAST2_DECL
63 http_server&
64 install_plain_http_server(
65 capy::application& app,
66 char const* addr,
67 unsigned short port,
68 std::size_t num_workers);
69
70 } // beast2
71 } // boost
72
73 #endif
74