/*
- * Copyright 2001-2007 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"
+#include "exceptions.h"
#include "AbstractSPRequest.h"
#include "Application.h"
#include "ServiceProvider.h"
#include "SessionCache.h"
+#include "util/CGIParser.h"
using namespace shibsp;
using namespace opensaml;
using namespace xmltooling;
using namespace std;
+SPRequest::SPRequest()
+{
+}
+
+SPRequest::~SPRequest()
+{
+}
+
+string SPRequest::getSecureHeader(const char* name) const
+{
+ return getHeader(name);
+}
+
+void SPRequest::setAuthType(const char* authtype)
+{
+}
+
AbstractSPRequest::AbstractSPRequest(const char* category)
: m_sp(NULL), m_mapper(NULL), m_app(NULL), m_sessionTried(false), m_session(NULL),
m_log(&Category::getInstance(category)), m_parser(NULL)
delete m_parser;
}
+const ServiceProvider& AbstractSPRequest::getServiceProvider() const
+{
+ return *m_sp;
+}
+
RequestMapper::Settings AbstractSPRequest::getRequestSettings() const
{
if (!m_mapper) {
m_uri += uri;
break;
}
- else if (*uri == ';') {
- // If this is Java being stupid, skip everything up to the query string, if any.
- if (!strncmp(uri, ";jsessionid=", 12)) {
- if (uri = strchr(uri, '?'))
- m_uri += uri;
- break;
- }
- else {
- m_uri += *uri;
- }
- }
else if (*uri != '%') {
m_uri += *uri;
}
}
}
+const char* AbstractSPRequest::getRequestURI() const
+{
+ return m_uri.c_str();
+}
+
const char* AbstractSPRequest::getRequestURL() const
{
if (m_url.empty()) {
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