diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-10-15 01:00:16 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-10-15 01:00:16 +0100 |
commit | 062bad107fb98c58b8496930f328ae8a9f2397df (patch) | |
tree | eeaa52ddd7990562944d857c23614dfb2366ecd8 | |
parent | Remove legacy definedDirs.h in favour of adhocutils' (diff) | |
download | project2-062bad107fb98c58b8496930f328ae8a9f2397df.tar.bz2 project2-062bad107fb98c58b8496930f328ae8a9f2397df.tar.xz project2-062bad107fb98c58b8496930f328ae8a9f2397df.zip |
Handle redirect URL being a complete URL, fixes behaviour in Apache 2.4.17project2-1.2.2
-rw-r--r-- | project2/cgi/cgiRequestContext.cpp | 12 |
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 |