Rudiments
|
#include <httpresponse.h>
Inherits output.
The httpresponse class provides methods for generating http responses.
httpresponse::httpresponse | ( | httpserverapi * | sapi | ) |
Creates an instance of the httpresponse class.
|
virtual |
Deletes this instance of the httpresponse class.
Returns a boundary string that is useful in building multipart responses.
Sends HTTP header: Content-type: "type"/"subtype" to the browser.
Does not send carriage-returns.
void httpresponse::sendContentTypeHeader | ( | const char * | type, |
const char * | subtype, | ||
const char * | charset ) |
Sends HTTP header: Content-type: "type"/"subtype"; charset="charset" to the browser.
If charset is NULL or an empty string then it will be omitted.
Does not send carriage-returns.
void httpresponse::sendContentTypeHeader | ( | const char * | type, |
const char * | subtype, | ||
const char * | charset, | ||
const char * | boundary ) |
Sends HTTP header: Content-type: "type"/"subtype"; charset="charset"; boundary="boundary" to the browser.
If either of charset or boundary are NULL or empty strings then it will be omitted.
Does not send carriage-returns.
void httpresponse::sendCrLf | ( | ) |
Sends carriage-return and line-feed (/r/n) to the browser.
Sends a final multipart boundary string.
httpresponse * httpresponse::sendHeader | ( | const char * | header | ) |
Sends an http header.
httpresponse * httpresponse::sendHeader | ( | const char * | header, |
const char * | value ) |
Sends an http header.
httpresponse * httpresponse::sendStatusHeader | ( | const char * | status | ) |
Sends an http status header.
void httpresponse::sendTextHtmlHeader | ( | ) |
Sends HTTP header: Content-type: text/html followed by two carriage-returns to the browser.
void httpresponse::sendTextPlainHeader | ( | ) |
Sends HTTP header: Content-type: text/plain followed by two carriage-returns to the browser.
void httpresponse::setCookie | ( | const char * | name, |
const char * | value, | ||
const char * | domain, | ||
const char * | path, | ||
const char * | expires, | ||
bool | secure ) |
Sends Set-Cookie header to the browser.
|
virtual |
Writes "character" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "character" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
Writes "size" bytes of "string" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
Writes NULL-terminated "string" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
Writes "length" characters of "string" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred. Note that it is possible to write beyond the string's NULL terminator using this method.
Implements output.
Writes NULL-terminated "string" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
Writes "length" characters of "string" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred. Note that it is possible to write beyond the string's NULL terminator using this method.
Implements output.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
ssize_t httpresponse::write | ( | file * | filebuffer | ) |
Writes "filebuffer" to the browser.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "number" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes "character" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
|
virtual |
Writes NULL-terminated "string" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.
Writes "length" characters of "string" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred. Note that it is possible to write beyond the string's NULL terminator using this method.
Implements output.
|
virtual |
Writes "character" to the browser. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.
Implements output.