Pull in Apache 2.2 module.
[shibboleth/cpp-sp.git] / apache / mod_apache.cpp
index cae4c69..08654f3 100644 (file)
@@ -77,6 +77,7 @@ namespace {
     char* g_szSHIBConfig = NULL;
     char* g_szSchemaDir = NULL;
     ShibTargetConfig* g_Config = NULL;
+    string g_unsetHeaderValue;
     static const char* g_UserDataKey = "_shib_check_user_";
 }
 
@@ -294,6 +295,7 @@ public:
   }
   virtual void clearHeader(const string &name) {
     ap_table_unset(m_req->headers_in, name.c_str());
+    ap_table_set(m_req->headers_in, name.c_str(), g_unsetHeaderValue.c_str());
   }
   virtual void setHeader(const string &name, const string &value) {
     ap_table_set(m_req->headers_in, name.c_str(), value.c_str());
@@ -950,6 +952,15 @@ extern "C" void shib_child_init(apr_pool_t* p, server_rec* s)
             ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() failed to load configuration");
             exit(1);
         }
+
+        IConfig* conf=g_Config->getINI();
+        Locker locker(conf);
+        const IPropertySet* props=conf->getPropertySet("Local");
+        if (props) {
+            pair<bool,const char*> unsetValue=props->getString("unsetHeaderValue");
+            if (unsetValue.first)
+                g_unsetHeaderValue = unsetValue.second;
+        }
     }
     catch (...) {
         ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() failed to initialize system");
@@ -1037,7 +1048,7 @@ module MODULE_VAR_EXPORT mod_shib = {
     NULL                       /* post read-request */
 };
 
-#elif defined(SHIB_APACHE_20)
+#elif defined(SHIB_APACHE_20) || defined(SHIB_APACHE_22)
 
 extern "C" void shib_register_hooks (apr_pool_t *p)
 {