diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2000-07-25 02:58:22 +0200 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2000-07-25 02:58:22 +0200 |
commit | fc3580dd3b2452b9b24e2cce002bfe0ec3970e0b (patch) | |
tree | 3844e31bd895907ad0831603df8a99d371862a75 | |
parent | Changes to get Win32 compiling again, including substituting (diff) | |
download | apache2-fc3580dd3b2452b9b24e2cce002bfe0ec3970e0b.tar.xz apache2-fc3580dd3b2452b9b24e2cce002bfe0ec3970e0b.zip |
Missing apr_strings.h - hope this wasn't destined for some global header.
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
-rw-r--r-- | modules/aaa/mod_auth_digest.c | 3 | ||||
-rw-r--r-- | modules/arch/win32/mod_isapi.c | 219 | ||||
-rw-r--r-- | modules/cache/mod_file_cache.c | 1 | ||||
-rw-r--r-- | modules/mappers/mod_rewrite.c | 15 | ||||
-rw-r--r-- | modules/mappers/mod_so.c | 3 | ||||
-rw-r--r-- | modules/mappers/mod_speling.c | 1 | ||||
-rw-r--r-- | modules/metadata/mod_cern_meta.c | 2 | ||||
-rw-r--r-- | modules/metadata/mod_expires.c | 1 | ||||
-rw-r--r-- | modules/metadata/mod_usertrack.c | 1 | ||||
-rw-r--r-- | os/win32/mod_isapi.c | 219 | ||||
-rw-r--r-- | os/win32/util_win32.c | 1 | ||||
-rw-r--r-- | server/mpm/winnt/mpm_winnt.c | 7 | ||||
-rw-r--r-- | server/mpm/winnt/registry.c | 1 | ||||
-rw-r--r-- | server/mpm/winnt/service.c | 1 |
14 files changed, 309 insertions, 166 deletions
diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c index 00c7fc14be..2314884208 100644 --- a/modules/aaa/mod_auth_digest.c +++ b/modules/aaa/mod_auth_digest.c @@ -114,6 +114,7 @@ #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")) { diff --git a/modules/arch/win32/mod_isapi.c b/modules/arch/win32/mod_isapi.c index 847e147543..e9b0b9cbdf 100644 --- a/modules/arch/win32/mod_isapi.c +++ b/modules/arch/win32/mod_isapi.c @@ -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 */ }; diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index a0693cdc72..70c9c7144f 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -128,6 +128,7 @@ #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; diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 8df01965ba..88ae72d2dd 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -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; } diff --git a/modules/mappers/mod_so.c b/modules/mappers/mod_so.c index 90f01db345..90b9df62bf 100644 --- a/modules/mappers/mod_so.c +++ b/modules/mappers/mod_so.c @@ -133,6 +133,7 @@ #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, diff --git a/modules/mappers/mod_speling.c b/modules/mappers/mod_speling.c index 29faa63529..30a4c4ed7a 100644 --- a/modules/mappers/mod_speling.c +++ b/modules/mappers/mod_speling.c @@ -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 * diff --git a/modules/metadata/mod_cern_meta.c b/modules/metadata/mod_cern_meta.c index 346cbf0635..5900cfd1cf 100644 --- a/modules/metadata/mod_cern_meta.c +++ b/modules/metadata/mod_cern_meta.c @@ -155,6 +155,8 @@ #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 diff --git a/modules/metadata/mod_expires.c b/modules/metadata/mod_expires.c index bf52f13c81..e89073c163 100644 --- a/modules/metadata/mod_expires.c +++ b/modules/metadata/mod_expires.c @@ -201,6 +201,7 @@ #include "http_config.h" #include "http_log.h" #include "http_request.h" +#include "apr_strings.h" typedef struct { int active; diff --git a/modules/metadata/mod_usertrack.c b/modules/metadata/mod_usertrack.c index 7698f24c86..6fa2f5613e 100644 --- a/modules/metadata/mod_usertrack.c +++ b/modules/metadata/mod_usertrack.c @@ -104,6 +104,7 @@ #include "http_config.h" #include "http_core.h" #include "http_request.h" +#include "apr_strings.h" module MODULE_VAR_EXPORT usertrack_module; diff --git a/os/win32/mod_isapi.c b/os/win32/mod_isapi.c index 847e147543..e9b0b9cbdf 100644 --- a/os/win32/mod_isapi.c +++ b/os/win32/mod_isapi.c @@ -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 */ }; diff --git a/os/win32/util_win32.c b/os/win32/util_win32.c index 9b6b388da0..8dd410bd80 100644 --- a/os/win32/util_win32.c +++ b/os/win32/util_win32.c @@ -58,6 +58,7 @@ #include "httpd.h" #include "http_log.h" +#include "apr_strings.h" #include <stdarg.h> #include <time.h> diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 18c34ffb36..3b64713610 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -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; } diff --git a/server/mpm/winnt/registry.c b/server/mpm/winnt/registry.c index 976931932a..893b0bfda9 100644 --- a/server/mpm/winnt/registry.c +++ b/server/mpm/winnt/registry.c @@ -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 diff --git a/server/mpm/winnt/service.c b/server/mpm/winnt/service.c index b5cab0b413..b81528e032 100644 --- a/server/mpm/winnt/service.c +++ b/server/mpm/winnt/service.c @@ -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; |