Move request cookie processing down to base class.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sun, 25 Nov 2007 23:36:14 +0000 (23:36 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sun, 25 Nov 2007 23:36:14 +0000 (23:36 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2635 cb58f699-b61c-0410-a6fe-9272a202ed29

shibsp/AbstractSPRequest.cpp
shibsp/AbstractSPRequest.h
shibsp/SPRequest.h
shibsp/impl/StorageServiceSessionCache.cpp

index cb2d3eb..6c6f6f9 100644 (file)
@@ -199,37 +199,6 @@ vector<const char*>::size_type AbstractSPRequest::getParameters(const char* name
     return values.size();
 }
 
-const char* AbstractSPRequest::getCookie(const char* name) const
-{
-    if (m_cookieMap.empty()) {
-        string cookies=getHeader("Cookie");
-
-        string::size_type pos=0,cname,namelen,val,vallen;
-        while (pos !=string::npos && pos < cookies.length()) {
-            while (isspace(cookies[pos])) pos++;
-            cname=pos;
-            pos=cookies.find_first_of("=",pos);
-            if (pos == string::npos)
-                break;
-            namelen=pos-cname;
-            pos++;
-            if (pos==cookies.length())
-                break;
-            val=pos;
-            pos=cookies.find_first_of(";",pos);
-            if (pos != string::npos) {
-                vallen=pos-val;
-                pos++;
-                m_cookieMap.insert(make_pair(cookies.substr(cname,namelen),cookies.substr(val,vallen)));
-            }
-            else
-                m_cookieMap.insert(make_pair(cookies.substr(cname,namelen),cookies.substr(val)));
-        }
-    }
-    map<string,string>::const_iterator lookup=m_cookieMap.find(name);
-    return (lookup==m_cookieMap.end()) ? NULL : lookup->second.c_str();
-}
-
 const char* AbstractSPRequest::getHandlerURL(const char* resource) const
 {
     if (!resource)
index 7b710b0..adec1c0 100644 (file)
@@ -78,8 +78,6 @@ namespace shibsp {
 
         std::vector<const char*>::size_type getParameters(const char* name, std::vector<const char*>& values) const;
 
-        const char* getCookie(const char* name) const;
-
         const char* getHandlerURL(const char* resource=NULL) const;
 
         void log(SPLogLevel level, const std::string& msg) const;
@@ -97,7 +95,6 @@ namespace shibsp {
         mutable std::string m_url;
         void* m_log; // declared void* to avoid log4cpp header conflicts in Apache
         mutable std::string m_handlerURL;
-        mutable std::map<std::string,std::string> m_cookieMap;
         mutable CGIParser* m_parser;
     };
 
index 7cc7bf7..97fadc6 100644 (file)
@@ -91,14 +91,6 @@ namespace shibsp {
         virtual const char* getHandlerURL(const char* resource=NULL) const=0;
 
         /**
-         * Get a cookie value supplied by the client.
-         * 
-         * @param name  name of cookie
-         * @return  cookie value or NULL
-         */
-        virtual const char* getCookie(const char* name) const=0;
-        
-        /**
          * Returns a non-spoofable request header value, if possible.
          * Platforms that support environment export can redirect header
          * lookups by overriding this method.
index 8c1d921..155e8ae 100644 (file)
@@ -285,10 +285,10 @@ namespace shibsp {
     }
 }
 
-void SHIBSP_API shibsp::registerSessionCaches()\r
-{\r
-    SPConfig::getConfig().SessionCacheManager.registerFactory(STORAGESERVICE_SESSION_CACHE, StorageServiceCacheFactory);\r
-}\r
+void SHIBSP_API shibsp::registerSessionCaches()
+{
+    SPConfig::getConfig().SessionCacheManager.registerFactory(STORAGESERVICE_SESSION_CACHE, StorageServiceCacheFactory);
+}
 
 void StoredSession::unmarshallAttributes() const
 {
@@ -656,27 +656,27 @@ SSCache::SSCache(const DOMElement* e)
 #endif
         m_root(e), m_inprocTimeout(900), m_lock(NULL), shutdown(false), shutdown_wait(NULL), cleanup_thread(NULL)
 {
-    static const XMLCh cacheTimeout[] =     UNICODE_LITERAL_12(c,a,c,h,e,T,i,m,e,o,u,t);\r
-    static const XMLCh inprocTimeout[] =    UNICODE_LITERAL_13(i,n,p,r,o,c,T,i,m,e,o,u,t);\r
+    static const XMLCh cacheTimeout[] =     UNICODE_LITERAL_12(c,a,c,h,e,T,i,m,e,o,u,t);
+    static const XMLCh inprocTimeout[] =    UNICODE_LITERAL_13(i,n,p,r,o,c,T,i,m,e,o,u,t);
     static const XMLCh _StorageService[] =  UNICODE_LITERAL_14(S,t,o,r,a,g,e,S,e,r,v,i,c,e);
 
     SPConfig& conf = SPConfig::getConfig();
     inproc = conf.isEnabled(SPConfig::InProcess);
 
     if (e) {
-        const XMLCh* tag=e->getAttributeNS(NULL,cacheTimeout);\r
-        if (tag && *tag) {\r
-            m_cacheTimeout = XMLString::parseInt(tag);\r
-            if (!m_cacheTimeout)\r
-                m_cacheTimeout=3600;\r
-        }\r
+        const XMLCh* tag=e->getAttributeNS(NULL,cacheTimeout);
+        if (tag && *tag) {
+            m_cacheTimeout = XMLString::parseInt(tag);
+            if (!m_cacheTimeout)
+                m_cacheTimeout=3600;
+        }
         if (inproc) {
-            const XMLCh* tag=e->getAttributeNS(NULL,inprocTimeout);\r
-            if (tag && *tag) {\r
-                m_inprocTimeout = XMLString::parseInt(tag);\r
-                if (!m_inprocTimeout)\r
-                    m_inprocTimeout=900;\r
-            }\r
+            const XMLCh* tag=e->getAttributeNS(NULL,inprocTimeout);
+            if (tag && *tag) {
+                m_inprocTimeout = XMLString::parseInt(tag);
+                if (!m_inprocTimeout)
+                    m_inprocTimeout=900;
+            }
         }
     }