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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ _build
build/
libs/network/doc/doxygen/
.DS_Store
*.swo
42 changes: 20 additions & 22 deletions boost/network/protocol/http/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,35 @@

#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/request.hpp>
#include <boost/network/protocol/http/server/sync_server.hpp>
#include <boost/network/protocol/http/server/async_server.hpp>

namespace boost {
namespace network {
namespace http {

template <class Tag, class Handler, class Enable = void>
struct server_base {
typedef unsupported_tag<Tag> type;
};

template <class Tag, class Handler>
struct server_base<Tag, Handler, typename enable_if<is_async<Tag> >::type> {
typedef async_server_base<Tag, Handler> type;
};

template <class Tag, class Handler>
struct server_base<Tag, Handler, typename enable_if<is_sync<Tag> >::type> {
typedef sync_server_base<Tag, Handler> type;
};

template <class Tag, class Handler>
struct basic_server : server_base<Tag, Handler>::type {};

/**
* The main HTTP Server template implementing an asynchronous HTTP service.
*
* Usage Example:
* \code{.cpp}
* handler_type handler;
* http_server::options options(handler);
* options.thread_pool(
* std::make_shared<boost::network::utils::thread_pool>());
* http_server server(options.address("localhost").port("8000"));
* \endcode
*
*/
template <class Handler>
struct server : server_base<tags::http_server, Handler>::type {
typedef typename server_base<tags::http_server, Handler>::type server_base;
struct server : async_server_base<tags::http_server, Handler> {
/// A convenience typedef for the base of this type, implementing most of
/// the internal details.
typedef async_server_base<tags::http_server, Handler> server_base;

/// The options supported by the server.
typedef server_options<tags::http_server, Handler> options;

explicit server(options const &options) : server_base(options) {}
using server_base::server_base;
};

} // namespace http
Expand Down
Loading