xmltooling
1.4.2
|
Interface to HTTP response. More...
#include <xmltooling/io/HTTPResponse.h>
Public Types | |
enum | status_t { XMLTOOLING_HTTP_STATUS_OK = 200, XMLTOOLING_HTTP_STATUS_MOVED = 302, XMLTOOLING_HTTP_STATUS_NOTMODIFIED = 304, XMLTOOLING_HTTP_STATUS_UNAUTHORIZED = 401, XMLTOOLING_HTTP_STATUS_FORBIDDEN = 403, XMLTOOLING_HTTP_STATUS_NOTFOUND = 404, XMLTOOLING_HTTP_STATUS_ERROR = 500 } |
Some common HTTP status codes. More... | |
Public Member Functions | |
void | setContentType (const char *type) |
Sets or clears the MIME type of the response. More... | |
virtual void | setResponseHeader (const char *name, const char *value) |
Sets or clears a response header. More... | |
virtual void | setCookie (const char *name, const char *value) |
Sets a client cookie. More... | |
virtual long | sendRedirect (const char *url) |
Redirect the client to the specified URL and complete the response. More... | |
long | sendError (std::istream &inputStream) |
Sends an "error" response to the client along with a transport-specific error indication. More... | |
long | sendResponse (std::istream &inputStream) |
Sends a completed response to the client along with a transport-specific "OK" indication. More... | |
![]() | |
virtual long | sendResponse (std::istream &inputStream, long status)=0 |
Sends a completed response to the client. More... | |
Static Public Member Functions | |
static std::vector< std::string > & | getAllowedSchemes () |
Returns a modifiable array of schemes to permit in sanitized URLs. More... | |
static void | sanitizeURL (const char *url) |
Manually check for unsafe URLs vulnerable to injection attacks. More... | |
Interface to HTTP response.
To supply information to the surrounding web server environment, a shim must be supplied in the form of this interface to adapt the library to different proprietary server APIs.
This interface need not be threadsafe.
Some common HTTP status codes.
|
static |
Returns a modifiable array of schemes to permit in sanitized URLs.
Updates to this array must be externally synchronized with any use of this class or its subclasses.
|
static |
Manually check for unsafe URLs vulnerable to injection attacks.
url | location to check |
|
virtual |
Sends an "error" response to the client along with a transport-specific error indication.
inputStream | reference to source of response data |
Implements xmltooling::GenericResponse.
|
virtual |
Redirect the client to the specified URL and complete the response.
Any headers previously set will be sent ahead of the redirect.
The URL will be validated with the sanitizeURL method below.
url | location to redirect client |
|
virtual |
Sends a completed response to the client along with a transport-specific "OK" indication.
Used for "normal" responses.
inputStream | reference to source of response data |
Implements xmltooling::GenericResponse.
|
virtual |
Sets or clears the MIME type of the response.
type | the MIME type, or nullptr to clear |
Implements xmltooling::GenericResponse.
|
virtual |
Sets a client cookie.
name | cookie name |
value | value to set, or nullptr to clear |
|
virtual |
Sets or clears a response header.
name | header name |
value | value to set, or nullptr to clear |