Skip to content

Commit c6bcab5

Browse files
authored
refactor: make method and path in http_server_request protected instead of private (#1423)
1 parent 34d6b01 commit c6bcab5

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

include/dpp/http_server_request.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,6 @@ using http_server_request_event = std::function<void(class http_server_request*)
4444
* @note plaintext HTTP without SSL is also supported via a "downgrade" setting
4545
*/
4646
class DPP_EXPORT http_server_request : public ssl_connection {
47-
48-
/**
49-
* @brief The type of the request, e.g. GET, POST
50-
*/
51-
std::string request_type;
52-
53-
/**
54-
* @brief Path part of URL for HTTPS connection
55-
*/
56-
std::string path;
57-
5847
/**
5948
* @brief The request body, e.g. form data
6049
*/
@@ -87,6 +76,16 @@ class DPP_EXPORT http_server_request : public ssl_connection {
8776

8877
protected:
8978

79+
/**
80+
* @brief The type of the request, e.g. GET, POST
81+
*/
82+
std::string request_type;
83+
84+
/**
85+
* @brief Path part of URL for HTTPS connection
86+
*/
87+
std::string path;
88+
9089
/**
9190
* @brief Current connection state
9291
*/

src/dpp/http_server_request.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ bool http_server_request::handle_buffer(std::string &buffer)
144144
return true;
145145
}
146146
std::string req_verb = uppercase(verb_path_protocol[0]);
147+
request_type = req_verb;
147148
std::string req_path = verb_path_protocol[1];
149+
path = req_path;
148150
std::string protocol = uppercase(verb_path_protocol[2]);
149-
151+
150152
h.erase(h.begin());
151153

152154
if (protocol.substr(0, 5) != "HTTP/") {

0 commit comments

Comments
 (0)