--- parser3/src/targets/cgi/parser3.C 2001/09/18 16:05:43 1.111 +++ parser3/src/targets/cgi/parser3.C 2001/10/13 17:42:52 1.121 @@ -2,10 +2,10 @@ Parser: scripting and CGI main. Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + + $Id: parser3.C,v 1.121 2001/10/13 17:42:52 parser Exp $ */ -static const char *RCSId="$Id: parser3.C,v 1.111 2001/09/18 16:05:43 parser Exp $"; #include "pa_config_includes.h" @@ -20,10 +20,40 @@ static const char *RCSId="$Id: parser3.C #include "pa_socks.h" #include "pa_version.h" +#ifdef XML +#include +#endif + //#define DEBUG_POOL_MALLOC // consts +extern const char *main_RCSIds[]; +#ifdef USE_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 *parser3_RCSIds[]; +#ifdef XML +extern const char *xalan_patched_RCSIds[]; +#endif +const char **RCSIds[]={ + main_RCSIds, +#ifdef USE_SMTP + smtp_RCSIds, +#endif + gd_RCSIds, + classes_RCSIds, + types_RCSIds, + parser3_RCSIds, +#ifdef XML + xalan_patched_RCSIds, +#endif + 0 +}; + /// IIS refuses to read bigger chunks const size_t READ_POST_CHUNK_SIZE=0x400*0x400; // 1M @@ -77,7 +107,12 @@ void SAPI::log(Pool& pool, const char *f // message va_list args; va_start(args,fmt); - vfprintf(f, fmt, args); + + char buf[MAX_STRING]; + size_t size=vsnprintf(buf, MAX_STRING, fmt, args); + remove_crlf(buf, buf+size); + + fwrite(buf, size, 1, f); va_end(args); // newline fprintf(f, "\n"); @@ -189,10 +224,20 @@ int main(int argc, char *argv[]) { #ifdef WIN32 SetUnhandledExceptionFilter(&TopLevelExceptionFilter); #endif - // init socks init_socks(pool); +#ifdef XML + /** + * Initialize Xerces and Xalan. + * + * Should be called only once per process before making + * any other API calls. + */ + //_asm int 3; + XalanInitialize(); +#endif + // init global classes init_methoded_array(pool); // init global variables @@ -235,7 +280,7 @@ int main(int argc, char *argv[]) { request_info.uri=env_request_uri; else if(const char *path_info=SAPI::get_env(pool, "PATH_INFO")) if(query_string) { - char *reconstructed_uri=(char *)malloc( + char *reconstructed_uri=(char *)pool.malloc( strlen(path_info)+1/*'?'*/+ strlen(query_string)+1/*0*/); strcpy(reconstructed_uri, path_info);