summaryrefslogtreecommitdiffhomepage
path: root/config.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-10 15:36:59 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-10 15:36:59 +0200
commitc0ccf16c69d43a89674640c61d13ec2c02b128d6 (patch)
treeae840bc16f0ddb430bdd68aacef4d7cb2af970d9 /config.h
parent0d157fb407a35f8afe6d6f0f4c2cc5cd5d5a1933 (diff)
First working plugin: static-files
Diffstat (limited to 'config.h')
-rw-r--r--config.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/config.h b/config.h
index 4f788d8..61ad1ba 100644
--- a/config.h
+++ b/config.h
@@ -8,17 +8,11 @@
namespace fs = std::filesystem;
-enum PathType
-{
- Files, // serve files
- Plugin // delegate to plugin
-};
-
struct Path
{
std::string requested; // the requested path
- PathType type;
- std::unordered_map<std::string, std::string> params; // what to serve, e.g. which filesystem path, or which plugin
+ // default entries: "plugin", "target"
+ std::unordered_map<std::string, std::string> params; // what to serve, e.g. which filesystem path (target), and which plugin
};
struct Site
@@ -74,10 +68,17 @@ class Config
// secondary calculation functions
//
+ /// Root path in server's file system
/// param[in] requested_host e.g. www.domain.com:8080 or www.domain.com
std::string DocRoot(const Socket& socket, const std::string& requested_host, const std::string& requested_path) const;
+
+ /// Get name of plugin
std::string GetPlugin(const Socket& socket, const std::string& requested_host, const std::string& requested_path) const;
+ /// requested_path = GetPluginPath() / GetRelativePath()
+ std::string GetPluginPath(const Socket& socket, const std::string& requested_host, const std::string& requested_path) const;
+ std::string GetRelativePath(const Socket& socket, const std::string& requested_host, const std::string& requested_path) const;
+
// return true iff plugin "name" is mentioned in config
bool PluginIsConfigured(const std::string& name) const;