|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
The HttpResMgr class makes it possible for HTTP clients to use an IoIntf for uploading and downloading files.
The HttpResMgr is similar in functionality to an FTP server, but uses HTTP for the transport of data.
The HttpResMgr is implemented in C code, but we also provide a Web File Manager implemented in Lua code. See the WFS documentation for more information on the Lua version.
The HttpResMgr is designed to be used from both browser clients and non-browser clients. The HttpResMgr detects the difference between a browser and non-browser client by looking at the commands sent to the HttpResMgr resource and the upload type.
The HttpResMgr can also work with "read only" IoIntf implementations such as the ZipIo, but any "write" command type is denied.
Unlike the HttpResRdr class, the HttpResMgr does not do any translations on downloaded files. The HttpResMgr should be used for file transfer and not for serving general HTML files, images, etc, to a client. A request for a directory returns a list of all resources in the directory. This is different from the HttpResRdr class, which attempts to locate the index.html file for directory requests.
For security reasons, a HttpResMgr should not be used without an authenticator.
The HttpResMgr is an example application for how to make a class that inherits from HttpDir. The HttpResMgr class can be considered a resource collection. The HttpResMgr source code and example can be found in the example/HttpResMgr directory.
#include <HttpResMgr.h>

Public Member Functions | |
| HttpResMgr (IoIntf *io, int maxUploads, const char *dirName, AllocatorIntf *alloc=0, S8 priority=0) | |
| Initializes a HttpResMgr. More... | |
| ~HttpResMgr () | |
| Terminate the HttpResMgr object. More... | |
Public Member Functions inherited from HttpDir | |
| HttpDir () | |
| Constructor for creating a root dir, a root dir has no name. More... | |
| HttpDir (const char *name, S8 priority=0) | |
| Constructor for creating a sub-directory. More... | |
| ~HttpDir () | |
| Unlink this directory and notify all child pages/directories through their service callbacks with NULL request arguments. More... | |
| int | insertDir (HttpDir *dir) |
| Insert a sub-directory. More... | |
| int | insertPage (HttpPage *page) |
| Insert a page in the directory. More... | |
| HttpPage * | getFirstPage () |
| Returns the first page. More... | |
| HttpDir * | getFirstDir () |
| Returns the first sub-directory. More... | |
| HttpDir * | getDir (const char *name) |
| Returns the first directory with the name given or NULL if not found. More... | |
| HttpPage * | getPage (const char *name) |
| Returns the page with the name given or NULL if not found. More... | |
| HttpDir * | getNext () |
| Returns the next dir in the parent list. More... | |
| HttpPage * | findPage (HttpPage *iter, const char *name) |
| Searches for a page in this directory node. More... | |
| HttpDir * | createOrGet (const char *name) |
| Returns a sub-directory with the given name. More... | |
| const char * | getName () const |
| Returns the directory name. More... | |
| HttpDir * | getParent () const |
| Returns the parent directory or NULL if no parent. More... | |
| char * | makeAbsPath (const char *relPath, int relPathLen) |
| Makes an absolute path based on where the HttpDir instance is installed in the virtual file system and the provided relative path. More... | |
| char * | getRootPath () |
| Calculates the root of where the HttpDir instance is installed in the virtual file system. More... | |
| HttpDir_Service | setService (HttpDir_Service s) |
| Replace the original service function in HttpDir with your own. More... | |
| void | p403 (const char *p403) |
| Set a 403 denied request handler. More... | |
| bool | isLinked () |
| Returns true if this directory node is installed into a parent directory. More... | |
| int | unlink () |
| Unlinks/removes the directory from the parent directory. More... | |
| void | setAuthenticator (struct AuthenticatorIntf *authenticator, struct AuthorizerIntf *authorizer=0) |
| Set the optional authenticator and optional AuthorizerIntf. More... | |
| bool | authenticateAndAuthorize (HttpCommand *cmd, const char *path) |
| Authenticate and authorize the user. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from HttpDir | |
| static HttpDir * | findDir (HttpDir *iter, const char *name, unsigned int nameLen) |
| Searches for a sub-directory in this directory node. More... | |
| HttpResMgr::HttpResMgr | ( | IoIntf * | io, |
| int | maxUploads, | ||
| const char * | dirName, | ||
| AllocatorIntf * | alloc = 0, |
||
| S8 | priority = 0 |
||
| ) |
Initializes a HttpResMgr.
| io | Required borrowed I/O interface, valid until the manager and all its uploads have been destroyed. |
| maxUploads | Concurrent upload-request limit, not a byte-size limit. Values less than or equal to zero select one upload. The maximum numbers of downloads are controlled by the HttpCmdThreadPool. See the limitations section in HttpResRdr for more information on how the download works. |
| dirName | Borrowed NUL-terminated directory name, valid throughout use; NULL selects an empty name. |
| alloc | Borrowed allocator for upload state; NULL (default) uses AllocatorIntf_getDefault(). Keep it alive throughout manager use. |
| priority | Signed directory priority, default zero. Construction does not open resources or report whether the I/O root exists. |
| HttpResMgr::~HttpResMgr | ( | ) |
Terminate the HttpResMgr object.
Please note that any upload in progress will be aborted. Stop new requests first. The borrowed I/O interface and allocator are not destroyed.