Diff for /parser3/src/targets/isapi/parser3isapi.C between versions 1.139 and 1.143

version 1.139, 2026/09/30 16:44:20 version 1.143, 2026/10/18 22:42:43
Line 82  void SAPI::log(SAPI_Info& SAPI_info, con Line 82  void SAPI::log(SAPI_Info& SAPI_info, con
         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_LOG_STRING-strlen(prefix), fmt, args);          DWORD size=pa_vsnprintf(start, MAX_LOG_STRING-strlen(prefix), fmt, args);
         size=remove_crlf(start, start+size);          size=remove_crlf(start, start+size);
   
         SAPI_info.lpECB->ServerSupportFunction(SAPI_info.lpECB->ConnID, HSE_APPEND_LOG_PARAMETER, buf, &size, 0);          SAPI_info.lpECB->ServerSupportFunction(SAPI_info.lpECB->ConnID, HSE_APPEND_LOG_PARAMETER, buf, &size, 0);
Line 231  void SAPI::send_headers(SAPI_Info& SAPI_ Line 231  void SAPI::send_headers(SAPI_Info& SAPI_
                         header_info.pszStatus="401 Authorization Required";                          header_info.pszStatus="401 Authorization Required";
                         break;                          break;
                 default:                  default:
                         snprintf(status_buf, MAX_STATUS_LENGTH,                           pa_snprintf(status_buf, MAX_STATUS_LENGTH, 
                                 "%d Undescribed", SAPI_info.http_response_code);                                  "%d Undescribed", SAPI_info.http_response_code);
                         header_info.pszStatus=status_buf;                          header_info.pszStatus=status_buf;
                         break;                          break;
Line 286  static void parser_done() { Line 286  static void parser_done() {
 /// ISAPI //  /// ISAPI //
 BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) {  BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) {
         pVer->dwExtensionVersion = HSE_VERSION;          pVer->dwExtensionVersion = HSE_VERSION;
         pa_strncpy(pVer->lpszExtensionDesc, "Parser " PARSER_VERSION, HSE_MAX_EXT_DLL_NAME_LEN);          pa_strncpy(pVer->lpszExtensionDesc, "Parser " PARSER_VERSION_WITH_FEATURES, HSE_MAX_EXT_DLL_NAME_LEN);
         return parser_init();          return parser_init();
 }  }
 // dwFlags & HSE_TERM_MUST_UNLOAD means we can't return false  // dwFlags & HSE_TERM_MUST_UNLOAD means we can't return false
Line 310  BOOL WINAPI TerminateExtension( Line 310  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) {
         // collect garbage from prev request          // collect garbage from prev request
         pa_gc_collect();          pa_gc_collect();
                   
Line 350  void real_parser_handler(SAPI_Info& SAPI Line 350  void real_parser_handler(SAPI_Info& SAPI
                 beside_binary_path[0]='.'; beside_binary_path[1]=0;                  beside_binary_path[0]='.'; beside_binary_path[1]=0;
         }          }
         char config_filespec[MAX_STRING];          char config_filespec[MAX_STRING];
         snprintf(config_filespec, MAX_STRING, "%s/%s", beside_binary_path, AUTO_FILE_NAME);          pa_snprintf(config_filespec, MAX_STRING, "%s/%s", beside_binary_path, AUTO_FILE_NAME);
   
         // process the request          // process the request
         request.core(entry_exists(config_filespec) ? config_filespec : NULL, header_only);          request.core(entry_exists(config_filespec) ? config_filespec : NULL);
 }  }
   
 #ifdef PA_SUPPRESS_SYSTEM_EXCEPTION  #ifdef PA_SUPPRESS_SYSTEM_EXCEPTION
 static const Exception call_real_parser_handler__do_PEH_return_it(SAPI_Info& SAPI_info, bool header_only) {  static const Exception call_real_parser_handler__do_PEH_return_it(SAPI_Info& SAPI_info) {
         try {          try {
                 real_parser_handler(SAPI_info, header_only);                  real_parser_handler(SAPI_info);
         } catch(const Exception& e) {          } catch(const Exception& e) {
                 return e;                  return e;
         }          }
Line 367  static const Exception call_real_parser_ Line 367  static const Exception call_real_parser_
         return Exception();          return Exception();
 }  }
   
 static void call_real_parser_handler__supress_system_exception(SAPI_Info& SAPI_info, bool header_only) {  static void call_real_parser_handler__supress_system_exception(SAPI_Info& SAPI_info) {
         Exception parser_exception;          Exception parser_exception;
         LPEXCEPTION_POINTERS system_exception=0;          LPEXCEPTION_POINTERS system_exception=0;
   
         __try {          __try {
                 parser_exception=call_real_parser_handler__do_PEH_return_it(SAPI_info, header_only);                  parser_exception=call_real_parser_handler__do_PEH_return_it(SAPI_info);
         } __except ( (system_exception=GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) {          } __except ( (system_exception=GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) {
                 if(system_exception)                  if(system_exception)
                         if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord)                          if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord)
Line 389  static void call_real_parser_handler__su Line 389  static void call_real_parser_handler__su
 #endif  #endif
   
 DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) {  DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) {
           Temp_gc_references gc_references; // for pointers GC does not see
   
         //_asm int 3;          //_asm int 3;
         SAPI_Info SAPI_info={          SAPI_Info SAPI_info={
                 lpECB,                  lpECB,
Line 396  DWORD WINAPI HttpExtensionProc(LPEXTENSI Line 398  DWORD WINAPI HttpExtensionProc(LPEXTENSI
                 200 // default http_response_code [lpECB->dwHttpStatusCode seems to be always 0, even on 404 redirect to /404.html]                  200 // default http_response_code [lpECB->dwHttpStatusCode seems to be always 0, even on 404 redirect to /404.html]
         };          };
   
         bool header_only=strcasecmp(lpECB->lpszMethod, "HEAD")==0;  
         try { // global try          try { // global try
 #ifdef PA_SUPPRESS_SYSTEM_EXCEPTION  #ifdef PA_SUPPRESS_SYSTEM_EXCEPTION
                 call_real_parser_handler__supress_system_exception(                  call_real_parser_handler__supress_system_exception(
 #else  #else
                 real_parser_handler(                  real_parser_handler(
 #endif  #endif
                         SAPI_info, header_only);                          SAPI_info);
                 // successful finish                  // successful finish
         } catch(const Exception& e) { // just in case          } catch(const Exception& e) { // just in case
                 // log it                  // log it
Line 421  DWORD WINAPI HttpExtensionProc(LPEXTENSI Line 422  DWORD WINAPI HttpExtensionProc(LPEXTENSI
                 lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);                  lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
   
                 // send body                  // send body
                 if(!header_only)                  if(strcasecmp(lpECB->lpszMethod, "HEAD")!=0)
                         SAPI::send_body(SAPI_info, e.comment(), strlen(e.comment()));                          SAPI::send_body(SAPI_info, e.comment(), strlen(e.comment()));
   
                 // unsuccessful finish                  // unsuccessful finish

Removed from v.1.139  
changed lines
  Added in v.1.143


E-mail: