summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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