]> granicus.if.org Git - apache/commitdiff
Missing apr_strings.h - hope this wasn't destined for some global header.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 25 Jul 2000 00:58:22 +0000 (00:58 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 25 Jul 2000 00:58:22 +0000 (00:58 +0000)
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85877 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
modules/aaa/mod_auth_digest.c
modules/arch/win32/mod_isapi.c
modules/cache/mod_file_cache.c
modules/mappers/mod_rewrite.c
modules/mappers/mod_so.c
modules/mappers/mod_speling.c
modules/metadata/mod_cern_meta.c
modules/metadata/mod_expires.c
modules/metadata/mod_usertrack.c
os/win32/mod_isapi.c
os/win32/util_win32.c
server/mpm/winnt/mpm_winnt.c
server/mpm/winnt/registry.c
server/mpm/winnt/service.c

index 00c7fc14bed370aabceef2b3f49f6308f75e3522..2314884208cbe767b8a8554def6293c41d6e28a9 100644 (file)
 #include "apr_time.h"
 #include "apr_errno.h"
 #include "apr_lock.h"
+#include "apr_strings.h"
 
 
 #if APR_HAS_SHARED_MEMORY
@@ -498,7 +499,7 @@ static const char *set_group_file(cmd_parms *cmd, void *config,
 static const char *set_qop(cmd_parms *cmd, void *config, const char *op)
 {
     digest_config_rec *conf = (digest_config_rec *) config;
-    const char **tmp;
+    char **tmp;
     int cnt;
 
     if (!strcasecmp(op, "none")) {
index 847e1475430115818be910cca4e08adb52185c21..e9b0b9cbdfe9fe3baab36f9a365720804bcfef33 100644 (file)
@@ -84,6 +84,8 @@
 #include "http_log.h"
 #include "util_script.h"
 #include "apr_portable.h"
+#include "apr_strings.h"
+
 
 /* We use the exact same header file as the original */
 #include <HttpExt.h>
@@ -211,11 +213,16 @@ int isapi_handler (request_rec *r)
     ecb->dwVersion = MAKELONG(0, 2);
     ecb->dwHttpStatusCode = 0;
     strcpy(ecb->lpszLogData, "");
-    ecb->lpszMethod = r->method;
-    ecb->lpszQueryString = ap_table_get(e, "QUERY_STRING");
-    ecb->lpszPathInfo = ap_table_get(e, "PATH_INFO");
-    ecb->lpszPathTranslated = ap_table_get(e, "PATH_TRANSLATED");
-    ecb->lpszContentType = ap_table_get(e, "CONTENT_TYPE");
+    // TODO: is a copy needed here?
+    ecb->lpszMethod = (char*) r->method;
+    // TODO: is a copy needed here?
+    ecb->lpszQueryString = (char*) ap_table_get(e, "QUERY_STRING");
+    // TODO: is a copy needed here?
+    ecb->lpszPathInfo = (char*) ap_table_get(e, "PATH_INFO");
+    // TODO: is a copy needed here?
+    ecb->lpszPathTranslated = (char*) ap_table_get(e, "PATH_TRANSLATED");
+    // TODO: is a copy needed here?
+    ecb->lpszContentType = (char*) ap_table_get(e, "CONTENT_TYPE");
 
     /* Set up client input */
     if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
@@ -290,8 +297,15 @@ int isapi_handler (request_rec *r)
         FreeLibrary(isapi_handle);
 
     switch(retval) {
-    case HSE_STATUS_SUCCESS:
-    case HSE_STATUS_SUCCESS_AND_KEEP_CONN:
+        case HSE_STATUS_SUCCESS:
+            /* TODO: If content length was missing or incorrect, and the response
+             * was not chunked, we need to close the connection here.
+             * If the response was chunked, and no closing chunk was sent, we aught
+             * to transmit one here
+             */
+
+            /* fall through... */
+        case HSE_STATUS_SUCCESS_AND_KEEP_CONN:
             /* Ignore the keepalive stuff; Apache handles it just fine without
              * the ISA's "advice".
              */
@@ -301,14 +315,24 @@ int isapi_handler (request_rec *r)
 
             return OK;
 
-    case HSE_STATUS_PENDING:    /* We don't support this */
-        ap_log_rerror(APLOG_MARK, APLOG_WARNING, APR_ENOTIMPL, r,
-                      "ISAPI asynchronous I/O not supported: %s", r->filename);
-        /* fallthrough */
-    case HSE_STATUS_ERROR:
-    default:
+        case HSE_STATUS_PENDING:    
+            /* We don't support this, but we need to... we should simply create a
+             * wait event and die on timeout or resume with the callback to our
+             * ServerSupportFunction with HSE_REQ_DONE_WITH_SESSION to emulate
+             * async behavior.
+             */
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING, APR_ENOTIMPL, r,
+                          "ISAPI asynchronous I/O not supported: %s", r->filename);
 
-        return HTTP_INTERNAL_SERVER_ERROR;
+        case HSE_STATUS_ERROR:    
+            /* end response if we have yet to do so.
+             */
+            return HTTP_INTERNAL_SERVER_ERROR;
+
+        default:
+            /* TODO: log unrecognized retval for debugging 
+             */
+            return HTTP_INTERNAL_SERVER_ERROR;
     }
 
 }
@@ -385,7 +409,9 @@ BOOL WINAPI WriteClient (HCONN ConnID, LPVOID Buffer, LPDWORD lpwdwBytes,
 
 BOOL WINAPI ReadClient (HCONN ConnID, LPVOID lpvBuffer, LPDWORD lpdwSize)
 {
-    /* Doesn't need to do anything; we've read all the data already */
+    /* If the request was a huge transmit or chunked, continue piping the
+     * request here, but if it's of a sane size, continue to ...
+     */
     return TRUE;
 }
 
@@ -399,35 +425,51 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
     char *data;
 
     switch (dwHSERequest) {
-    case HSE_REQ_SEND_URL_REDIRECT_RESP:
-        /* Set the status to be returned when the HttpExtensionProc()
-         * is done.
-         */
-        ap_table_set (r->headers_out, "Location", lpvBuffer);
-        cid->status = cid->r->status = cid->ecb->dwHttpStatusCode =
-            HTTP_MOVED_TEMPORARILY;
-        return TRUE;
+        case HSE_REQ_SEND_URL_REDIRECT_RESP:
+            /* Set the status to be returned when the HttpExtensionProc()
+             * is done.
+             */
+            ap_table_set (r->headers_out, "Location", lpvBuffer);
+            cid->status = cid->r->status = cid->ecb->dwHttpStatusCode =
+                HTTP_MOVED_TEMPORARILY;
+            return TRUE;
 
-    case HSE_REQ_SEND_URL:
-        /* Read any additional input */
+        case HSE_REQ_SEND_URL:
+            /* Read any additional input */
 
-        if (r->remaining > 0) {
-            char argsbuffer[HUGE_STRING_LEN];
+            if (r->remaining > 0) {
+                char argsbuffer[HUGE_STRING_LEN];
 
-            while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN));
-        }
+                while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN));
+            }
 
-        /* Reset the method to GET */
-        r->method = ap_pstrdup(r->pool, "GET");
-        r->method_number = M_GET;
+            /* Reset the method to GET */
+            r->method = ap_pstrdup(r->pool, "GET");
+            r->method_number = M_GET;
 
-        /* Don't let anyone think there's still data */
-        ap_table_unset(r->headers_in, "Content-Length");
+            /* Don't let anyone think there's still data */
+            ap_table_unset(r->headers_in, "Content-Length");
 
-        ap_internal_redirect((char *)lpvBuffer, r);
-        return TRUE;
+            ap_internal_redirect((char *)lpvBuffer, r);
+            return TRUE;
 
-    case HSE_REQ_SEND_RESPONSE_HEADER:
+        case HSE_REQ_SEND_RESPONSE_HEADER_EX:
+            if (((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszStatus
+                && ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchStatus)
+                r->status_line = ap_pstrndup(r->pool, 
+                                             ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszStatus,
+                                             ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchStatus);
+            else
+                r->status_line = ap_pstrdup(r->pool, "200 OK");
+            sscanf(r->status_line, "%d", &r->status);
+            cid->ecb->dwHttpStatusCode = r->status;
+
+          ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszHeader; // HTTP header
+          ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchHeader; // HTTP header len
+          
+          ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->fKeepConn; // Keep alive? (bool)
+
+        case HSE_REQ_SEND_RESPONSE_HEADER:
             r->status_line = lpvBuffer ? lpvBuffer : ap_pstrdup(r->pool, "200 OK");
             sscanf(r->status_line, "%d", &r->status);
             cid->ecb->dwHttpStatusCode = r->status;
@@ -472,20 +514,20 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
                 /* End of headers */
                 if (*data == '\0') {
 #ifdef RELAX_HEADER_RULE
-                        if (lf)
+                    if (lf)
 #endif
-                        data = lf + 1;  /* Reset data */
-                        break;
+                    data = lf + 1;  /* Reset data */
+                    break;
                 }
 
                 if (!(value = strchr(data, ':'))) {
-                        SetLastError(TODO_ERROR);
-                        /* ### euh... we're passing the wrong type of error
-                           ### code here */
-                        ap_log_rerror(APLOG_MARK, APLOG_ERR,
-                                      HTTP_INTERNAL_SERVER_ERROR, r,
-                                      "ISA sent invalid headers", r->filename);
-                        return FALSE;
+                    SetLastError(TODO_ERROR);
+                    /* ### euh... we're passing the wrong type of error
+                       ### code here */
+                    ap_log_rerror(APLOG_MARK, APLOG_ERR,
+                                  HTTP_INTERNAL_SERVER_ERROR, r,
+                                  "ISA sent invalid headers", r->filename);
+                    return FALSE;
                 }
 
                 *value++ = '\0';
@@ -497,15 +539,15 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
                  */
 
                 if (!strcasecmp(data, "Content-Type")) {
-                        char *tmp;
-                        /* Nuke trailing whitespace */
-                
-                        char *endp = value + strlen(value) - 1;
-                        while (endp > value && ap_isspace(*endp)) *endp-- = '\0';
-
-                        tmp = ap_pstrdup (r->pool, value);
-                        ap_str_tolower(tmp);
-                        r->content_type = tmp;
+                    char *tmp;
+                    /* Nuke trailing whitespace */
+            
+                    char *endp = value + strlen(value) - 1;
+                    while (endp > value && ap_isspace(*endp)) *endp-- = '\0';
+
+                    tmp = ap_pstrdup (r->pool, value);
+                    ap_str_tolower(tmp);
+                    r->content_type = tmp;
                 }
                 else if (!strcasecmp(data, "Content-Length")) {
                     ap_table_set(r->headers_out, data, value);
@@ -514,16 +556,16 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
                     ap_table_set(r->headers_out, data, value);
                 }
                 else if (!strcasecmp(data, "Set-Cookie")) {
-                        ap_table_add(r->err_headers_out, data, value);
+                    ap_table_add(r->err_headers_out, data, value);
                 }
                 else {
-                        ap_table_merge(r->err_headers_out, data, value);
+                    ap_table_merge(r->err_headers_out, data, value);
                 }
 
                 /* Reset data */
 #ifdef RELAX_HEADER_RULE
                 if (!lf) {
-                        data += p;
+                    data += p;
                     break;
                 }
 #endif
@@ -539,39 +581,62 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
 
             return TRUE;
 
-    case HSE_REQ_MAP_URL_TO_PATH:
+        case HSE_REQ_MAP_URL_TO_PATH:
             /* Map a URL to a filename */
             subreq = ap_sub_req_lookup_uri(ap_pstrndup(r->pool, (char *)lpvBuffer,
-                                                  *lpdwSize), r);
+                                           *lpdwSize), r);
 
             GetFullPathName(subreq->filename, *lpdwSize - 1, (char *)lpvBuffer, NULL);
 
             /* IIS puts a trailing slash on directories, Apache doesn't */
 
             if (subreq->finfo.filetype == APR_DIR) {
-                    int l = strlen((char *)lpvBuffer);
+                int l = strlen((char *)lpvBuffer);
 
-                    ((char *)lpvBuffer)[l] = '\\';
-                    ((char *)lpvBuffer)[l + 1] = '\0';
+                ((char *)lpvBuffer)[l] = '\\';
+                ((char *)lpvBuffer)[l + 1] = '\0';
             }
 
             return TRUE;
 
-    case HSE_REQ_DONE_WITH_SESSION:
-            /* Do nothing... since we don't support async I/O, they'll
-             * return from HttpExtensionProc soon
+        case HSE_REQ_DONE_WITH_SESSION:
+            /* TODO: Signal the main request with the event to complete the session
              */
             return TRUE;
 
-    /* We don't support all this async I/O, Microsoft-specific stuff */
-    case HSE_REQ_IO_COMPLETION:
-    case HSE_REQ_TRANSMIT_FILE:
-        /* ### euh... we're passing the wrong type of error code here */
-        ap_log_rerror(APLOG_MARK, APLOG_WARNING,
-                      HTTP_INTERNAL_SERVER_ERROR, r,
-                      "ISAPI asynchronous I/O not supported: %s",
-                      r->filename);
-    default:
+        /* We don't support all this async I/O, Microsoft-specific stuff */
+        case HSE_REQ_IO_COMPLETION:
+            /* TODO: Emulate a completion port, if we can...
+             * Record the callback address and user defined argument...
+             * we will call this after any async request (including transmitfile)
+             * as if the request had been async.
+             */
+
+        case HSE_REQ_TRANSMIT_FILE:
+            /* Use TransmitFile (in leiu of WriteClient)... nothing wrong with that
+             */
+
+            /* ### euh... we're passing the wrong type of error code here */
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING,
+                          HTTP_INTERNAL_SERVER_ERROR, r,
+                          "ISAPI asynchronous I/O not supported: %s",
+                          r->filename);
+
+        case HSE_APPEND_LOG_PARAMETER:
+            /* Log lpvBuffer, of lpdwSize bytes */
+            return TRUE;
+
+        case HSE_REQ_ABORTIVE_CLOSE:
+        case HSE_REQ_ASYNC_READ_CLIENT:
+        case HSE_REQ_CLOSE_CONNECTION:
+        case HSE_REQ_GET_CERT_INFO_EX:
+        case HSE_REQ_GET_IMPERSONATION_TOKEN:
+        case HSE_REQ_GET_SSPI_INFO:
+        case HSE_REQ_IS_KEEP_CONN:
+        case HSE_REQ_MAP_URL_TO_PATH_EX:
+        case HSE_REQ_REFRESH_ISAPI_ACL:
+
+        default:
             SetLastError(ERROR_INVALID_PARAMETER);
             return FALSE;
     }
@@ -589,6 +654,6 @@ module isapi_module = {
    NULL,                        /* server config */
    NULL,                        /* merge server config */
    NULL,                        /* command ap_table_t */
-   isapi_handlers,      /* handlers */
+   isapi_handlers,              /* handlers */
    NULL                         /* register hooks */
 };
index a0693cdc720b8fdf6e008a79be00c670fd404bb0..70c9c7144ff23dda1a4e547032efbe21898cf550 100644 (file)
 #include "http_request.h"
 #include "http_core.h"
 #include "apr_mmap.h"
+#include "apr_strings.h"
 
 module MODULE_VAR_EXPORT file_cache_module;
 static int once_through = 0;
index 8df01965ba21b1bce3fb35de24f6a6edf56415f1..88ae72d2dd27257c9f6e0a5599524738ef875cdd 100644 (file)
@@ -96,6 +96,7 @@
 #include "http_log.h"
 #include "http_protocol.h"
 #include "mod_rewrite.h"
+#include "apr_strings.h"
 
 #if !defined(OS2) && !defined(WIN32)
 #include "unixd.h"
@@ -442,7 +443,7 @@ static const char *cmd_rewriteoptions_setoption(ap_pool_t *p, int *options,
     }
     else {
         return ap_pstrcat(p, "RewriteOptions: unknown option '",
-                          name, "'\n", NULL);
+                          name, "'", NULL);
     }
     return NULL;
 }
@@ -606,7 +607,7 @@ static const char *cmd_rewritecond(cmd_parms *cmd, rewrite_perdir_conf *dconf,
     /*  parse the argument line ourself */
     if (parseargline(str, &a1, &a2, &a3)) {
         return ap_pstrcat(cmd->pool, "RewriteCond: bad argument line '", str,
-                          "'\n", NULL);
+                          "'", NULL);
     }
 
     /*  arg1: the input string */
@@ -644,7 +645,7 @@ static const char *cmd_rewritecond(cmd_parms *cmd, rewrite_perdir_conf *dconf,
     if (rc) {
         return ap_pstrcat(cmd->pool,
                           "RewriteCond: cannot compile regular expression '",
-                          a2, "'\n", NULL);
+                          a2, "'", NULL);
     }
 
     newcond->pattern = ap_pstrdup(cmd->pool, cp);
@@ -717,7 +718,7 @@ static const char *cmd_rewritecond_setflag(ap_pool_t *p, rewritecond_entry *cfg,
         cfg->flags |= CONDFLAG_ORNEXT;
     }
     else {
-        return ap_pstrcat(p, "RewriteCond: unknown flag '", key, "'\n", NULL);
+        return ap_pstrcat(p, "RewriteCond: unknown flag '", key, "'", NULL);
     }
     return NULL;
 }
@@ -749,7 +750,7 @@ static const char *cmd_rewriterule(cmd_parms *cmd, rewrite_perdir_conf *dconf,
     /*  parse the argument line ourself */
     if (parseargline(str, &a1, &a2, &a3)) {
         return ap_pstrcat(cmd->pool, "RewriteRule: bad argument line '", str,
-                          "'\n", NULL);
+                          "'", NULL);
     }
 
     /* arg3: optional flags field */
@@ -780,7 +781,7 @@ static const char *cmd_rewriterule(cmd_parms *cmd, rewrite_perdir_conf *dconf,
     if ((regexp = ap_pregcomp(cmd->pool, cp, mode)) == NULL) {
         return ap_pstrcat(cmd->pool,
                           "RewriteRule: cannot compile regular expression '",
-                          a1, "'\n", NULL);
+                          a1, "'", NULL);
     }
     newrule->pattern = ap_pstrdup(cmd->pool, cp);
     newrule->regexp  = regexp;
@@ -952,7 +953,7 @@ static const char *cmd_rewriterule_setflag(ap_pool_t *p, rewriterule_entry *cfg,
         cfg->flags |= RULEFLAG_NOCASE;
     }
     else {
-        return ap_pstrcat(p, "RewriteRule: unknown flag '", key, "'\n", NULL);
+        return ap_pstrcat(p, "RewriteRule: unknown flag '", key, "'", NULL);
     }
     return NULL;
 }
index 90f01db345067925a05387eb9dcdaaeb52a2e931..90b9df62bfd07187f4217574ca30590d1778cc42 100644 (file)
 #include "http_log.h"
 #include "ap_config.h"
 #include "apr_dso.h"
+#include "apr_strings.h"
 
 module MODULE_VAR_EXPORT so_module;
 
@@ -257,7 +258,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
 
         return ap_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
                          " into server: ",
-                         ap_dso_error(modhandle, my_error, sizeof(my_error)),
+                         ap_strerror(status, my_error, sizeof(my_error)),
                          NULL);
     }
     ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
index 29faa63529e6fbd277146280977a24f0cc32067b..30a4c4ed7a6b54d06f9ba0108363ad72e20b2fb6 100644 (file)
@@ -64,6 +64,7 @@
 #include "http_request.h"
 #include "http_log.h"
 #include "apr_file_io.h"
+#include "apr_strings.h"
 
 /* mod_speling.c - by Alexei Kosut <akosut@organic.com> June, 1996
  *
index 346cbf063509c5cf70048ec7b7079f266c4a876c..5900cfd1cf55cad144c43b9552aba6dc5ac34fca 100644 (file)
 #include "util_script.h"
 #include "http_log.h"
 #include "http_request.h"
+#include "apr_strings.h"
+
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
index bf52f13c81b7083ad2fda940ae7a662dcdab1f2f..e89073c163a6dbe6187e41cf54b568ddef74b6a8 100644 (file)
 #include "http_config.h"
 #include "http_log.h"
 #include "http_request.h"
+#include "apr_strings.h"
 
 typedef struct {
     int active;
index 7698f24c861acab0f1bbe02ef5fe2477eae0b8a7..6fa2f5613ed8f72bba600551d028f067f377ca79 100644 (file)
 #include "http_config.h"
 #include "http_core.h"
 #include "http_request.h"
+#include "apr_strings.h"
 
 module MODULE_VAR_EXPORT usertrack_module;
 
index 847e1475430115818be910cca4e08adb52185c21..e9b0b9cbdfe9fe3baab36f9a365720804bcfef33 100644 (file)
@@ -84,6 +84,8 @@
 #include "http_log.h"
 #include "util_script.h"
 #include "apr_portable.h"
+#include "apr_strings.h"
+
 
 /* We use the exact same header file as the original */
 #include <HttpExt.h>
@@ -211,11 +213,16 @@ int isapi_handler (request_rec *r)
     ecb->dwVersion = MAKELONG(0, 2);
     ecb->dwHttpStatusCode = 0;
     strcpy(ecb->lpszLogData, "");
-    ecb->lpszMethod = r->method;
-    ecb->lpszQueryString = ap_table_get(e, "QUERY_STRING");
-    ecb->lpszPathInfo = ap_table_get(e, "PATH_INFO");
-    ecb->lpszPathTranslated = ap_table_get(e, "PATH_TRANSLATED");
-    ecb->lpszContentType = ap_table_get(e, "CONTENT_TYPE");
+    // TODO: is a copy needed here?
+    ecb->lpszMethod = (char*) r->method;
+    // TODO: is a copy needed here?
+    ecb->lpszQueryString = (char*) ap_table_get(e, "QUERY_STRING");
+    // TODO: is a copy needed here?
+    ecb->lpszPathInfo = (char*) ap_table_get(e, "PATH_INFO");
+    // TODO: is a copy needed here?
+    ecb->lpszPathTranslated = (char*) ap_table_get(e, "PATH_TRANSLATED");
+    // TODO: is a copy needed here?
+    ecb->lpszContentType = (char*) ap_table_get(e, "CONTENT_TYPE");
 
     /* Set up client input */
     if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
@@ -290,8 +297,15 @@ int isapi_handler (request_rec *r)
         FreeLibrary(isapi_handle);
 
     switch(retval) {
-    case HSE_STATUS_SUCCESS:
-    case HSE_STATUS_SUCCESS_AND_KEEP_CONN:
+        case HSE_STATUS_SUCCESS:
+            /* TODO: If content length was missing or incorrect, and the response
+             * was not chunked, we need to close the connection here.
+             * If the response was chunked, and no closing chunk was sent, we aught
+             * to transmit one here
+             */
+
+            /* fall through... */
+        case HSE_STATUS_SUCCESS_AND_KEEP_CONN:
             /* Ignore the keepalive stuff; Apache handles it just fine without
              * the ISA's "advice".
              */
@@ -301,14 +315,24 @@ int isapi_handler (request_rec *r)
 
             return OK;
 
-    case HSE_STATUS_PENDING:    /* We don't support this */
-        ap_log_rerror(APLOG_MARK, APLOG_WARNING, APR_ENOTIMPL, r,
-                      "ISAPI asynchronous I/O not supported: %s", r->filename);
-        /* fallthrough */
-    case HSE_STATUS_ERROR:
-    default:
+        case HSE_STATUS_PENDING:    
+            /* We don't support this, but we need to... we should simply create a
+             * wait event and die on timeout or resume with the callback to our
+             * ServerSupportFunction with HSE_REQ_DONE_WITH_SESSION to emulate
+             * async behavior.
+             */
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING, APR_ENOTIMPL, r,
+                          "ISAPI asynchronous I/O not supported: %s", r->filename);
 
-        return HTTP_INTERNAL_SERVER_ERROR;
+        case HSE_STATUS_ERROR:    
+            /* end response if we have yet to do so.
+             */
+            return HTTP_INTERNAL_SERVER_ERROR;
+
+        default:
+            /* TODO: log unrecognized retval for debugging 
+             */
+            return HTTP_INTERNAL_SERVER_ERROR;
     }
 
 }
@@ -385,7 +409,9 @@ BOOL WINAPI WriteClient (HCONN ConnID, LPVOID Buffer, LPDWORD lpwdwBytes,
 
 BOOL WINAPI ReadClient (HCONN ConnID, LPVOID lpvBuffer, LPDWORD lpdwSize)
 {
-    /* Doesn't need to do anything; we've read all the data already */
+    /* If the request was a huge transmit or chunked, continue piping the
+     * request here, but if it's of a sane size, continue to ...
+     */
     return TRUE;
 }
 
@@ -399,35 +425,51 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
     char *data;
 
     switch (dwHSERequest) {
-    case HSE_REQ_SEND_URL_REDIRECT_RESP:
-        /* Set the status to be returned when the HttpExtensionProc()
-         * is done.
-         */
-        ap_table_set (r->headers_out, "Location", lpvBuffer);
-        cid->status = cid->r->status = cid->ecb->dwHttpStatusCode =
-            HTTP_MOVED_TEMPORARILY;
-        return TRUE;
+        case HSE_REQ_SEND_URL_REDIRECT_RESP:
+            /* Set the status to be returned when the HttpExtensionProc()
+             * is done.
+             */
+            ap_table_set (r->headers_out, "Location", lpvBuffer);
+            cid->status = cid->r->status = cid->ecb->dwHttpStatusCode =
+                HTTP_MOVED_TEMPORARILY;
+            return TRUE;
 
-    case HSE_REQ_SEND_URL:
-        /* Read any additional input */
+        case HSE_REQ_SEND_URL:
+            /* Read any additional input */
 
-        if (r->remaining > 0) {
-            char argsbuffer[HUGE_STRING_LEN];
+            if (r->remaining > 0) {
+                char argsbuffer[HUGE_STRING_LEN];
 
-            while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN));
-        }
+                while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN));
+            }
 
-        /* Reset the method to GET */
-        r->method = ap_pstrdup(r->pool, "GET");
-        r->method_number = M_GET;
+            /* Reset the method to GET */
+            r->method = ap_pstrdup(r->pool, "GET");
+            r->method_number = M_GET;
 
-        /* Don't let anyone think there's still data */
-        ap_table_unset(r->headers_in, "Content-Length");
+            /* Don't let anyone think there's still data */
+            ap_table_unset(r->headers_in, "Content-Length");
 
-        ap_internal_redirect((char *)lpvBuffer, r);
-        return TRUE;
+            ap_internal_redirect((char *)lpvBuffer, r);
+            return TRUE;
 
-    case HSE_REQ_SEND_RESPONSE_HEADER:
+        case HSE_REQ_SEND_RESPONSE_HEADER_EX:
+            if (((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszStatus
+                && ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchStatus)
+                r->status_line = ap_pstrndup(r->pool, 
+                                             ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszStatus,
+                                             ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchStatus);
+            else
+                r->status_line = ap_pstrdup(r->pool, "200 OK");
+            sscanf(r->status_line, "%d", &r->status);
+            cid->ecb->dwHttpStatusCode = r->status;
+
+          ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszHeader; // HTTP header
+          ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchHeader; // HTTP header len
+          
+          ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->fKeepConn; // Keep alive? (bool)
+
+        case HSE_REQ_SEND_RESPONSE_HEADER:
             r->status_line = lpvBuffer ? lpvBuffer : ap_pstrdup(r->pool, "200 OK");
             sscanf(r->status_line, "%d", &r->status);
             cid->ecb->dwHttpStatusCode = r->status;
@@ -472,20 +514,20 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
                 /* End of headers */
                 if (*data == '\0') {
 #ifdef RELAX_HEADER_RULE
-                        if (lf)
+                    if (lf)
 #endif
-                        data = lf + 1;  /* Reset data */
-                        break;
+                    data = lf + 1;  /* Reset data */
+                    break;
                 }
 
                 if (!(value = strchr(data, ':'))) {
-                        SetLastError(TODO_ERROR);
-                        /* ### euh... we're passing the wrong type of error
-                           ### code here */
-                        ap_log_rerror(APLOG_MARK, APLOG_ERR,
-                                      HTTP_INTERNAL_SERVER_ERROR, r,
-                                      "ISA sent invalid headers", r->filename);
-                        return FALSE;
+                    SetLastError(TODO_ERROR);
+                    /* ### euh... we're passing the wrong type of error
+                       ### code here */
+                    ap_log_rerror(APLOG_MARK, APLOG_ERR,
+                                  HTTP_INTERNAL_SERVER_ERROR, r,
+                                  "ISA sent invalid headers", r->filename);
+                    return FALSE;
                 }
 
                 *value++ = '\0';
@@ -497,15 +539,15 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
                  */
 
                 if (!strcasecmp(data, "Content-Type")) {
-                        char *tmp;
-                        /* Nuke trailing whitespace */
-                
-                        char *endp = value + strlen(value) - 1;
-                        while (endp > value && ap_isspace(*endp)) *endp-- = '\0';
-
-                        tmp = ap_pstrdup (r->pool, value);
-                        ap_str_tolower(tmp);
-                        r->content_type = tmp;
+                    char *tmp;
+                    /* Nuke trailing whitespace */
+            
+                    char *endp = value + strlen(value) - 1;
+                    while (endp > value && ap_isspace(*endp)) *endp-- = '\0';
+
+                    tmp = ap_pstrdup (r->pool, value);
+                    ap_str_tolower(tmp);
+                    r->content_type = tmp;
                 }
                 else if (!strcasecmp(data, "Content-Length")) {
                     ap_table_set(r->headers_out, data, value);
@@ -514,16 +556,16 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
                     ap_table_set(r->headers_out, data, value);
                 }
                 else if (!strcasecmp(data, "Set-Cookie")) {
-                        ap_table_add(r->err_headers_out, data, value);
+                    ap_table_add(r->err_headers_out, data, value);
                 }
                 else {
-                        ap_table_merge(r->err_headers_out, data, value);
+                    ap_table_merge(r->err_headers_out, data, value);
                 }
 
                 /* Reset data */
 #ifdef RELAX_HEADER_RULE
                 if (!lf) {
-                        data += p;
+                    data += p;
                     break;
                 }
 #endif
@@ -539,39 +581,62 @@ BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
 
             return TRUE;
 
-    case HSE_REQ_MAP_URL_TO_PATH:
+        case HSE_REQ_MAP_URL_TO_PATH:
             /* Map a URL to a filename */
             subreq = ap_sub_req_lookup_uri(ap_pstrndup(r->pool, (char *)lpvBuffer,
-                                                  *lpdwSize), r);
+                                           *lpdwSize), r);
 
             GetFullPathName(subreq->filename, *lpdwSize - 1, (char *)lpvBuffer, NULL);
 
             /* IIS puts a trailing slash on directories, Apache doesn't */
 
             if (subreq->finfo.filetype == APR_DIR) {
-                    int l = strlen((char *)lpvBuffer);
+                int l = strlen((char *)lpvBuffer);
 
-                    ((char *)lpvBuffer)[l] = '\\';
-                    ((char *)lpvBuffer)[l + 1] = '\0';
+                ((char *)lpvBuffer)[l] = '\\';
+                ((char *)lpvBuffer)[l + 1] = '\0';
             }
 
             return TRUE;
 
-    case HSE_REQ_DONE_WITH_SESSION:
-            /* Do nothing... since we don't support async I/O, they'll
-             * return from HttpExtensionProc soon
+        case HSE_REQ_DONE_WITH_SESSION:
+            /* TODO: Signal the main request with the event to complete the session
              */
             return TRUE;
 
-    /* We don't support all this async I/O, Microsoft-specific stuff */
-    case HSE_REQ_IO_COMPLETION:
-    case HSE_REQ_TRANSMIT_FILE:
-        /* ### euh... we're passing the wrong type of error code here */
-        ap_log_rerror(APLOG_MARK, APLOG_WARNING,
-                      HTTP_INTERNAL_SERVER_ERROR, r,
-                      "ISAPI asynchronous I/O not supported: %s",
-                      r->filename);
-    default:
+        /* We don't support all this async I/O, Microsoft-specific stuff */
+        case HSE_REQ_IO_COMPLETION:
+            /* TODO: Emulate a completion port, if we can...
+             * Record the callback address and user defined argument...
+             * we will call this after any async request (including transmitfile)
+             * as if the request had been async.
+             */
+
+        case HSE_REQ_TRANSMIT_FILE:
+            /* Use TransmitFile (in leiu of WriteClient)... nothing wrong with that
+             */
+
+            /* ### euh... we're passing the wrong type of error code here */
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING,
+                          HTTP_INTERNAL_SERVER_ERROR, r,
+                          "ISAPI asynchronous I/O not supported: %s",
+                          r->filename);
+
+        case HSE_APPEND_LOG_PARAMETER:
+            /* Log lpvBuffer, of lpdwSize bytes */
+            return TRUE;
+
+        case HSE_REQ_ABORTIVE_CLOSE:
+        case HSE_REQ_ASYNC_READ_CLIENT:
+        case HSE_REQ_CLOSE_CONNECTION:
+        case HSE_REQ_GET_CERT_INFO_EX:
+        case HSE_REQ_GET_IMPERSONATION_TOKEN:
+        case HSE_REQ_GET_SSPI_INFO:
+        case HSE_REQ_IS_KEEP_CONN:
+        case HSE_REQ_MAP_URL_TO_PATH_EX:
+        case HSE_REQ_REFRESH_ISAPI_ACL:
+
+        default:
             SetLastError(ERROR_INVALID_PARAMETER);
             return FALSE;
     }
@@ -589,6 +654,6 @@ module isapi_module = {
    NULL,                        /* server config */
    NULL,                        /* merge server config */
    NULL,                        /* command ap_table_t */
-   isapi_handlers,      /* handlers */
+   isapi_handlers,              /* handlers */
    NULL                         /* register hooks */
 };
index 9b6b388da02b39071400c0ee4ed3d948c439e445..8dd410bd803645de1ef39397e861a8ed9b136f63 100644 (file)
@@ -58,6 +58,7 @@
 
 #include "httpd.h"
 #include "http_log.h"
+#include "apr_strings.h"
 
 #include <stdarg.h>
 #include <time.h>
index 18c34ffb363e158710530363af1b106177c794b5..3b64713610985a4de547747f9d52b519ec7aa860 100644 (file)
@@ -65,6 +65,7 @@
 #include "http_connection.h"
 #include "apr_portable.h"
 #include "apr_getopt.h"
+#include "apr_strings.h"
 #include "ap_mpm.h"
 #include "ap_config.h"
 #include "ap_listen.h"
@@ -780,8 +781,8 @@ static PCOMP_CONTEXT win9x_get_connection(PCOMP_CONTEXT context)
         context->sa_client = ap_palloc(context->ptrans, len);
         if ((getpeername(context->accept_socket,
                          context->sa_client, &len)) == SOCKET_ERROR) {
-            ap_log_error(APLOG_MARK, APLOG_WARNING, h_errno, server_conf, 
-                         "getpeername failed with error %d\n", WSAGetLastError());
+            ap_log_error(APLOG_MARK, APLOG_WARNING, WSAGetLastError(), server_conf, 
+                         "getpeername failed");
             memset(&context->sa_client, '\0', sizeof(context->sa_client));
         }
 
@@ -1510,7 +1511,7 @@ static int create_process(ap_pool_t *p, HANDLE *handles, HANDLE *events, int *pr
     /* Create a pipe to send socket info to the child */
     if (!CreatePipe(&hPipeRead, &hPipeWrite, &sa, 0)) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
-                     "Parent: Unable to create pipe to child process.\n");
+                     "Parent: Unable to create pipe to child process.");
         return -1;
     }
 
index 976931932a3fe19cf807ab850517ae92024f8bbd..893b0bfda90e2f40b7f9fe91475bb544eee0d853 100644 (file)
@@ -76,6 +76,7 @@
 #include "httpd.h"
 #include "http_log.h"
 #include "mpm_winnt.h"
+#include "apr_strings.h"
 
 /* bet you are looking to change revisions to roll the tarball...
  * Guess what, you already did.  Revised May '00 to save you from 
index b5cab0b413a013057fb055868538ff034f177fb0..b81528e032954e85d29c3bf5bc1d0e69b49918c0 100644 (file)
@@ -86,6 +86,7 @@
 #include "http_conf_globals.h"
 #include "http_log.h"
 #include "mpm_winnt.h"
+#include "apr_strings.h"
 
 char *service_name = NULL;
 char *display_name = NULL;