summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-15 01:00:16 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-15 01:00:16 +0100
commit062bad107fb98c58b8496930f328ae8a9f2397df (patch)
treeeeaa52ddd7990562944d857c23614dfb2366ecd8
parentRemove legacy definedDirs.h in favour of adhocutils' (diff)
downloadproject2-1.2.2.tar.bz2
project2-1.2.2.tar.xz
project2-1.2.2.zip
Handle redirect URL being a complete URL, fixes behaviour in Apache 2.4.17project2-1.2.2
-rw-r--r--project2/cgi/cgiRequestContext.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/project2/cgi/cgiRequestContext.cpp b/project2/cgi/cgiRequestContext.cpp
index 24de206..94d0973 100644
--- a/project2/cgi/cgiRequestContext.cpp
+++ b/project2/cgi/cgiRequestContext.cpp
@@ -60,7 +60,17 @@ CgiRequestContext::getRequestMethod() const
std::string
CgiRequestContext::getRedirectURL() const
{
- return cgi.getEnvironment().getRedirectURL();
+ auto rdurl = cgi.getEnvironment().getRedirectURL();
+ auto css = (int)rdurl.find("://");
+ if (css > -1) {
+ auto s = rdurl.find('/', css + 3);
+ auto qm = (int)rdurl.find('?', s);
+ if (qm > -1) {
+ return rdurl.substr(s, qm - s);
+ }
+ return rdurl.substr(s);
+ }
+ return rdurl;
}
std::string