/*
- * Copyright 2001-2009 Internet2
+ * Copyright 2001-2010 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* AbstractSPRequest.cpp
*
- * Abstract base for SPRequest implementations
+ * Abstract base for SPRequest implementations.
*/
#include "internal.h"
if (!m_handlerURL.empty() && resource && !strcmp(getRequestURL(),resource))
return m_handlerURL.c_str();
+ string stackresource;
+ if (resource && *resource == '/') {
+ // Compute a URL to the root of the site and point resource at constructed string.
+ int port = getPort();
+ const char* scheme = getScheme();
+ stackresource = string(scheme) + "://" + getHostname();
+ if ((!strcmp(scheme,"http") && port!=80) || (!strcmp(scheme,"https") && port!=443)) {
+ ostringstream portstr;
+ portstr << port;
+ stackresource += ":" + portstr.str();
+ }
+ stackresource += resource;
+ resource = stackresource.c_str();
+ }
+
#ifdef HAVE_STRCASECMP
if (!resource || (strncasecmp(resource,"http://",7) && strncasecmp(resource,"https://",8)))
#else
(level == SPError ? Priority::ERROR : Priority::CRIT))))
);
}
-
-void AbstractSPRequest::setResponseHeader(const char* name, const char* value)
-{
-}
-
-long AbstractSPRequest::sendRedirect(const char* url)
-{
- return HTTPResponse::XMLTOOLING_HTTP_STATUS_MOVED;
-}