--- parser3/src/targets/isapi/parser3isapi.C 2003/01/31 16:05:59 1.82.2.2 +++ parser3/src/targets/isapi/parser3isapi.C 2003/02/17 12:13:45 1.82.2.4 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_PARSER3ISAPI_C="$Date: 2003/01/31 16:05:59 $"; +static const char* IDENT_PARSER3ISAPI_C="$Date: 2003/02/17 12:13:45 $"; #ifndef _MSC_VER # error compile ISAPI module with MSVC [no urge for now to make it autoconf-ed (PAF)] @@ -98,7 +98,7 @@ void SAPI::die(const char* fmt, ...) { const char* SAPI::get_env(Pool& pool, const char* name) { SAPI_func_context& ctx=*static_cast(pool.get_context()); - char *variable_buf=(char *)pool.malloc(MAX_STRING); + char *variable_buf=new(pool) char[MAX_STRING]; DWORD variable_len = MAX_STRING-1; if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast(name), @@ -108,7 +108,7 @@ const char* SAPI::get_env(Pool& pool, co return variable_buf; } } else if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) { - variable_buf=(char *)pool.malloc(variable_len+1); + variable_buf=new(pool) char[variable_len+1]; if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast(name), variable_buf, &variable_len)) { @@ -133,17 +133,16 @@ static int grep_char(const char* s, char return result; } static const char* mk_env_pair(Pool& pool, const char* key, const char* value) { - char *result=(char *)pool.malloc(strlen(key)+1/*=*/+strlen(value)+1/*0*/); + char *result=new(pool) char[strlen(key)+1/*=*/+strlen(value)+1/*0*/]; strcpy(result, key); strcat(result, "="); strcat(result, value); return result; } -const char* const *SAPI::environment(Pool& pool) { +const char* const *SAPI::environment(SAPI_Info& info, Pool& pool) { // we know this buf is writable char *all_http_vars=const_cast(SAPI::get_env(pool, "ALL_HTTP")); const int http_var_count=grep_char(all_http_vars, '\n')+1/*\n for theoretical(never saw) this \0*/; - const char* *result= - (const char* *)pool.malloc(sizeof(char *)*(IIS51var_count+http_var_count+1/*0*/)); + const char* *result=new(pool) const char*[IIS51var_count+http_var_count+1/*0*/]; const char* *cur=result; // IIS5.1 vars @@ -282,7 +281,7 @@ static bool parser_init() { static Pool pool(&pool_storage); // global pool try { // init socks - init_socks(pool); + pa_init_socks(pool); // init global classes init_methoded_array(pool); // init global variables @@ -325,8 +324,7 @@ void real_parser_handler(Pool& pool, LPE Request::Info request_info; size_t path_translated_buf_size=strlen(lpECB->lpszPathTranslated)+1; - char *filespec_to_process=(char *)pool.malloc(path_translated_buf_size); - memcpy(filespec_to_process, lpECB->lpszPathTranslated, path_translated_buf_size); + char *filespec_to_process=pool.copy(lpECB->lpszPathTranslated, path_translated_buf_size); #ifdef WIN32 back_slashes_to_slashes(filespec_to_process); #endif @@ -334,7 +332,7 @@ void real_parser_handler(Pool& pool, LPE if(const char* path_info=SAPI::get_env(pool, "PATH_INFO")) { // IIS size_t len=strlen(filespec_to_process)-strlen(path_info); - char *buf=(char *)pool.malloc(len+1); + char *buf=new(pool) char[len+1]; strncpy(buf, filespec_to_process, len); buf[len]=0; request_info.document_root=buf; } else @@ -346,9 +344,9 @@ void real_parser_handler(Pool& pool, LPE request_info.method=lpECB->lpszMethod; request_info.query_string=lpECB->lpszQueryString; if(lpECB->lpszQueryString && *lpECB->lpszQueryString) { - char *reconstructed_uri=(char *)pool.malloc( + char *reconstructed_uri=new(pool) char[ strlen(lpECB->lpszPathInfo)+1/*'?'*/+ - strlen(lpECB->lpszQueryString)+1/*0*/); + strlen(lpECB->lpszQueryString)+1/*0*/]; strcpy(reconstructed_uri, lpECB->lpszPathInfo); strcat(reconstructed_uri, "?"); strcat(reconstructed_uri, lpECB->lpszQueryString);