--- parser3/src/targets/isapi/parser3isapi.C 2001/06/28 07:44:17 1.35 +++ parser3/src/targets/isapi/parser3isapi.C 2001/09/26 11:45:00 1.45 @@ -2,15 +2,17 @@ Parser: IIS extension. Copyright (c) 2000,2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + + $Id: parser3isapi.C,v 1.45 2001/09/26 11:45:00 parser Exp $ */ -static const char *RCSId="$Id: parser3isapi.C,v 1.35 2001/06/28 07:44:17 parser Exp $"; #ifndef _MSC_VER # error compile ISAPI module with MSVC [no urge for now to make it autoconf-ed (PAF)] #endif +#include "pa_config_includes.h" + #include #include @@ -25,18 +27,41 @@ static const char *RCSId="$Id: parser3is #define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION") +// consts + +extern const char *main_RCSIds[]; +#ifdef SMTP +extern const char *smtp_RCSIds[]; +#endif +extern const char *gd_RCSIds[]; +extern const char *classes_RCSIds[]; +extern const char *types_RCSIds[]; +extern const char *parser3isapi_RCSIds[]; +const char **RCSIds[]={ + main_RCSIds, +#ifdef SMTP + smtp_RCSIds, +#endif + gd_RCSIds, + classes_RCSIds, + types_RCSIds, + parser3isapi_RCSIds, + 0 +}; + // SAPI -/** +#ifndef DOXYGEN +/* ISAPI SAPI functions receive this context information. - - @see Pool::set_context + see Pool::set_context */ struct SAPI_func_context { LPEXTENSION_CONTROL_BLOCK lpECB; String *header; DWORD http_response_code; }; +#endif // goes to 'cs-uri-query' log file field. webmaster: switch it ON[default OFF]. void SAPI::log(Pool& pool, const char *fmt, ...) { @@ -199,7 +224,8 @@ static bool parser_init() { /// ISAPI // BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) { pVer->dwExtensionVersion = HSE_VERSION; - strncpy(pVer->lpszExtensionDesc, "Parser "PARSER_VERSION, HSE_MAX_EXT_DLL_NAME_LEN); + strncpy(pVer->lpszExtensionDesc, "Parser "PARSER_VERSION, HSE_MAX_EXT_DLL_NAME_LEN-1); + pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1]=0; return parser_init(); } @@ -211,6 +237,8 @@ BOOL WINAPI GetExtensionVersion(HSE_VERS to do that we need to consult metabase, wich is tested&works but seems slow runtime and not could-be-quickly-implemented if prepared. + @test + PARSER_VERSION from outside */ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) { Pool_storage pool_storage; @@ -218,8 +246,9 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSI SAPI_func_context ctx={ lpECB, 0, // filling later: so that if there would be error pool would have ctx - 200 + 200 // default http_response_code }; + _asm nop; // int 3; pool.set_context(&ctx);// no allocations before this line! bool header_only=strcasecmp(lpECB->lpszMethod, "HEAD")==0; @@ -240,8 +269,7 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSI // IIS size_t len=strlen(filespec_to_process)-strlen(path_info); char *buf=(char *)pool.malloc(len+1); - strncpy(buf, filespec_to_process, len); - buf[len]=0; + strncpy(buf, filespec_to_process, len); buf[len]=0; request_info.document_root=buf; } else PTHROW(0, 0, @@ -276,14 +304,18 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSI // some root-controlled location // c:\windows + char root_config_path[MAX_STRING]; + GetWindowsDirectory(root_config_path, MAX_STRING); // must be dynamic: rethrowing from request.core // may return 'source' which can be inside of 'root auto.p@exeception' - char *root_auto_path=(char *)pool.malloc(MAX_STRING); - GetWindowsDirectory(root_auto_path, MAX_STRING); + char *root_config_filespec=(char *)pool.malloc(MAX_STRING); + snprintf(root_config_filespec, MAX_STRING, + "%s/%s", + root_config_path, CONFIG_FILE_NAME); // process the request request.core( - root_auto_path, false/*may be abcent*/, // /path/to/admin/auto.p + root_config_filespec, false/*may be abcent*/, // /path/to/admin/auto.p 0/*parser_site_auto_path*/, false, // /path/to/site/auto.p header_only); // successful finish