|
|
| version 1.94, 2005/08/26 11:59:16 | version 1.103, 2009/10/06 11:41:02 |
|---|---|
| Line 19 static const char * const IDENT_PARSER3I | Line 19 static const char * const IDENT_PARSER3I |
| #include "pa_version.h" | #include "pa_version.h" |
| #include "pa_socks.h" | #include "pa_socks.h" |
| #define WINVER 0x0400 | |
| #include <windows.h> | #include <windows.h> |
| #include <process.h> | #include <process.h> |
| Line 76 public: | Line 77 public: |
| void SAPI::log(SAPI_Info& SAPI_info, const char* fmt, ...) { | void SAPI::log(SAPI_Info& SAPI_info, const char* fmt, ...) { |
| va_list args; | va_list args; |
| va_start(args,fmt); | va_start(args,fmt); |
| char buf[MAX_STRING]; | char buf[MAX_LOG_STRING]; |
| const char* prefix="PARSER_ERROR:"; | const char* prefix="PARSER_ERROR:"; |
| strcpy(buf, prefix); | strcpy(buf, prefix); |
| char *start=buf+strlen(prefix); | char *start=buf+strlen(prefix); |
| DWORD size=vsnprintf(start, MAX_STRING-strlen(prefix), fmt, args); | DWORD size=vsnprintf(start, MAX_LOG_STRING-strlen(prefix), fmt, args); |
| remove_crlf(start, start+size); | size=remove_crlf(start, start+size); |
| SAPI_info.lpECB->ServerSupportFunction(SAPI_info.lpECB->ConnID, | SAPI_info.lpECB->ServerSupportFunction(SAPI_info.lpECB->ConnID, |
| HSE_APPEND_LOG_PARAMETER, buf, &size, 0); | HSE_APPEND_LOG_PARAMETER, buf, &size, 0); |
| Line 211 void SAPI::add_header_attribute(SAPI_Inf | Line 212 void SAPI::add_header_attribute(SAPI_Inf |
| if(strcasecmp(dont_store_key, "location")==0) | if(strcasecmp(dont_store_key, "location")==0) |
| SAPI_info.http_response_code=302; | SAPI_info.http_response_code=302; |
| if(strcasecmp(dont_store_key, "status")==0) | if(strcasecmp(dont_store_key, HTTP_STATUS)==0) |
| SAPI_info.http_response_code=atoi(dont_store_value); | SAPI_info.http_response_code=atoi(dont_store_value); |
| else | else |
| (*SAPI_info.header) << pa_strdup(dont_store_key) << ": " << pa_strdup(dont_store_value) << "\r\n"; | (*SAPI_info.header) << capitalize(dont_store_key) << ": " << pa_strdup(dont_store_value) << "\r\n"; |
| } | } |
| /// @todo intelligent cache-control | /// @todo intelligent cache-control |
| Line 273 static bool parser_init() { | Line 274 static bool parser_init() { |
| // successful finish | // successful finish |
| return true; | return true; |
| } catch(const Exception& e) { // global problem | } catch(.../*const Exception& e*/) { // global problem |
| //const char* body=e.comment(); | //const char* body=e.comment(); |
| // unsuccessful finish | // unsuccessful finish |
| Line 317 BOOL WINAPI TerminateExtension( | Line 318 BOOL WINAPI TerminateExtension( |
| @test | @test |
| PARSER_VERSION from outside | PARSER_VERSION from outside |
| */ | */ |
| void real_parser_handler(SAPI_Info& SAPI_info, bool header_only) { | void real_parser_handler(SAPI_Info& SAPI_info, bool header_only) { |
| // collect garbage from prev request | // collect garbage from prev request |
| #ifndef PA_DEBUG_DISABLE_GC | #ifndef PA_DEBUG_DISABLE_GC |
| Line 348 void real_parser_handler(SAPI_Info& SAPI | Line 348 void real_parser_handler(SAPI_Info& SAPI |
| strncpy(buf, filespec_to_process, len); buf[len]=0; | strncpy(buf, filespec_to_process, len); buf[len]=0; |
| request_info.document_root=buf; | request_info.document_root=buf; |
| } else | } else |
| throw Exception("parser.runtime", | throw Exception(PARSER_RUNTIME, |
| 0, | 0, |
| "ISAPI: no PATH_INFO defined (in reinventing DOCUMENT_ROOT)"); | "ISAPI: no PATH_INFO defined (in reinventing DOCUMENT_ROOT)"); |
| Line 390 void real_parser_handler(SAPI_Info& SAPI | Line 390 void real_parser_handler(SAPI_Info& SAPI |
| snprintf(config_filespec, MAX_STRING, | snprintf(config_filespec, MAX_STRING, |
| "%s/%s", | "%s/%s", |
| beside_binary_path, AUTO_FILE_NAME); | beside_binary_path, AUTO_FILE_NAME); |
| bool fail_on_config_read_problem=true;//entry_exists(config_filespec); | bool fail_on_config_read_problem=entry_exists(config_filespec); |
| // process the request | // process the request |
| request.core( | request.core( |
| Line 476 DWORD WINAPI HttpExtensionProc(LPEXTENSI | Line 476 DWORD WINAPI HttpExtensionProc(LPEXTENSI |
| // prepare header // not using SAPI func wich allocates on pool | // prepare header // not using SAPI func wich allocates on pool |
| char header_buf[MAX_STRING]; | char header_buf[MAX_STRING]; |
| int header_len=snprintf(header_buf, MAX_STRING, | int header_len=snprintf(header_buf, MAX_STRING, |
| "content-type: text/plain\r\n" | HTTP_CONTENT_TYPE_CAPITALIZED ": text/plain\r\n" |
| "content-length: %u\r\n" | HTTP_CONTENT_LENGTH_CAPITALIZED ": %u\r\n" |
| // "expires: Fri, 23 Mar 2001 09:32:23 GMT\r\n" | // "expires: Fri, 23 Mar 2001 09:32:23 GMT\r\n" |
| "\r\n", | "\r\n", |
| content_length); | content_length); |
| Line 509 DWORD WINAPI HttpExtensionProc(LPEXTENSI | Line 509 DWORD WINAPI HttpExtensionProc(LPEXTENSI |
| // prepare header // not using SAPI func wich allocates on pool | // prepare header // not using SAPI func wich allocates on pool |
| char header_buf[MAX_STRING]; | char header_buf[MAX_STRING]; |
| int header_len=snprintf(header_buf, MAX_STRING, | int header_len=snprintf(header_buf, MAX_STRING, |
| "content-type: text/plain\r\n" | HTTP_CONTENT_TYPE_CAPITALIZED ": text/plain\r\n" |
| "content-length: %u\r\n" | HTTP_CONTENT_LENGTH_CAPITALIZED ": %u\r\n" |
| "expires: Fri, 23 Mar 2001 09:32:23 GMT\r\n" | "expires: Fri, 23 Mar 2001 09:32:23 GMT\r\n" |
| "\r\n", | "\r\n", |
| content_length); | content_length); |