Rudiments
|
Inherits output.
Public Member Functions | |
httpresponse (httpserverapi *sapi) | |
void | textHtml () |
void | textPlain () |
void | contentType (const char *type, const char *subtype) |
void | contentType (const char *type, const char *subtype, const char *charset) |
void | contentType (const char *type, const char *subtype, const char *charset, const char *boundary) |
void | cr () |
void | status (const char *protocol, const char *protocolversion, const char *code) |
void | setCookie (const char *name, const char *value, const char *domain, const char *path, const char *expires, bool secure) |
const char * | boundaryString () |
void | multiPartBoundary (output *out) |
void | multiPartEnd (output *out) |
httpresponse * | status (const char *status) |
httpresponse * | header (const char *header) |
httpresponse * | header (const char *header, const char *value) |
ssize_t | write (const unsigned char *string, size_t size) |
ssize_t | write (const char *string) |
ssize_t | write (const char *string, size_t length) |
ssize_t | write (char character) |
ssize_t | write (int16_t number) |
ssize_t | write (int32_t number) |
ssize_t | write (int64_t number) |
ssize_t | write (unsigned char character) |
ssize_t | write (uint16_t number) |
ssize_t | write (uint32_t number) |
ssize_t | write (uint64_t number) |
ssize_t | write (float number) |
ssize_t | write (double number) |
ssize_t | write (file *filebuffer) |
![]() | |
virtual ssize_t | write (const unsigned char *string, size_t size, int32_t sec, int32_t usec) |
virtual ssize_t | write (const char *string, int32_t sec, int32_t usec) |
virtual ssize_t | write (const char *string, size_t length, int32_t sec, int32_t usec) |
virtual ssize_t | write (char character, int32_t sec, int32_t usec) |
virtual ssize_t | write (int16_t number, int32_t sec, int32_t usec) |
virtual ssize_t | write (int32_t number, int32_t sec, int32_t usec) |
virtual ssize_t | write (int64_t number, int32_t sec, int32_t usec) |
virtual ssize_t | write (unsigned char character, int32_t sec, int32_t usec) |
virtual ssize_t | write (uint16_t number, int32_t sec, int32_t usec) |
virtual ssize_t | write (uint32_t number, int32_t sec, int32_t usec) |
virtual ssize_t | write (uint64_t number, int32_t sec, int32_t usec) |
virtual ssize_t | write (float number, int32_t sec, int32_t usec) |
virtual ssize_t | write (double number, int32_t sec, int32_t usec) |
The httpresponse class provides methods for generating http responses.
const char* httpresponse::boundaryString | ( | ) |
Returns a boundary string that is useful in building multipart responses.
void httpresponse::contentType | ( | const char * | type, |
const char * | subtype | ||
) |
Send HTTP header: Content-type: "type"/"subtype"
Does not send carriage-returns.
void httpresponse::contentType | ( | const char * | type, |
const char * | subtype, | ||
const char * | charset | ||
) |
Send HTTP header: Content-type: "type"/"subtype"; charset="charset"
If charset is NULL or an empty string then it will be omitted.
Does not send carriage-returns.
void httpresponse::contentType | ( | const char * | type, |
const char * | subtype, | ||
const char * | charset, | ||
const char * | boundary | ||
) |
Send HTTP header: Content-type: "type"/"subtype"; charset="charset"; boundary="boundary"
If either of charset or boundary are NULL or empty strings then it will be omitted.
Does not send carriage-returns.
void httpresponse::cr | ( | ) |
Send carriage-return.
httpresponse* httpresponse::header | ( | const char * | header | ) |
Sends an http header.
httpresponse* httpresponse::header | ( | const char * | header, |
const char * | value | ||
) |
Sends an http header.
void httpresponse::multiPartBoundary | ( | output * | out | ) |
Sends a starting boundary string.
void httpresponse::multiPartEnd | ( | output * | out | ) |
Sends a ending boundary string.
void httpresponse::setCookie | ( | const char * | name, |
const char * | value, | ||
const char * | domain, | ||
const char * | path, | ||
const char * | expires, | ||
bool | secure | ||
) |
Send Set-Cookie header.
void httpresponse::status | ( | const char * | protocol, |
const char * | protocolversion, | ||
const char * | code | ||
) |
Send status header.
httpresponse* httpresponse::status | ( | const char * | status | ) |
Sends an http status header.
void httpresponse::textHtml | ( | ) |
Send HTTP header: Content-type: text/html followed by two carriage-returns.
void httpresponse::textPlain | ( | ) |
Send HTTP header: Content-type: text/plain followed by two carriage-returns.
ssize_t httpresponse::write | ( | file * | filebuffer | ) |
Writes "filebuffer" to the browser.