Skip to content

Commit c044741

Browse files
committed
Adding missing files.
1 parent 90a1b0b commit c044741

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

http/src/http/server/connection.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2013 (c) Google, Inc.
2+
// Copyright 2013 (c) Dean Michael Berris <dberris@google.com>
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef NETWORK_HTTP_SERVER_CONNECTION_HPP_20130410
8+
#define NETWORK_HTTP_SERVER_CONNECTION_HPP_20130410
9+
10+
namespace network {
11+
namespace http {
12+
13+
struct connection {
14+
};
15+
16+
} // namespace http
17+
} // namespace network
18+
19+
#endif /* end of include guard: NETWORK_HTTP_SERVER_CONNECTION_HPP_20130410 */
20+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2013 (c) Google, Inc.
2+
// Copyright 2013 (c) Dean Michael Berris <dberris@google.com>
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#include <http/src/http/server/dynamic_dispatcher.hpp>
8+
9+
namespace network {
10+
namespace http {
11+
12+
void dynamic_dispatcher::register_handler(boost::string_ref pattern, std::function<void(session&, std::shared_ptr<connection>)> handler) {
13+
auto inserted = handlers_.insert(make_pair(static_cast<std::string>(pattern),
14+
handler));
15+
if (!inserted.second)
16+
inserted.first->second = handler;
17+
}
18+
19+
void dynamic_dispatcher::dispatch(boost::string_ref path, session& s, std::shared_ptr<connection> c) {
20+
auto entry = handlers_.find(static_cast<std::string>(path));
21+
if (entry != handlers_.end()) {
22+
entry->second(s, c);
23+
}
24+
}
25+
26+
} // namespace http
27+
} // namespace network

0 commit comments

Comments
 (0)