Skip to content

Commit 2df9241

Browse files
author
Sebastiano Merlino
committed
Moved http_endpoint to details namespace
1 parent 9ae7c5c commit 2df9241

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

src/http_endpoint.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ using namespace std;
2525

2626
namespace httpserver
2727
{
28+
2829
using namespace http;
2930

31+
namespace details
32+
{
33+
3034
//ENDPOINT
3135
http_endpoint::~http_endpoint()
3236
{
@@ -197,3 +201,5 @@ bool http_endpoint::match(const http_endpoint& url) const
197201
}
198202

199203
};
204+
205+
};

src/httpserver/http_endpoint.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ namespace httpserver
3535

3636
class webserver;
3737

38+
namespace details
39+
{
40+
3841
/**
3942
* Exception class throwed when a bad formatted http url is used
4043
**/
@@ -224,10 +227,12 @@ class http_endpoint
224227
* Boolean indicating if the regex is compiled
225228
**/
226229
bool reg_compiled;
227-
friend class webserver;
230+
friend class httpserver::webserver;
228231
template<typename, typename> friend struct std::pair;
229232
template<typename> friend struct std::less;
230233
};
231234

235+
};
236+
232237
};
233238
#endif

src/httpserver/webserver.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ namespace httpserver {
5151
class http_resource;
5252
class http_response;
5353
class http_request;
54-
class http_endpoint;
55-
5654
struct modded_request;
5755

56+
namespace details
57+
{
58+
class http_endpoint;
59+
}
60+
5861
using namespace http;
5962

6063
namespace http {
@@ -275,7 +278,7 @@ class webserver
275278
http_resource* method_not_acceptable_resource;
276279
http_resource* internal_error_resource;
277280

278-
std::map<http_endpoint, http_resource* > registered_resources;
281+
std::map<details::http_endpoint, http_resource* > registered_resources;
279282
#ifdef USE_CPP_ZEROX
280283
std::unordered_set<ip_representation> bans;
281284
std::unordered_set<ip_representation> allowances;

src/webserver.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,14 @@ bool webserver::stop()
410410

411411
void webserver::register_resource(const string& resource, http_resource* http_resource, bool family)
412412
{
413-
this->registered_resources[http_endpoint(resource, family, true, regex_checking)] = http_resource;
413+
this->registered_resources[details::http_endpoint(resource, family, true, regex_checking)] = http_resource;
414414
if(method_not_acceptable_resource)
415415
http_resource->method_not_acceptable_resource = method_not_acceptable_resource;
416416
}
417417

418418
void webserver::unregister_resource(const string& resource)
419419
{
420-
this->registered_resources.erase(http_endpoint(resource));
420+
this->registered_resources.erase(details::http_endpoint(resource));
421421
}
422422

423423
void webserver::ban_ip(const string& ip)
@@ -722,17 +722,17 @@ int webserver::finalize_answer(MHD_Connection* connection, struct modded_request
722722
int to_ret = MHD_NO;
723723
struct MHD_Response *response = 0x0;
724724
http_response* dhrs = 0x0;
725-
map<http_endpoint, http_resource* >::iterator found_endpoint;
725+
map<details::http_endpoint, http_resource* >::iterator found_endpoint;
726726
bool found = false;
727727
if(!single_resource)
728728
{
729-
http_endpoint endpoint(st_url, false, false, regex_checking);
729+
details::http_endpoint endpoint(st_url, false, false, regex_checking);
730730
found_endpoint = registered_resources.find(endpoint);
731731
if(found_endpoint == registered_resources.end())
732732
{
733733
if(regex_checking)
734734
{
735-
map<http_endpoint, http_resource* >::iterator it;
735+
map<details::http_endpoint, http_resource* >::iterator it;
736736
int len = -1;
737737
int tot_len = -1;
738738
for(it=registered_resources.begin(); it!=registered_resources.end(); ++it)

0 commit comments

Comments
 (0)