Changeset View
Changeset View
Standalone View
Standalone View
src/httpserver.h
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
public: | public: | ||||
explicit HTTPRequest(struct evhttp_request *req); | explicit HTTPRequest(struct evhttp_request *req); | ||||
~HTTPRequest(); | ~HTTPRequest(); | ||||
enum RequestMethod { UNKNOWN, GET, POST, HEAD, PUT, OPTIONS }; | enum RequestMethod { UNKNOWN, GET, POST, HEAD, PUT, OPTIONS }; | ||||
/** Get requested URI */ | /** Get requested URI */ | ||||
std::string GetURI(); | std::string GetURI() const; | ||||
/** Get CService (address:ip) for the origin of the http request */ | /** Get CService (address:ip) for the origin of the http request */ | ||||
CService GetPeer(); | CService GetPeer() const; | ||||
/** Get request method */ | /** Get request method */ | ||||
RequestMethod GetRequestMethod(); | RequestMethod GetRequestMethod() const; | ||||
/** | /** | ||||
* Get the request header specified by hdr, or an empty string. | * Get the request header specified by hdr, or an empty string. | ||||
* Return a pair (isPresent,string). | * Return a pair (isPresent,string). | ||||
*/ | */ | ||||
std::pair<bool, std::string> GetHeader(const std::string &hdr); | std::pair<bool, std::string> GetHeader(const std::string &hdr) const; | ||||
/** | /** | ||||
* Read request body. | * Read request body. | ||||
* | * | ||||
* @note As this consumes the underlying buffer, call this only once. | * @note As this consumes the underlying buffer, call this only once. | ||||
* Repeated calls will return an empty string. | * Repeated calls will return an empty string. | ||||
*/ | */ | ||||
std::string ReadBody(); | std::string ReadBody(); | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |