--- parser3/src/targets/isapi/parser3isapi.C 2001/03/26 09:09:47 1.19 +++ parser3/src/targets/isapi/parser3isapi.C 2001/04/09 15:49:03 1.26 @@ -12,6 +12,10 @@ #include "pa_request.h" #include "pa_version.h" #include "pool_storage.h" +#include "pa_socks.h" +#include "pa_exec.h" + +/// @todo init_socks #define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION") @@ -28,6 +32,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 +70,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 +116,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 +153,19 @@ 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); + 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); +int SAPI::execute(const String& file_spec, + const Hash *env, + const Array *argv, + const String& in, String& out, String& err) { + return pa_exec(file_spec, env, argv, in, out, err); } // @@ -191,7 +202,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 @@ -250,6 +261,8 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSI request_info.content_type=lpECB->lpszContentType; request_info.content_length=lpECB->cbTotalBytes; request_info.cookie=SAPI::get_env(pool, "HTTP_COOKIE"); + request_info.user_agent=SAPI::get_env(pool, "HTTP_USER_AGENT"); + // prepare to process request Request request(pool,