EHS Embedded HTTP Server
1.5.1.0
|
26 #ifndef HTTPRESPONSE_H
27 #define HTTPRESPONSE_H
33 HTTPRESPONSECODE_INVALID = 0,
34 HTTPRESPONSECODE_101_SWITCHING_PROTOCOLS = 101,
35 HTTPRESPONSECODE_200_OK = 200,
36 HTTPRESPONSECODE_301_MOVEDPERMANENTLY = 301,
37 HTTPRESPONSECODE_302_FOUND = 302,
38 HTTPRESPONSECODE_304_NOT_MODIFIED = 304,
39 HTTPRESPONSECODE_400_BADREQUEST = 400,
40 HTTPRESPONSECODE_401_UNAUTHORIZED = 401,
41 HTTPRESPONSECODE_403_FORBIDDEN = 403,
42 HTTPRESPONSECODE_404_NOTFOUND = 404,
43 HTTPRESPONSECODE_413_TOOLARGE = 413,
44 HTTPRESPONSECODE_426_UPGRADE_REQUIRED = 426,
45 HTTPRESPONSECODE_500_INTERNALSERVERERROR = 500,
46 HTTPRESPONSECODE_503_SERVICEUNAVAILABLE = 503
103 void SetBody(
const char *ipsBody,
size_t inBodyLength);
137 void SetHeader(
const std::string & name,
const std::string & value)
139 m_oResponseHeaders[name] = value;
148 m_oResponseHeaders.erase(name);
182 std::string
Header(
const std::string & name)
184 if (m_oResponseHeaders.find(name) != m_oResponseHeaders.end()) {
185 return m_oResponseHeaders[name];
187 return std::string();
193 ResponseCode m_nResponseCode;
197 StringCaseMap m_oResponseHeaders;
200 StringList m_oCookieList;
203 #endif // HTTPRESPONSE_H
EHSConnection abstracts the concept of a connection to an EHS application.
void SetResponseCode(ResponseCode code)
Sets the response code for this response.
ResponseCode GetResponseCode()
Retrieves the status code of this this response.
HttpResponse(int inResponseId, EHSConnection *ipoEHSConnection)
Constructs a new instance.
std::string Header(const std::string &name)
Retrieves a specific HTTP header.
static HttpResponse * Error(ResponseCode code, int inResponseId, EHSConnection *ipoEHSConnection)
Constructs a new standardized error response.
This class represents what is sent back to the client.
std::string HttpTime(time_t stamp)
Utility function for converting a UNIX timestamp into an RFC-conformant HTTP time string.
StringCaseMap & GetHeaders()
Retrieves the headers of this this response.
void SetCookie(CookieParameters &iroCookieParameters)
Sets cookies for this response.
void SetLastModified(time_t stamp)
Sets the HTTP Last-Modified header.
virtual ~HttpResponse()
Destructor.
void SetHeader(const std::string &name, const std::string &value)
Sets an HTTP header.
static HttpResponse * Error(ResponseCode code, HttpRequest *request)
Constructs a new standardized error response.
StringList & GetCookies()
Retrieves the cookies of this this response.
This class represents what is sent back to the client.
void SetDate(time_t stamp)
Sets the HTTP Date header.
This class represents a clients HTTP request.
void RemoveHeader(const std::string &name)
Removes an HTTP header.
std::string GetStatusString()
Retrieves the status string of this this response.
void SetBody(const char *ipsBody, size_t inBodyLength)
Sets the body of this instance.
static const char * GetPhrase(ResponseCode code)
Helper function for translating response codes into the corresponding text message.