--- parser3/src/targets/isapi/parser3isapi.C 2001/04/03 07:20:55 1.22 +++ parser3/src/targets/isapi/parser3isapi.C 2001/04/10 10:32:13 1.28 @@ -12,6 +12,7 @@ #include "pa_request.h" #include "pa_version.h" #include "pool_storage.h" +#include "pa_socks.h" #define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION") @@ -28,6 +29,21 @@ struct SAPI_func_context { DWORD http_response_code; }; +// goes to 'cs-uri-query' log file field. webmaster: switch it ON[default OFF]. +void SAPI::log(Pool& pool, const char *fmt, ...) { + SAPI_func_context& ctx=*static_cast(pool.context()); + + va_list args; + va_start(args,fmt); + char buf[MAX_STRING]; + const char *prefix="PARSER_ERROR:"; + strcpy(buf, prefix); + DWORD size=vsnprintf(buf+strlen(prefix), MAX_STRING-strlen(prefix), fmt, args); + + ctx.lpECB->ServerSupportFunction(ctx.lpECB->ConnID, + HSE_APPEND_LOG_PARAMETER, buf, &size, 0); +} + const char *SAPI::get_env(Pool& pool, const char *name) { SAPI_func_context& ctx=*static_cast(pool.context()); @@ -51,7 +67,7 @@ const char *SAPI::get_env(Pool& pool, co return 0; } -uint SAPI::read_post(Pool& pool, char *buf, uint max_bytes) { +size_t SAPI::read_post(Pool& pool, char *buf, size_t max_bytes) { SAPI_func_context& ctx=*static_cast(pool.context()); DWORD read_from_buf=0; @@ -97,7 +113,7 @@ void SAPI::add_header_attribute(Pool& po } } -/// @todo parser4: intelligent cache-control +/// @todo intelligent cache-control void SAPI::send_header(Pool& pool) { SAPI_func_context& ctx=*static_cast(pool.context()); @@ -134,27 +150,12 @@ void SAPI::send_header(Pool& pool) { HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL); } -void SAPI::send_body(Pool& pool, const char *buf, size_t size) { +void SAPI::send_body(Pool& pool, const void *buf, size_t size) { SAPI_func_context& ctx=*static_cast(pool.context()); DWORD num_bytes=size; ctx.lpECB->WriteClient(ctx.lpECB->ConnID, - const_cast(buf), &num_bytes, HSE_IO_SYNC); -} - -// goes to 'cs-uri-query' log file field. webmaster: switch it ON[default OFF]. -void SAPI::log(Pool& pool, const char *fmt, ...) { - SAPI_func_context& ctx=*static_cast(pool.context()); - - va_list args; - va_start(args,fmt); - char buf[MAX_STRING]; - const char *prefix="PARSER_ERROR:"; - strcpy(buf, prefix); - DWORD size=vsnprintf(buf+strlen(prefix), MAX_STRING-strlen(prefix), fmt, args); - - ctx.lpECB->ServerSupportFunction(ctx.lpECB->ConnID, - HSE_APPEND_LOG_PARAMETER, buf, &size, 0); + const_cast(buf), &num_bytes, HSE_IO_SYNC); } // @@ -167,6 +168,9 @@ static bool parser_init() { static Pool pool(0); // global pool PTRY { + // init socks + init_socks(pool); + // init global variables pa_globals_init(pool); @@ -191,7 +195,7 @@ BOOL WINAPI GetExtensionVersion(HSE_VERS /** ISAPI // main workhorse - @todo parser4: + @todo IIS: remove trailing default-document[index.html] from $request.uri. to do that we need to consult metabase, wich is tested&works but seems slow runtime @@ -287,7 +291,7 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSI char header_buf[MAX_STRING]; int header_len=snprintf(header_buf, MAX_STRING, "content-type: text/plain\n" - "content-length: %ul\n" + "content-length: %lu\n" "expires: Fri, 23 Mar 2001 09:32:23 GMT\n" "\n", content_length);