summaryrefslogtreecommitdiffhomepage
path: root/response.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'response.cpp')
-rw-r--r--response.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/response.cpp b/response.cpp
index 7bbcebf..e1b6c05 100644
--- a/response.cpp
+++ b/response.cpp
@@ -72,10 +72,16 @@ std::string extend_index_html(std::string path)
return path;
}
+bool is_ipv6_address(const std::string& addr)
+{
+ return addr.find(":") != addr.npos;
+}
+
std::unordered_map<std::string, std::function<std::string(Server&)>> GetServerParamFunctions{
// following are the supported fields:
{"version", [](Server& server) { return Server::VersionString; }},
{"address", [](Server& server) { return server.GetSocket().address; }},
+ {"ipv6", [](Server& server) { return is_ipv6_address(server.GetSocket().address) ? "yes" : "no"; }},
{"port", [](Server& server) { return server.GetSocket().port; }},
};