Fix ISAPI access to method and content type.
authorScott Cantor <cantor.2@osu.edu>
Fri, 13 Mar 2009 21:04:45 +0000 (21:04 +0000)
committerScott Cantor <cantor.2@osu.edu>
Fri, 13 Mar 2009 21:04:45 +0000 (21:04 +0000)
isapi_shib/isapi_shib.cpp
shibsp/handler/impl/AbstractHandler.cpp
shibsp/shibsp.vcproj

index f716871..41a87ca 100644 (file)
@@ -401,10 +401,15 @@ public:
   int getPort() const {
     return m_port;
   }
+  const char* getQueryString() const {
+      const char* uri = getRequestURI();
+      uri = (uri ? strchr(uri, '?') : NULL);
+      return uri ? (uri + 1) : NULL;
+  }
   const char* getMethod() const {
     if (m_method.empty()) {
         dynabuf var(5);
-        GetServerVariable(m_pfc,"REQUEST_METHOD",var,5,false);
+        GetServerVariable(m_pfc,"HTTP_METHOD",var,5,false);
         if (!var.empty())
             m_method = var;
     }
@@ -413,15 +418,12 @@ public:
   string getContentType() const {
     if (m_content_type.empty()) {
         dynabuf var(32);
-        GetServerVariable(m_pfc,"CONTENT_TYPE",var,32,false);
+        GetServerVariable(m_pfc,"HTTP_CONTENT_TYPE",var,32,false);
         if (!var.empty())
             m_content_type = var;
     }
     return m_content_type;
   }
-  long getContentLength() const {
-      return 0;
-  }
   string getRemoteAddr() const {
     m_remote_addr = AbstractSPRequest::getRemoteAddr();
     if (m_remote_addr.empty()) {
@@ -528,8 +530,8 @@ public:
   }
 
   // The filter never processes the POST, so stub these methods.
-  const char* getQueryString() const { throw IOException("getQueryString not implemented"); }
-  const char* getRequestBody() const { throw IOException("getRequestBody not implemented"); }
+  long getContentLength() const { throw IOException("The request's Content-Length is not available to an ISAPI filter."); }
+  const char* getRequestBody() const { throw IOException("The request body is not available to an ISAPI filter."); }
 };
 
 DWORD WriteClientError(PHTTP_FILTER_CONTEXT pfc, const char* msg)
index c26acdc..0fe6aeb 100644 (file)
@@ -422,8 +422,11 @@ void AbstractHandler::preservePostData(
     const Application& application, const HTTPRequest& request, HTTPResponse& response, const char* relayState
     ) const
 {
-    if (strcmp(request.getMethod(), "POST"))
-        return;
+#ifdef HAVE_STRCASECMP
+    if (strcasecmp(request.getMethod(), "POST")) return;
+#else
+    if (stricmp(request.getMethod(), "POST")) return;
+#endif
 
     // No specs mean no save.
     const PropertySet* props=application.getPropertySet("Sessions");
@@ -634,5 +637,5 @@ DDF AbstractHandler::getPostData(const Application& application, const HTTPReque
     else {
         m_log.info("ignoring POST data with non-standard encoding (%s)", contentType.c_str());
     }
-    return NULL;
+    return DDF();
 }
index 8e6d5f7..abd0600 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\ApplicationAwarePlugin.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\base.h"\r
                                >\r
                        </File>\r