diff options
Diffstat (limited to 'plugins/cgi/cgi.cpp')
-rw-r--r-- | plugins/cgi/cgi.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/cgi/cgi.cpp b/plugins/cgi/cgi.cpp index 232abff..9b06f7a 100644 --- a/plugins/cgi/cgi.cpp +++ b/plugins/cgi/cgi.cpp @@ -4,6 +4,7 @@ #include <boost/coroutine2/coroutine.hpp> #include <boost/process.hpp> +#include <algorithm> #include <filesystem> #include <fstream> #include <iostream> @@ -95,11 +96,11 @@ namespace { } std::unordered_map<std::string, std::function<void(std::string&, CGIContext&)>> headerMap { - { "Cache-control", [](std::string& v, CGIContext& c){ c.SetResponseHeader("cache_control", v); } }, + { "CACHE-CONTROL", [](std::string& v, CGIContext& c){ c.SetResponseHeader("cache_control", v); } }, - { "Content-Type", [](std::string& v, CGIContext& c){ c.SetResponseHeader("content_type", v); } }, + { "CONTENT-TYPE", [](std::string& v, CGIContext& c){ c.SetResponseHeader("content_type", v); } }, - { "Status", [](std::string& v, CGIContext& c) { + { "STATUS", [](std::string& v, CGIContext& c) { std::string status{"500"}; if (v.size() >= 3) { status = v.substr(0, 3); @@ -117,7 +118,7 @@ namespace { std::string key {s.substr(0, pos)}; std::string value {s.substr(pos + 2)}; - + std::transform(key.begin(), key.end(), key.begin(), ::toupper); auto it {headerMap.find(key)}; if (it == headerMap.end()) std::cout << "Warning: Unhandled CGI header: " << s << std::endl; |