mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Add Response type to util::http.
This commit is contained in:
@@ -9,11 +9,15 @@ namespace util {
|
||||
namespace http {
|
||||
|
||||
class Request {
|
||||
|
||||
void parseRequestLine(const std::string& line);
|
||||
|
||||
void parseHeaderLine(const std::string& line);
|
||||
public:
|
||||
Request(const std::string& data);
|
||||
|
||||
Request();
|
||||
|
||||
std::string getMethod() const;
|
||||
|
||||
std::string getUri() const;
|
||||
@@ -35,6 +39,29 @@ private:
|
||||
std::map<std::string, std::string> headers;
|
||||
};
|
||||
|
||||
class Response {
|
||||
public:
|
||||
|
||||
Response(int status);
|
||||
|
||||
/**
|
||||
* @note overrides existing header values with the same name
|
||||
*/
|
||||
void setHeader(const std::string& name, const std::string& value);
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
/**
|
||||
* @return the message associated with the satus of this response, or the
|
||||
* empty string if the status number is invalid
|
||||
*/
|
||||
std::string getStatusMessage() const;
|
||||
|
||||
private:
|
||||
int status;
|
||||
std::map<std::string, std::string> headers;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user