MXS-1220: Split requested resource into parts
When a client requests a resource, the HttpRequest class now splits the requested resource into parts. This should help with the resource validation and navigation. Added test that checks that the resources are correctly split into the correct number of arguments and that the argument contents are correct.
This commit is contained in:
committed by
Markus Mäkelä
parent
4b4a87fb41
commit
e248178349
@ -14,8 +14,9 @@
|
||||
|
||||
#include <maxscale/cppdefs.hh>
|
||||
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <tr1/memory>
|
||||
|
||||
#include <maxscale/jansson.hh>
|
||||
@ -26,6 +27,7 @@
|
||||
using std::shared_ptr;
|
||||
using std::string;
|
||||
using std::map;
|
||||
using std::deque;
|
||||
using mxs::Closer;
|
||||
|
||||
class HttpRequest;
|
||||
@ -132,22 +134,32 @@ public:
|
||||
/**
|
||||
* @brief Get request resource
|
||||
*
|
||||
* @return The request resoure
|
||||
* @return The request resource
|
||||
*/
|
||||
const string& get_resource() const
|
||||
{
|
||||
return m_resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get request resource parts
|
||||
*
|
||||
* @return The request resource split into parts
|
||||
*/
|
||||
const deque<string>& get_resource_parts() const
|
||||
{
|
||||
return m_resource_parts;
|
||||
}
|
||||
private:
|
||||
HttpRequest();
|
||||
HttpRequest(const HttpRequest&);
|
||||
HttpRequest& operator = (const HttpRequest&);
|
||||
|
||||
map<string, string> m_headers; /**< Request headers */
|
||||
map<string, string> m_options; /**< Request options */
|
||||
Closer<json_t*> m_json; /**< Request body */
|
||||
string m_json_string; /**< String version of @c m_json */
|
||||
string m_resource; /**< Requested resource */
|
||||
enum http_verb m_verb; /**< Request method */
|
||||
map<string, string> m_headers; /**< Request headers */
|
||||
map<string, string> m_options; /**< Request options */
|
||||
Closer<json_t*> m_json; /**< Request body */
|
||||
string m_json_string; /**< String version of @c m_json */
|
||||
string m_resource; /**< Requested resource */
|
||||
deque<string> m_resource_parts; /**< @c m_resource split into parts */
|
||||
enum http_verb m_verb; /**< Request method */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user