mod_isapi.c revision 8b02d65f24f85548965ccaef1d8fcd299f5db408
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* ====================================================================
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * The Apache Software License, Version 1.1
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Copyright (c) 2000 The Apache Software Foundation. All rights
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * reserved.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Redistribution and use in source and binary forms, with or without
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * modification, are permitted provided that the following conditions
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * are met:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 1. Redistributions of source code must retain the above copyright
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * notice, this list of conditions and the following disclaimer.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 2. Redistributions in binary form must reproduce the above copyright
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * notice, this list of conditions and the following disclaimer in
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the documentation and/or other materials provided with the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * distribution.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 3. The end-user documentation included with the redistribution,
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * if any, must include the following acknowledgment:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * "This product includes software developed by the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Apache Software Foundation (http://www.apache.org/)."
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Alternately, this acknowledgment may appear in the software itself,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * if and wherever such third-party acknowledgments normally appear.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 4. The names "Apache" and "Apache Software Foundation" must
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * not be used to endorse or promote products derived from this
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * software without prior written permission. For written
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * permission, please contact apache@apache.org.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 5. Products derived from this software may not be called "Apache",
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * nor may "Apache" appear in their name, without prior written
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * permission of the Apache Software Foundation.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * SUCH DAMAGE.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ====================================================================
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * This software consists of voluntary contributions made by many
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * individuals on behalf of the Apache Software Foundation. For more
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * information on the Apache Software Foundation, please see
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * <http://www.apache.org/>.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Portions of this software are based upon public domain software
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * originally written at the National Center for Supercomputing Applications,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * University of Illinois, Urbana-Champaign.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/*
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * mod_isapi.c - Internet Server Application (ISA) module for Apache
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * by Alexei Kosut <akosut@apache.org>
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * This module implements Microsoft's ISAPI, allowing Apache (when running
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * under Windows) to load Internet Server Applications (ISAPI extensions).
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * It implements all of the ISAPI 2.0 specification, except for the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * "Microsoft-only" extensions dealing with asynchronous I/O. All ISAPI
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * extensions that use only synchronous I/O and are compatible with the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ISAPI 2.0 specification should work (most ISAPI 1.0 extensions should
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * function as well).
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * To load, simply place the ISA in a location in the document tree.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Then add an "AddHandler isapi-isa dll" into your config file.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * You should now be able to load ISAPI DLLs just be reffering to their
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * URLs. Make sure the ExecCGI option is active in the directory
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the ISA is in.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "ap_config.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "httpd.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "http_config.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "http_core.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "http_protocol.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "http_request.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "http_log.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "util_script.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "apr_portable.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include "apr_strings.h"
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* We use the exact same header file as the original */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#include <HttpExt.h>
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* TODO: Unknown errors that must be researched for correct codes */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#define TODO_ERROR 1
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* Seems IIS does not enforce the requirement for \r\n termination on HSE_REQ_SEND_RESPONSE_HEADER,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz define this to conform */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#define RELAX_HEADER_RULE
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzmodule isapi_module;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* Declare the ISAPI functions */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzBOOL WINAPI GetServerVariable (HCONN hConn, LPSTR lpszVariableName,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz LPVOID lpvBuffer, LPDWORD lpdwSizeofBuffer);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzBOOL WINAPI WriteClient (HCONN ConnID, LPVOID Buffer, LPDWORD lpwdwBytes,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz DWORD dwReserved);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzBOOL WINAPI ReadClient (HCONN ConnID, LPVOID lpvBuffer, LPDWORD lpdwSize);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzBOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz LPVOID lpvBuffer, LPDWORD lpdwSize,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz LPDWORD lpdwDataType);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/*
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz The optimiser blows it totally here. What happens is that autos are addressed relative to the
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd stack pointer, which, of course, moves around. The optimiser seems to lose track of it somewhere
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd between setting HttpExtensionProc's address and calling through it. We work around the problem by
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd forcing it to use frame pointers.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd The revisions below may eliminate this artifact.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd*/
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#pragma optimize("y",off)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/* Our loaded isapi module description structure */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndtypedef struct {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd HINSTANCE handle;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd HSE_VERSION_INFO *pVer;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd PFN_GETEXTENSIONVERSION GetExtensionVersion;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd PFN_HTTPEXTENSIONPROC HttpExtensionProc;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd PFN_TERMINATEEXTENSION TerminateExtension;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd int refcount;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz DWORD timeout;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz BOOL fakeasync;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz DWORD reportversion;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd} isapi_loaded;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/* Our "Connection ID" structure */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndtypedef struct {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd LPEXTENSION_CONTROL_BLOCK ecb;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd isapi_loaded *isa;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd request_rec *r;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd PFN_HSE_IO_COMPLETION completion;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd PVOID completion_arg;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd HANDLE complete;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd apr_status_t retval;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd} isapi_cid;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndapr_status_t isapi_handler (request_rec *r)
2d728410bcf9e6e53698bb035f516e18efd76d8bnd{
2d728410bcf9e6e53698bb035f516e18efd76d8bnd apr_table_t *e = r->subprocess_env;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd isapi_loaded *isa;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd isapi_cid *cid;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Use similar restrictions as CGIs
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * If this fails, it's pointless to load the isapi dll.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!(ap_allow_options(r) & OPT_EXECCGI))
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_FORBIDDEN;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (r->finfo.protection == 0)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_NOT_FOUND;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (r->finfo.filetype == APR_DIR)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_FORBIDDEN;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Load the module
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * TODO: Critical section
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Warning: cid should not be allocated from pool if we
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * cache the isapi process in-memory.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * This code could use cacheing... everything that follows
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * should only be performed on the first isapi dll invocation,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * not with every HttpExtensionProc()
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isa = apr_pcalloc(r->pool, sizeof(isapi_module));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isa->pVer = apr_pcalloc(r->pool, sizeof(HSE_VERSION_INFO));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isa->refcount = 0;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* TODO: These may need to become overrideable, so that we
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * assure a given isapi can be fooled into behaving well.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isa->timeout = INFINITE; /* microsecs */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isa->fakeasync = TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isa->reportversion = MAKELONG(0, 5); /* Revision 5.0 */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!(isa->handle = LoadLibraryEx(r->filename, NULL,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz LOAD_WITH_ALTERED_SEARCH_PATH))) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_ALERT, GetLastError(), r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s failed to load", r->filename);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_INTERNAL_SERVER_ERROR;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!(isa->GetExtensionVersion =
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz (void *)(GetProcAddress(isa->handle, "GetExtensionVersion")))) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_ALERT, GetLastError(), r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s is missing GetExtensionVersion()",
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd r->filename);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd FreeLibrary(isa->handle);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_INTERNAL_SERVER_ERROR;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!(isa->HttpExtensionProc =
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz (void *)(GetProcAddress(isa->handle, "HttpExtensionProc")))) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_ALERT, GetLastError(), r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s is missing HttpExtensionProc()",
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz r->filename);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz FreeLibrary(isa->handle);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_INTERNAL_SERVER_ERROR;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* TerminateExtension() is an optional interface */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isa->TerminateExtension = (void *)(GetProcAddress(isa->handle, "TerminateExtension"));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Run GetExtensionVersion() */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!(*isa->GetExtensionVersion)(isa->pVer)) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* ### euh... we're passing the wrong type of error code here */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_ALERT, HTTP_INTERNAL_SERVER_ERROR, r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s call GetExtensionVersion() failed",
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz r->filename);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz FreeLibrary(isa->handle);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_INTERNAL_SERVER_ERROR;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Load of this module completed, this is the point at which *isa
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * could be cached for later invocation.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * on to invoking this request...
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Set up variables */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_add_common_vars(r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_add_cgi_vars(r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Set up connection structure and ecb */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid = apr_pcalloc(r->pool, sizeof(isapi_cid));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb = apr_pcalloc(r->pool, sizeof(struct _EXTENSION_CONTROL_BLOCK));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->ConnID = (HCONN)cid;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* TODO: Critical section */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ++isa->refcount;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->isa = isa;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->r = r;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->r->status = 0;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->complete = NULL;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->completion = NULL;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->retval = APR_SUCCESS;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->cbSize = sizeof(EXTENSION_CONTROL_BLOCK);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->dwVersion = isa->reportversion;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->dwHttpStatusCode = 0;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz strcpy(cid->ecb->lpszLogData, "");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz // TODO: are copies really needed here?
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->lpszMethod = apr_pstrdup(r->pool, (char*) r->method);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->lpszQueryString = apr_pstrdup(r->pool,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz (char*) apr_table_get(e, "QUERY_STRING"));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->lpszPathInfo = apr_pstrdup(r->pool,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz (char*) apr_table_get(e, "PATH_INFO"));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->lpszPathTranslated = apr_pstrdup(r->pool,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd (char*) apr_table_get(e, "PATH_TRANSLATED"));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->lpszContentType = apr_pstrdup(r->pool,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd (char*) apr_table_get(e, "CONTENT_TYPE"));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Set up the callbacks */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->GetServerVariable = &GetServerVariable;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->WriteClient = &WriteClient;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->ReadClient = &ReadClient;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->ServerSupportFunction = &ServerSupportFunction;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Set up client input */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (cid->retval) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (isa->TerminateExtension) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd (*isa->TerminateExtension)(HSE_TERM_MUST_UNLOAD);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd FreeLibrary(isa->handle);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return cid->retval;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (ap_should_client_block(r)) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Unlike IIS, which limits this to 48k, we read the whole
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * sucker in. I suppose this could be bad for memory if someone
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * uploaded the complete works of Shakespeare. Well, WebSite
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * does the same thing.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * But we can be smarter and read up to our 48k and then allow
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the ISAPI app to read further blocks as desired.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd long to_read = atol(apr_table_get(e, "CONTENT_LENGTH"));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd long read;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Actually, let's cap it at 48k, until we figure out what
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * to do with this... we don't want a Content-Length: 1000000000
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * taking out the machine.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (to_read > 49152) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (isa->TerminateExtension)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd (*isa->TerminateExtension)(HSE_TERM_MUST_UNLOAD);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz FreeLibrary(isa->handle);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return HTTP_REQUEST_ENTITY_TOO_LARGE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->lpbData = apr_pcalloc(r->pool, 1 + to_read);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if ((read = ap_get_client_block(r, cid->ecb->lpbData, to_read)) < 0) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (isa->TerminateExtension)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd (*isa->TerminateExtension)(HSE_TERM_MUST_UNLOAD);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd FreeLibrary(isa->handle);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return HTTP_INTERNAL_SERVER_ERROR;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Although its not to spec, IIS seems to null-terminate
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * its lpdData string. So we will too. To make sure
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * cbAvailable matches cbTotalBytes, we'll up the latter
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * and equalize them.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->cbAvailable = cid->ecb->cbTotalBytes = read + 1;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->lpbData[read] = '\0';
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd else {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->cbTotalBytes = 0;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->cbAvailable = 0;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->ecb->lpbData = NULL;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* All right... try and run the sucker */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->retval = (*isa->HttpExtensionProc)(cid->ecb);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Set the status (for logging) */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (cid->ecb->dwHttpStatusCode) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->r->status = cid->ecb->dwHttpStatusCode;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Check for a log message - and log it */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (cid->ecb->lpszLogData && *cid->ecb->lpszLogData)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd "ISAPI %s: %s", r->filename, cid->ecb->lpszLogData);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd switch(cid->retval) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_STATUS_SUCCESS:
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_STATUS_SUCCESS_AND_KEEP_CONN:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Ignore the keepalive stuff; Apache handles it just fine without
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * the ISA's "advice".
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Per Microsoft: "In IIS versions 4.0 and later, the return
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * values HSE_STATUS_SUCCESS and HSE_STATUS_SUCCESS_AND_KEEP_CONN
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * are functionally identical: Keep-Alive connections are
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * maintained, if supported by the client."
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * ... so we were pat all this time
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd break;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_STATUS_PENDING:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* emulating async behavior...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Create a cid->completed event and wait on it for some timeout
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * so that the app thinks is it running async.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * All async ServerSupportFunction calls will be handled through
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the registered IO_COMPLETION hook.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (!isa->fakeasync) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_WARNING, APR_ENOTIMPL, r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s asynch I/O request refused",
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd r->filename);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->retval = APR_ENOTIMPL;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd else {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->complete = CreateEvent(NULL, FALSE, FALSE, NULL);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (WaitForSingleObject(cid->complete, isa->timeout)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd == WAIT_TIMEOUT) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* TODO: Now what... if this hung, then do we kill our own
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * thread to force it's death? For now leave timeout = -1
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd break;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_STATUS_ERROR:
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* end response if we have yet to do so.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->retval = HTTP_INTERNAL_SERVER_ERROR;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd break;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd default:
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* TODO: log unrecognized retval for debugging
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->retval = HTTP_INTERNAL_SERVER_ERROR;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd break;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* All done with the DLL... get rid of it...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * If optionally cached, pass HSE_TERM_ADVISORY_UNLOAD,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * and if it returns TRUE, unload, otherwise, cache it.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (isa->TerminateExtension) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd (*isa->TerminateExtension)(HSE_TERM_MUST_UNLOAD);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd FreeLibrary(isa->handle);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* TODO: Crit section */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd cid->isa = NULL;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd --isa->refcount;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd isa->handle = NULL;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return cid->retval;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd}
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#pragma optimize("",on)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndBOOL WINAPI GetServerVariable (HCONN hConn, LPSTR lpszVariableName,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd LPVOID lpvBuffer, LPDWORD lpdwSizeofBuffer)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd{
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd request_rec *r = ((isapi_cid *)hConn)->r;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd apr_table_t *e = r->subprocess_env;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd const char *result;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Mostly, we just grab it from the environment, but there are
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * a couple of special cases
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (!strcasecmp(lpszVariableName, "UNMAPPED_REMOTE_USER")) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* We don't support NT users, so this is always the same as
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * REMOTE_USER
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd result = apr_table_get(e, "REMOTE_USER");
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd else if (!strcasecmp(lpszVariableName, "SERVER_PORT_SECURE")) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Apache doesn't support secure requests inherently, so
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * we have no way of knowing. We'll be conservative, and say
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * all requests are insecure.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd result = "0";
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd else if (!strcasecmp(lpszVariableName, "URL")) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd result = r->uri;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd else {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd result = apr_table_get(e, lpszVariableName);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (result) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (strlen(result) > *lpdwSizeofBuffer) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *lpdwSizeofBuffer = strlen(result);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd SetLastError(ERROR_INSUFFICIENT_BUFFER);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd strncpy(lpvBuffer, result, *lpdwSizeofBuffer);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return TRUE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Didn't find it */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd SetLastError(ERROR_INVALID_INDEX);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd}
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndBOOL WINAPI WriteClient (HCONN ConnID, LPVOID Buffer, LPDWORD lpwdwBytes,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd DWORD dwReserved)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd{
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd request_rec *r = ((isapi_cid *)ConnID)->r;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd int writ; /* written, actually, but why shouldn't I make up words? */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* We only support synchronous writing */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (dwReserved && dwReserved != HSE_IO_SYNC) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_WARNING, ERROR_INVALID_PARAMETER, r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s asynch write", r->filename);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if ((writ = ap_rwrite(Buffer, *lpwdwBytes, r)) == EOF) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(WSAEDISCON); /* TODO: Find the right error code */
7585f3892ce3057554a5bef740302dd479b223b2nd return FALSE;
7585f3892ce3057554a5bef740302dd479b223b2nd }
7585f3892ce3057554a5bef740302dd479b223b2nd
7585f3892ce3057554a5bef740302dd479b223b2nd *lpwdwBytes = writ;
7585f3892ce3057554a5bef740302dd479b223b2nd return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz}
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzBOOL WINAPI ReadClient (HCONN ConnID, LPVOID lpvBuffer, LPDWORD lpdwSize)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd{
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* TODO: If the request was a huge transmit or chunked, continue piping the
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * request here, but if it's of a sane size, continue to ...
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return TRUE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd}
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic char* ComposeHeaders(request_rec *r, char* data)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz{
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* We *should* break before this while loop ends */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz while (*data)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz char *value, *lf = strchr(data, '\n');
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz int p;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#ifdef RELAX_HEADER_RULE
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (lf)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *lf = '\0';
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#else
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!lf) { /* Huh? Invalid data, I think */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s sent invalid headers", r->filename);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(TODO_ERROR);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Get rid of \n and \r */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *lf = '\0';
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#endif
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz p = strlen(data);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (p > 0 && data[p-1] == '\r') data[p-1] = '\0';
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* End of headers */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (*data == '\0') {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd#ifdef RELAX_HEADER_RULE
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (lf)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#endif
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz data = lf + 1; /* Reset data */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz break;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!(value = strchr(data, ':'))) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(TODO_ERROR);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* ### euh... we're passing the wrong type of error
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ### code here */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_ERR, HTTP_INTERNAL_SERVER_ERROR, r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s sent invalid headers", r->filename);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *value++ = '\0';
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd while (*value && apr_isspace(*value)) ++value;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Check all the special-case headers. Similar to what
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * ap_scan_script_header_err() does (see that function for
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * more detail)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!strcasecmp(data, "Content-Type"))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Nuke trailing whitespace */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd char *tmp;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd char *endp = value + strlen(value) - 1;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd while (endp > value && apr_isspace(*endp))
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *endp-- = '\0';
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz tmp = apr_pstrdup (r->pool, value);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_str_tolower(tmp);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz r->content_type = tmp;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz else if (!strcasecmp(data, "Content-Length")) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_set(r->headers_out, data, value);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz else if (!strcasecmp(data, "Transfer-Encoding")) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_set(r->headers_out, data, value);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz else if (!strcasecmp(data, "Set-Cookie")) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_add(r->err_headers_out, data, value);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz else {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_merge(r->err_headers_out, data, value);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Reset data */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#ifdef RELAX_HEADER_RULE
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!lf) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz data += p;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd break;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#endif
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz data = lf + 1;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return data;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz}
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* XXX: There is an O(n^2) attack possible here. */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzBOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd LPVOID lpvBuffer, LPDWORD lpdwSize,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd LPDWORD lpdwDataType)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz{
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isapi_cid *cid = (isapi_cid *)hConn;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz request_rec *r = cid->r;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz request_rec *subreq;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz char *data;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz switch (dwHSERequest) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_SEND_URL_REDIRECT_RESP:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Set the status to be returned when the HttpExtensionProc()
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * is done.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_set (r->headers_out, "Location", lpvBuffer);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->r->status = cid->ecb->dwHttpStatusCode
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz = HTTP_MOVED_TEMPORARILY;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_SEND_URL:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Read any additional input */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (r->remaining > 0) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz char argsbuffer[HUGE_STRING_LEN];
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Reset the method to GET */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz r->method = apr_pstrdup(r->pool, "GET");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz r->method_number = M_GET;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Don't let anyone think there's still data */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_unset(r->headers_in, "Content-Length");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_internal_redirect((char *)lpvBuffer, r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_SEND_RESPONSE_HEADER:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz r->status_line = lpvBuffer ? lpvBuffer : apr_pstrdup(r->pool, "200 OK");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz sscanf(r->status_line, "%d", &r->status);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->dwHttpStatusCode = r->status;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Now fill in the HTTP headers, and the rest of it. Ick.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * lpdwDataType contains a string that has headers (in MIME
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * format), a blank like, then (possibly) data. We need
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * to parse it.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Easy case first:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!lpdwDataType) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_send_http_header(r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Make a copy - don't disturb the original */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz data = apr_pstrdup(r->pool, (char *)lpdwDataType);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Parse them out, or die trying */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz data = ComposeHeaders(r, data);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!data)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* All the headers should be set now */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_send_http_header(r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Any data left should now be sent directly */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (*data)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_rputs(data, r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_DONE_WITH_SESSION:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Signal to resume the thread completing this request
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (cid->complete)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetEvent(cid->complete);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_MAP_URL_TO_PATH:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Map a URL to a filename */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz subreq = ap_sub_req_lookup_uri(apr_pstrndup(r->pool, (char *)lpvBuffer,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd *lpdwSize), r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd GetFullPathName(subreq->filename, *lpdwSize - 1, (char *)lpvBuffer, NULL);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* IIS puts a trailing slash on directories, Apache doesn't */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (subreq->finfo.filetype == APR_DIR) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz int l = strlen((char *)lpvBuffer);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ((char *)lpvBuffer)[l] = '\\';
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ((char *)lpvBuffer)[l + 1] = '\0';
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_GET_SSPI_INFO:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_APPEND_LOG_PARAMETER:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Log lpvBuffer, of lpdwSize bytes, in the URI Query (cs-uri-query) field
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * This code will do for now...
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
2d728410bcf9e6e53698bb035f516e18efd76d8bnd ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "ISAPI %s: %s", cid->r->filename,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz (char*) lpvBuffer);
2d728410bcf9e6e53698bb035f516e18efd76d8bnd return TRUE;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd
2d728410bcf9e6e53698bb035f516e18efd76d8bnd case HSE_REQ_IO_COMPLETION:
2d728410bcf9e6e53698bb035f516e18efd76d8bnd /* TODO: Emulate a completion port, if we can...
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * Record the callback address and user defined argument...
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * we will call this after any async request (e.g. transmitfile)
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * as if the request had completed async execution.
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * Per MS docs... HSE_REQ_IO_COMPLETION replaces any prior call
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * to HSE_REQ_IO_COMPLETION, and lpvBuffer may be set to NULL.
2d728410bcf9e6e53698bb035f516e18efd76d8bnd */
2d728410bcf9e6e53698bb035f516e18efd76d8bnd if (!cid->isa->fakeasync)
2d728410bcf9e6e53698bb035f516e18efd76d8bnd return FALSE;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd cid->completion = (PFN_HSE_IO_COMPLETION) lpvBuffer;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd cid->completion_arg = (PVOID) lpdwDataType;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd return TRUE;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd
2d728410bcf9e6e53698bb035f516e18efd76d8bnd case HSE_REQ_TRANSMIT_FILE:
2d728410bcf9e6e53698bb035f516e18efd76d8bnd /* Use TransmitFile... nothing wrong with that :)
2d728410bcf9e6e53698bb035f516e18efd76d8bnd */
2d728410bcf9e6e53698bb035f516e18efd76d8bnd
2d728410bcf9e6e53698bb035f516e18efd76d8bnd /* ### euh... we're passing the wrong type of error code here */
2d728410bcf9e6e53698bb035f516e18efd76d8bnd ap_log_rerror(APLOG_MARK, APLOG_WARNING,
2d728410bcf9e6e53698bb035f516e18efd76d8bnd HTTP_INTERNAL_SERVER_ERROR, r,
2d728410bcf9e6e53698bb035f516e18efd76d8bnd "ISAPI asynchronous I/O not supported: %s",
2d728410bcf9e6e53698bb035f516e18efd76d8bnd r->filename);
2d728410bcf9e6e53698bb035f516e18efd76d8bnd return FALSE;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd
2d728410bcf9e6e53698bb035f516e18efd76d8bnd case HSE_REQ_REFRESH_ISAPI_ACL:
2d728410bcf9e6e53698bb035f516e18efd76d8bnd SetLastError(ERROR_INVALID_PARAMETER);
2d728410bcf9e6e53698bb035f516e18efd76d8bnd return FALSE;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd
2d728410bcf9e6e53698bb035f516e18efd76d8bnd case HSE_REQ_IS_KEEP_CONN:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
2d728410bcf9e6e53698bb035f516e18efd76d8bnd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_ASYNC_READ_CLIENT:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_GET_IMPERSONATION_TOKEN: /* Added in ISAPI 4.0 */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_MAP_URL_TO_PATH_EX:
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd SetLastError(ERROR_INVALID_PARAMETER);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* TODO: Not quite ready for prime time yet */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Map a URL to a filename */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd subreq = ap_sub_req_lookup_uri(apr_pstrndup(r->pool, (char *)lpvBuffer,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *lpdwSize), r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz GetFullPathName(subreq->filename, *lpdwSize - 1, (char *)lpvBuffer, NULL);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* IIS puts a trailing slash on directories, Apache doesn't */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (subreq->finfo.filetype == APR_DIR) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz int l = strlen((char *)lpvBuffer);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ((char *)lpvBuffer)[l] = '\\';
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ((char *)lpvBuffer)[l + 1] = '\0';
f81f966693feefb53f11dc3363b864779873a608nd }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lpdwDataType = (LPDWORD) apr_palloc(r->pool, sizeof(HSE_URL_MAPEX_INFO));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz strncpy(((LPHSE_URL_MAPEX_INFO)lpdwDataType)->lpszPath,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz (char *) lpvBuffer, MAX_PATH);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ((LPHSE_URL_MAPEX_INFO)lpdwDataType)->dwFlags = 0;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* is a combination of:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * HSE_URL_FLAGS_READ Allow for read.
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * HSE_URL_FLAGS_WRITE Allow for write.
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * HSE_URL_FLAGS_EXECUTE Allow for execute.
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * HSE_URL_FLAGS_SSL Require SSL.
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * HSE_URL_FLAGS_DONT_CACHE Don't cache (virtual root only).
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * HSE_URL_FLAGS_NEGO_CERT Allow client SSL certifications.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * HSE_URL_FLAGS_REQUIRE_CERT Require client SSL certifications.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * HSE_URL_FLAGS_MAP_CERT Map SSL certification to a Windows account.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * HSE_URL_FLAGS_SSL128 Requires a 128-bit SSL.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * HSE_URL_FLAGS_SCRIPT Allows for script execution.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* (LPHSE_URL_MAPEX_INFO)lpdwDataType)->cchMatchingPath
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * (LPHSE_URL_MAPEX_INFO)lpdwDataType)->cchMatchingURL
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_REQ_ABORTIVE_CLOSE:
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_REQ_GET_CERT_INFO_EX: /* Added in ISAPI 4.0 */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd SetLastError(ERROR_INVALID_PARAMETER);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz case HSE_REQ_SEND_RESPONSE_HEADER_EX: /* Added in ISAPI 4.0 */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd SetLastError(ERROR_INVALID_PARAMETER);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return FALSE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* TODO: Not quite ready for prime time */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszStatus
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz && ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchStatus) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd r->status_line = apr_pstrndup(r->pool,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszStatus,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchStatus);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd else {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd r->status_line = apr_pstrdup(r->pool, "200 OK");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd sscanf(r->status_line, "%d", &r->status);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz cid->ecb->dwHttpStatusCode = r->status;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszHeader
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd && ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchHeader)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Make a copy - don't disturb the original */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd data = apr_pstrndup(r->pool,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->pszHeader,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->cchHeader);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Parse them out, or die trying */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd data = ComposeHeaders(r, data);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (!data)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz else {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz data = "\0";
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* ((LPHSE_SEND_HEADER_EX_INFO)lpvBuffer)->fKeepConn;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz *
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Now how are we about to start listening to an ISAPI's
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * idea of keeping or closing a connection? Seriously :)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* All the headers should be set now */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_send_http_header(r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Any data left should now be sent directly */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (*data)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_rputs(data, r);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#if 0
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* HSE_REQ_CLOSE_CONNACTION and HSE_REQ_IS_CONNECTED are not defined on
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * my system. wgs */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_REQ_CLOSE_CONNECTION: /* Added after ISAPI 4.0 */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd case HSE_REQ_IS_CONNECTED: /* Added after ISAPI 4.0 */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* Returns True if client is connected c.f. Q188346*/
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return TRUE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#endif
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* case HSE_REQ_EXTENSION_TRIGGER:
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Added after ISAPI 4.0?
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Undocumented - from the Microsoft Jan '00 Platform SDK
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd default:
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* TODO: log unrecognized ServerSupportCommand for debugging
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz SetLastError(ERROR_INVALID_PARAMETER);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return FALSE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz }
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd}
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndhandler_rec isapi_handlers[] = {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz { "isapi-isa", isapi_handler },
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz { NULL}
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz};
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzmodule isapi_module = {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz STANDARD20_MODULE_STUFF,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz NULL, /* create per-dir config */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz NULL, /* merge per-dir config */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz NULL, /* server config */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz NULL, /* merge server config */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz NULL, /* command apr_table_t */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz isapi_handlers, /* handlers */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz NULL /* register hooks */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz};
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz