@@ -83,9 +83,9 @@ class http_request
8383 * Method used to get all pieces of the path requested; considering an url splitted by '/'.
8484 * @return a vector of strings containing all pieces
8585 **/
86- const std::vector<std::string>& get_path_pieces () const
86+ const std::vector<std::string> get_path_pieces () const
8787 {
88- return this ->post_path ;
88+ return http::http_utils::tokenize_url ( this ->path ) ;
8989 }
9090
9191 /* *
@@ -95,8 +95,9 @@ class http_request
9595 **/
9696 const std::string& get_path_piece (int index) const
9797 {
98- if (((int )(this ->post_path .size ())) > index)
99- return this ->post_path [index];
98+ std::vector<std::string> post_path = this ->get_path_pieces ();
99+ if (((int )(post_path.size ())) > index)
100+ return post_path[index];
100101 return EMPTY;
101102 }
102103
@@ -238,7 +239,6 @@ class http_request
238239 http_request (const http_request& b):
239240 path (b.path),
240241 method (b.method),
241- post_path (b.post_path),
242242 args (b.args),
243243 content (b.content),
244244 content_size_limit (b.content_size_limit),
@@ -251,7 +251,6 @@ class http_request
251251 http_request (http_request&& b) noexcept :
252252 path (std::move(b.path)),
253253 method (std::move(b.method)),
254- post_path (std::move(b.post_path)),
255254 args (std::move(b.args)),
256255 content (std::move(b.content)),
257256 content_size_limit (b.content_size_limit),
@@ -266,7 +265,6 @@ class http_request
266265
267266 this ->path = b.path ;
268267 this ->method = b.method ;
269- this ->post_path = b.post_path ;
270268 this ->args = b.args ;
271269 this ->content = b.content ;
272270 this ->content_size_limit = b.content_size_limit ;
@@ -282,7 +280,6 @@ class http_request
282280
283281 this ->path = std::move (b.path );
284282 this ->method = std::move (b.method );
285- this ->post_path = std::move (b.post_path );
286283 this ->args = std::move (b.args );
287284 this ->content = std::move (b.content );
288285 this ->content_size_limit = b.content_size_limit ;
@@ -294,7 +291,6 @@ class http_request
294291
295292 std::string path;
296293 std::string method;
297- std::vector<std::string> post_path;
298294 std::map<std::string, std::string, http::arg_comparator> args;
299295 std::string content;
300296 size_t content_size_limit;
@@ -377,11 +373,6 @@ class http_request
377373 void set_path (const std::string& path)
378374 {
379375 this ->path = path;
380- std::vector<std::string> complete_path = http::http_utils::tokenize_url (this ->path );
381- for (unsigned int i = 0 ; i < complete_path.size (); i++)
382- {
383- this ->post_path .push_back (complete_path[i]);
384- }
385376 }
386377
387378 /* *
0 commit comments