This class represents what is sent back to the client.
More...
#include <httpresponse.h>
This class represents what is sent back to the client.
It contains the actual body, any headers specified, and the response code.
- Examples:
- ehs_basicauth.cpp, ehs_exception.cpp, ehs_formtest.cpp, ehs_mirror.cpp, ehs_privport.cpp, ehs_test.cpp, ehs_testharness.cpp, ehs_uploader.cpp, and ehs_wsgate.cpp.
Definition at line 54 of file httpresponse.h.
◆ HttpResponse()
Constructs a new instance.
- Parameters
-
inResponseId | A unique Id (normally derived from the corresponding request Id). |
ipoEHSConnection | The connection, on which this response should be sent. |
◆ Error() [1/2]
Constructs a new standardized error response.
- Parameters
-
code | The HTTP error code. |
inResponseId | A unique Id (normally derived from the corresponding request Id). |
ipoEHSConnection | The connection, on which this response should be sent. |
- Returns
- The new response.
- Examples:
- ehs_exception.cpp, and ehs_wsgate.cpp.
◆ Error() [2/2]
Constructs a new standardized error response.
- Parameters
-
code | The HTTP error code. |
request | The http request to which this response refers. (Used for initializing the Id and the outgoing connection). |
- Returns
- The new response.
◆ GetPhrase()
static const char* GetPhrase |
( |
ResponseCode |
code | ) |
|
|
static |
Helper function for translating response codes into the corresponding text message.
- Parameters
-
code | The HTTP result code to be translated. |
- Returns
- The text message, representing the provided result code.
◆ GetStatusString()
std::string GetStatusString |
( |
| ) |
|
Retrieves the status string of this this response.
- Returns
- The current status as "<i>number</i> <i>description</i>".
Referenced by RemoveHeader().
◆ Header()
std::string Header |
( |
const std::string & |
name | ) |
|
|
inline |
Retrieves a specific HTTP header.
- Parameters
-
name | The name of the HTTP header to be retrieved. |
- Returns
- The value of the specified header.
Definition at line 182 of file httpresponse.h.
◆ HttpTime()
std::string HttpTime |
( |
time_t |
stamp | ) |
|
Utility function for converting a UNIX timestamp into an RFC-conformant HTTP time string.
- Parameters
-
stamp | A UNIX timestamp, representing the desired time. |
- Returns
- A string, containing the HTTP time.
Referenced by RemoveHeader().
◆ RemoveHeader()
void RemoveHeader |
( |
const std::string & |
name | ) |
|
|
inline |
◆ SetBody()
void SetBody |
( |
const char * |
ipsBody, |
|
|
size_t |
inBodyLength |
|
) |
| |
◆ SetCookie()
void SetCookie |
( |
CookieParameters & |
iroCookieParameters | ) |
|
◆ SetDate()
void SetDate |
( |
time_t |
stamp | ) |
|
Sets the HTTP Date header.
- Parameters
-
stamp | A UNIX timestamp, representing the desired time. |
Referenced by RemoveHeader().
◆ SetHeader()
void SetHeader |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| |
|
inline |
◆ SetLastModified()
void SetLastModified |
( |
time_t |
stamp | ) |
|
Sets the HTTP Last-Modified header.
- Parameters
-
stamp | A UNIX timestamp, representing the desired time. |
Referenced by RemoveHeader().
◆ SetResponseCode()
void SetResponseCode |
( |
ResponseCode |
code | ) |
|
|
inline |
Sets the response code for this response.
- Parameters
-
code | The desired HTTP response code. |
Definition at line 115 of file httpresponse.h.
The documentation for this class was generated from the following file: