|
join 1.0
lightweight network framework library
|
basic HTTP worker. More...
#include <httpserver.hpp>


Public Types | |
| using | Content = BasicHttpContent <Protocol> |
| using | Server = BasicHttpServer <Protocol> |
Public Member Functions | |
| BasicHttpWorker (Server *server) | |
| create the worker instance. | |
| BasicHttpWorker (const BasicHttpWorker &other)=delete | |
| create instance by copy. | |
| BasicHttpWorker & | operator= (const BasicHttpWorker &other)=delete |
| assign instance by copy. | |
| BasicHttpWorker (BasicHttpWorker &&other)=delete | |
| create instance by move. | |
| BasicHttpWorker & | operator= (BasicHttpWorker &&other)=delete |
| assign instance by move. | |
| virtual | ~BasicHttpWorker () |
| destroy worker thread. | |
| void | sendHeaders () |
| send headers. | |
| void | sendError (const std::string &status, const std::string &reason) |
| send error message. | |
| void | sendRedirect (const std::string &status, const std::string &reason, const std::string &location={}) |
| send redirect message. | |
| void | sendFile (const std::string &path) |
| send a file. | |
| bool | hasHeader (const std::string &name) const |
| checks if there is a HTTP request header with the specified name. | |
| std::string | header (const std::string &name) const |
| get HTTP request header by name. | |
| size_t | contentLength () const |
| get content length. | |
| void | header (const std::string &name, const std::string &val) |
| add header to the HTTP response. | |
Protected Member Functions | |
| void | work () |
| worker thread routine. | |
| void | processRequest () |
| process the HTTP request. | |
| int | readRequest () |
| read the HTTP request. | |
| void | writeResponse () |
| write the HTTP response. | |
| void | cleanUp () |
| clean all. | |
| void | endRequest () |
| end the HTTP request. | |
| void | setEncoding (const std::vector< std::string > &encodings) |
| set stream encoding. | |
| void | clearEncoding () |
| clear stream encoding. | |
Protected Attributes | |
| int | _max = 0 |
| max requests. | |
| HttpRequest | _request |
| HTTP request. | |
| HttpResponse | _response |
| HTTP response. | |
| std::streambuf * | _streambuf = nullptr |
| HTTP stream buffer. | |
| bool | _wrapped = false |
| HTTP stream status. | |
| Server * | _server |
| HTTP server. | |
| Thread | _thread |
| thread. | |
basic HTTP worker.
| using join::BasicHttpWorker< Protocol >::Content = BasicHttpContent <Protocol> |
| using join::BasicHttpWorker< Protocol >::Server = BasicHttpServer <Protocol> |
|
inline |
create the worker instance.
| server | Server instance. |
|
delete |
create instance by copy.
| other | object to copy. |
|
delete |
create instance by move.
| other | object to move. |
|
inlinevirtual |
destroy worker thread.
|
inlineprotected |
clean all.
|
inlineprotected |
clear stream encoding.
|
inline |
get content length.
|
inlineprotected |
end the HTTP request.
|
inline |
checks if there is a HTTP request header with the specified name.
| name | name of the HTTP request header to search for. |
|
inline |
get HTTP request header by name.
| name | header name. |
|
inline |
add header to the HTTP response.
| name | header name. |
| val | header value. |
|
delete |
assign instance by move.
| other | object to move. |
|
delete |
assign instance by copy.
| other | object to copy. |
|
inlineprotected |
process the HTTP request.
|
inlineprotected |
read the HTTP request.
|
inline |
send error message.
| status | status. |
| reason | reason. |
|
inline |
send a file.
| path | path of the file. |
|
inline |
send headers.
|
inline |
send redirect message.
| status | status. |
| reason | reason. |
| location | location to redirect to. |
|
inlineprotected |
set stream encoding.
| encodings | encodings applied to the stream. |
|
inlineprotected |
worker thread routine.
|
inlineprotected |
write the HTTP response.
|
protected |
max requests.
|
protected |
HTTP request.
|
protected |
HTTP response.
|
protected |
HTTP server.
|
protected |
HTTP stream buffer.
|
protected |
thread.
|
protected |
HTTP stream status.