Http file server statically serves files from a directory. More...
#include <HttpAsyncFileServer.h>
Public Member Functions | |
| Result | init (StringSpan directoryToServe, Span< HttpAsyncFileServerStream > fileStreams, AsyncBuffersPool &buffersPool, AsyncEventLoop &eventLoop, ThreadPool &threadPool) |
| Initialize the web server on the given file system directory to serve. | |
| Result | serveFile (HttpConnection::ID index, StringSpan url, HttpResponse &response) |
| Serve the file requested by this Http Client on its channel Call this method in response to HttpConnectionsPool::onRequest to serve a file. | |
| void | registerToServeFilesOn (HttpAsyncServer &server) |
| Registers to HttpConnectionsPool::onRequest callback to serve files from this file server. | |
Http file server statically serves files from a directory.
This class registers the onRequest callback provided by HttpAsyncServer to serves files from a given directory.
| Result SC::HttpAsyncFileServer::init | ( | StringSpan | directoryToServe, |
| Span< HttpAsyncFileServerStream > | fileStreams, | ||
| AsyncBuffersPool & | buffersPool, | ||
| AsyncEventLoop & | eventLoop, | ||
| ThreadPool & | threadPool ) |
Initialize the web server on the given file system directory to serve.
| void SC::HttpAsyncFileServer::registerToServeFilesOn | ( | HttpAsyncServer & | server | ) |
Registers to HttpConnectionsPool::onRequest callback to serve files from this file server.
| Result SC::HttpAsyncFileServer::serveFile | ( | HttpConnection::ID | index, |
| StringSpan | url, | ||
| HttpResponse & | response ) |
Serve the file requested by this Http Client on its channel Call this method in response to HttpConnectionsPool::onRequest to serve a file.