From 69b0974cbb6ada27d5bbdf0930e3a225acbaf8fb Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 19 Apr 2020 16:27:43 +0200 Subject: Bugfix: Add missing CGI variables: HTTPS, HTTP_REFERER, HTTP_COOKIE --- Makefile | 2 ++ plugins/cgi/cgi.cpp | 3 +++ response.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 0d611e0..bc4977b 100644 --- a/Makefile +++ b/Makefile @@ -124,6 +124,8 @@ deb: dpkg-buildpackage -us -uc -rfakeroot deb-src: + dh_clean + dh_auto_clean dpkg-source -b -I.git -Iresult . $(DISTROS): deb-src diff --git a/plugins/cgi/cgi.cpp b/plugins/cgi/cgi.cpp index b8c2470..318dd1f 100644 --- a/plugins/cgi/cgi.cpp +++ b/plugins/cgi/cgi.cpp @@ -168,6 +168,9 @@ namespace { env["HTTP_CONNECTION"] = c.GetRequestParam("http_connection"); env["HTTP_HOST"] = c.GetRequestParam("http_host"); env["HTTP_USER_AGENT"] = c.GetRequestParam("http_user_agent"); + env["HTTP_REFERER"] = c.GetRequestParam("referer"); + env["HTTP_COOKIE"] = c.GetRequestParam("cookie"); + env["HTTPS"] = c.GetRequestParam("https"); } std::string executeFile(const fs::path& filename, CGIContext& context) diff --git a/response.cpp b/response.cpp index 52081f6..51c9603 100644 --- a/response.cpp +++ b/response.cpp @@ -123,6 +123,8 @@ std::unordered_map> Get return "HTTP/"s + std::to_string(major) + "."s + std::to_string(minor); }}, + {"https", [](RequestContext& req_ctx) { return req_ctx.GetSocket().protocol == SocketProtocol::HTTPS ? "on" : "off"; }}, + {"location", [](RequestContext& req_ctx) { return req_ctx.GetTarget(); }}, {"method", [](RequestContext& req_ctx) { return std::string{req_ctx.GetReq().method_string()};}}, -- cgit v1.2.3