|
|
| version 1.145, 2002/11/27 12:44:35 | version 1.152, 2003/01/21 15:51:14 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: globals. | Parser: globals. |
| Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| Line 32 extern "C" { | Line 32 extern "C" { |
| String *content_type_name; | String *content_type_name; |
| String *charset_name; | String *charset_name; |
| String *body_name; | String *body_name; |
| String *download_name; | |
| String *value_name; | String *value_name; |
| String *expires_name; | String *expires_name; |
| String *path_name; | String *path_name; |
| Line 80 String *hash_default_element_name; | Line 81 String *hash_default_element_name; |
| String *http_method_name; | String *http_method_name; |
| String *http_timeout_name; | String *http_timeout_name; |
| String *http_headers_name; | String *http_headers_name; |
| String *http_any_status_name; | |
| String *file_status_name; | String *file_status_name; |
| Line 257 xmlFileOpenLocalhost (const char *filena | Line 259 xmlFileOpenLocalhost (const char *filena |
| * Returns the number of bytes written | * Returns the number of bytes written |
| */ | */ |
| static int | static int |
| xmlFileRead (void * context, char * buffer, int len) { | pa_xmlFileRead (void * context, char * buffer, int len) { |
| return(fread(&buffer[0], 1, len, (FILE *) context)); | return(fread(&buffer[0], 1, len, (FILE *) context)); |
| } | } |
| /** | /** |
| * xmlFileWrite: | |
| * @context: the I/O context | |
| * @buffer: where to drop data | |
| * @len: number of bytes to write | |
| * | |
| * Write @len bytes from @buffer to the I/O channel. | |
| * | |
| * Returns the number of bytes written | |
| */ | |
| static int | |
| xmlFileWrite (void * context, const char * buffer, int len) { | |
| return(fwrite(&buffer[0], 1, len, (FILE *) context)); | |
| } | |
| /** | |
| * xmlFileClose: | * xmlFileClose: |
| * @context: the I/O context | * @context: the I/O context |
| * | * |
| * Close an I/O channel | * Close an I/O channel |
| */ | */ |
| static int | static int |
| xmlFileClose (void * context) { | pa_xmlFileClose (void * context) { |
| return ( ( fclose((FILE *) context) == EOF ) ? -1 : 0 ); | return ( ( fclose((FILE *) context) == EOF ) ? -1 : 0 ); |
| } | } |
| Line 319 void pa_globals_init(Pool& pool) { | Line 306 void pa_globals_init(Pool& pool) { |
| content_type_name=NEW String(pool, CONTENT_TYPE_NAME); | content_type_name=NEW String(pool, CONTENT_TYPE_NAME); |
| charset_name=NEW String(pool, CHARSET_NAME); | charset_name=NEW String(pool, CHARSET_NAME); |
| body_name=NEW String(pool, BODY_NAME); | body_name=NEW String(pool, BODY_NAME); |
| download_name=NEW String(pool, DOWNLOAD_NAME); | |
| value_name=NEW String(pool, VALUE_NAME); | value_name=NEW String(pool, VALUE_NAME); |
| expires_name=NEW String(pool, EXPIRES_NAME); | expires_name=NEW String(pool, EXPIRES_NAME); |
| path_name=NEW String(pool, PATH_NAME); | path_name=NEW String(pool, PATH_NAME); |
| Line 372 void pa_globals_init(Pool& pool) { | Line 360 void pa_globals_init(Pool& pool) { |
| http_method_name=NEW String(pool, HTTP_METHOD_NAME); | http_method_name=NEW String(pool, HTTP_METHOD_NAME); |
| http_timeout_name=NEW String(pool, HTTP_TIMEOUT_NAME); | http_timeout_name=NEW String(pool, HTTP_TIMEOUT_NAME); |
| http_headers_name=NEW String(pool, HTTP_HEADERS_NAME); | http_headers_name=NEW String(pool, HTTP_HEADERS_NAME); |
| http_any_status_name=NEW String(pool, HTTP_ANY_STATUS_NAME); | |
| file_status_name=NEW String(pool, FILE_STATUS_NAME); | file_status_name=NEW String(pool, FILE_STATUS_NAME); |
| Line 380 void pa_globals_init(Pool& pool) { | Line 369 void pa_globals_init(Pool& pool) { |
| #define ULN(cstr, LANG) \ | #define ULN(cstr, LANG) \ |
| untaint_lang_name2enum->put(*NEW String(pool, cstr), (int)String::UL_##LANG); | untaint_lang_name2enum->put(*NEW String(pool, cstr), (int)String::UL_##LANG); |
| ULN("as-is", AS_IS); | ULN("as-is", AS_IS); |
| ULN("optimized-as-is", AS_IS|String::UL_OPTIMIZE_BIT); | |
| ULN("file-spec", FILE_SPEC); | ULN("file-spec", FILE_SPEC); |
| ULN("http-header", HTTP_HEADER); | ULN("http-header", HTTP_HEADER); |
| ULN("mail-header", MAIL_HEADER); | ULN("mail-header", MAIL_HEADER); |
| Line 388 void pa_globals_init(Pool& pool) { | Line 378 void pa_globals_init(Pool& pool) { |
| ULN("sql", SQL); | ULN("sql", SQL); |
| ULN("js", JS); | ULN("js", JS); |
| ULN("xml", XML); | ULN("xml", XML); |
| ULN("optimized-xml", XML|String::UL_OPTIMIZE_BIT); | |
| ULN("html", HTML); | ULN("html", HTML); |
| ULN("optimized-html", HTML|String::UL_OPTIMIZE_BIT); | ULN("optimized-html", HTML|String::UL_OPTIMIZE_BIT); |
| Line 584 void pa_globals_init(Pool& pool) { | Line 575 void pa_globals_init(Pool& pool) { |
| // http://localhost/abc -> $ENV{DOCUMENT_ROOT}/abc | ./abc | // http://localhost/abc -> $ENV{DOCUMENT_ROOT}/abc | ./abc |
| xmlRegisterInputCallbacks( | xmlRegisterInputCallbacks( |
| xmlFileMatchLocalhost, xmlFileOpenLocalhost, | xmlFileMatchLocalhost, xmlFileOpenLocalhost, |
| xmlFileRead, xmlFileClose); | pa_xmlFileRead, pa_xmlFileClose); |
| // XSLT stylesheet manager | // XSLT stylesheet manager |
| cache_managers->put(*NEW String(pool, "stylesheet"), | cache_managers->put(*NEW String(pool, "stylesheet"), |