--- parser3/src/targets/isapi/parser3isapi.C 2020/10/28 22:32:03 1.119 +++ parser3/src/targets/isapi/parser3isapi.C 2020/12/15 17:10:38 1.124 @@ -1,11 +1,11 @@ /** @file Parser: IIS extension. - Copyright (c) 2000-2017 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2000-2020 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.119 2020/10/28 22:32:03 moko Exp $"; +volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.124 2020/12/15 17:10:38 moko Exp $"; #ifndef _MSC_VER # error compile ISAPI module with MSVC [no urge for now to make it autoconf-ed (PAF)] @@ -138,11 +138,7 @@ static int grep_char(const char* s, char } return result; } -static const char* mk_env_pair(const char* key, const char* value) { - char *result=new(PointerFreeGC) char[strlen(key)+1/*=*/+strlen(value)+1/*0*/]; - strcpy(result, key); strcat(result, "="); strcat(result, value); - return result; -} + const char* const *SAPI::Env::get(SAPI_Info& info) { // we know this buf is writable char* all_http_vars=SAPI::Env::get(info, "ALL_HTTP"); @@ -155,18 +151,18 @@ const char* const *SAPI::Env::get(SAPI_I for(int i=0; idwExtensionVersion = HSE_VERSION; - strncpy(pVer->lpszExtensionDesc, "Parser "PARSER_VERSION, HSE_MAX_EXT_DLL_NAME_LEN-1); + 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(); } @@ -303,11 +299,7 @@ BOOL WINAPI TerminateExtension( */ void real_parser_handler(SAPI_Info& SAPI_info, bool header_only) { // collect garbage from prev request -#ifndef PA_DEBUG_DISABLE_GC - GC_dont_gc=0; - GC_gcollect(); - GC_dont_gc=1; -#endif + PA_GC_GCOLLECT; SAPI_info.header=new String; LPEXTENSION_CONTROL_BLOCK lpECB=SAPI_info.lpECB; @@ -328,24 +320,12 @@ void real_parser_handler(SAPI_Info& SAPI strncpy(buf, filespec_to_process, len); buf[len]=0; request_info.document_root=buf; } else - throw Exception(PARSER_RUNTIME, - 0, - "ISAPI: no PATH_INFO defined (in reinventing DOCUMENT_ROOT)"); + throw Exception(PARSER_RUNTIME, 0, "ISAPI: no PATH_INFO defined (in reinventing DOCUMENT_ROOT)"); request_info.path_translated=filespec_to_process; request_info.method=lpECB->lpszMethod; request_info.query_string=lpECB->lpszQueryString; - if(lpECB->lpszQueryString && *lpECB->lpszQueryString) { - char *reconstructed_uri=new(PointerFreeGC) char[ - strlen(lpECB->lpszPathInfo)+1/*'?'*/+ - strlen(lpECB->lpszQueryString)+1/*0*/]; - strcpy(reconstructed_uri, lpECB->lpszPathInfo); - strcat(reconstructed_uri, "?"); - strcat(reconstructed_uri, lpECB->lpszQueryString); - request_info.uri=reconstructed_uri; - } else - request_info.uri=lpECB->lpszPathInfo; - + request_info.uri=lpECB->lpszQueryString && *lpECB->lpszQueryString ? pa_strcat(lpECB->lpszPathInfo, "?", lpECB->lpszQueryString) : lpECB->lpszPathInfo; request_info.content_type=lpECB->lpszContentType; request_info.content_length=lpECB->cbTotalBytes; request_info.cookie=SAPI::Env::get(SAPI_info, "HTTP_COOKIE");