mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-02 21:52:30 +02:00
Add Response type to util::http.
This commit is contained in:
parent
e3b891de41
commit
3d30b4bbbc
3 changed files with 94 additions and 0 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue