Diff for /parser3/src/targets/isapi/parser3isapi.C between versions 1.82.2.6.2.1 and 1.82.2.6.2.7

version 1.82.2.6.2.1, 2003/03/18 15:14:20 version 1.82.2.6.2.7, 2003/05/30 09:47:11
Line 107  void SAPI::abort(const char* fmt, ...) { Line 107  void SAPI::abort(const char* fmt, ...) {
   
 const char* SAPI::get_envconst char* name) {  const char* SAPI::get_envconst char* name) {
         SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());          SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());
           char *variable_buf=new(PointerFreeGC) char[MAX_STRING];
         char *variable_buf=new char[MAX_STRING];  
         DWORD variable_len = MAX_STRING-1;          DWORD variable_len = MAX_STRING-1;
   
         if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast<char *>(name),           if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast<char *>(name), 
Line 118  const char* SAPI::get_envconst char* nam Line 117  const char* SAPI::get_envconst char* nam
                         return variable_buf;                          return variable_buf;
                 }                  }
         } else if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {          } else if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
                 variable_buf=new char[variable_len+1];                  variable_buf=new(PointerFreeGC) char[variable_len+1];
                                   
                 if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast<char *>(name),                   if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast<char *>(name), 
                         variable_buf, &variable_len)) {                          variable_buf, &variable_len)) {
Line 143  static int grep_char(const char* s, char Line 142  static int grep_char(const char* s, char
         return result;          return result;
 }  }
 static const char* mk_env_pairconst char* key, const char* value) {  static const char* mk_env_pairconst char* key, const char* value) {
         char *result=new char[strlen(key)+1/*=*/+strlen(value)+1/*0*/];          char *result=new(PointerFreeGC) char[strlen(key)+1/*=*/+strlen(value)+1/*0*/];
         strcpy(result, key); strcat(result, "="); strcat(result, value);          strcpy(result, key); strcat(result, "="); strcat(result, value);
         return result;          return result;
 }  }
 const char* const *SAPI::environment(SAPI_Info& info, ) {  const char* const *SAPI::environment(SAPI_Info& info, ) {
         // we know this buf is writable          // we know this buf is writable
         const char* all_http_vars=SAPI::get_env(pool, "ALL_HTTP");          const char* all_http_vars=SAPI::get_env("ALL_HTTP");
         const int http_var_count=grep_char(all_http_vars, '\n')+1/*\n for theoretical(never saw) this \0*/;          const int http_var_count=grep_char(all_http_vars, '\n')+1/*\n for theoretical(never saw) this \0*/;
                   
         const char* *result=new const char*[IIS51var_count+http_var_count+1/*0*/];          const char* *result=new const char*[IIS51var_count+http_var_count+1/*0*/];
Line 158  const char* const *SAPI::environment(SAP Line 157  const char* const *SAPI::environment(SAP
         // IIS5.1 vars          // IIS5.1 vars
         for(int i=0; i<IIS51var_count; i++) {          for(int i=0; i<IIS51var_count; i++) {
                 const char* key=IIS51vars[i];                  const char* key=IIS51vars[i];
                 if(const char* value=SAPI::get_env(pool, key))                  if(const char* value=SAPI::get_env(key))
                         *cur++=mk_env_pair(pool, key, value);                          *cur++=mk_env_pair(key, value);
         }          }
   
         // HTTP_* vars          // HTTP_* vars
         if(char *s=all_http_vars) {          if(char *s=all_http_vars) {
                 while(char *key=lsplit(&s, '\n'))                  while(char *key=lsplit(&s, '\n'))
                         if(char *value=lsplit(key, ':'))                          if(char *value=lsplit(key, ':'))
                                 *cur++=mk_env_pair(pool, key, value);                                  *cur++=mk_env_pair(key, value);
         }          }
                   
         // mark EOE          // mark EOE
Line 249  void SAPI::send_header() { Line 248  void SAPI::send_header() {
         header_info.cchStatus=strlen(header_info.pszStatus);          header_info.cchStatus=strlen(header_info.pszStatus);
         *ctx.header << "\r\n"; // ISAPI v<5 did quite well without it          *ctx.header << "\r\n"; // ISAPI v<5 did quite well without it
         header_info.pszHeader=ctx.header->cstr();          header_info.pszHeader=ctx.header->cstr();
         header_info.cchHeader=ctx.header->size();          header_info.cchHeader=ctx.header->length();
         header_info.fKeepConn=true;          header_info.fKeepConn=true;
   
         ctx.lpECB->dwHttpStatusCode=ctx.http_response_code;          ctx.lpECB->dwHttpStatusCode=ctx.http_response_code;
Line 313  BOOL WINAPI GetExtensionVersion(HSE_VERS Line 312  BOOL WINAPI GetExtensionVersion(HSE_VERS
 */  */
   
 void real_parser_handlerLPEXTENSION_CONTROL_BLOCK lpECB, bool header_only) {  void real_parser_handlerLPEXTENSION_CONTROL_BLOCK lpECB, bool header_only) {
         static_cast<SAPI_func_context *>(pool.get_context())->header=new String();          static_cast<SAPI_func_context *>(pool.get_context())->header=new String;
                   
         // Request info          // Request info
         Request::Info request_info;          Request::Info request_info;  memset(&request_info, 0, sizeof(request_info));
   
         size_t path_translated_buf_size=strlen(lpECB->lpszPathTranslated)+1;          size_t path_translated_buf_size=strlen(lpECB->lpszPathTranslated)+1;
         char *filespec_to_process=pool.copy(lpECB->lpszPathTranslated, path_translated_buf_size);          char *filespec_to_process=pool.copy(lpECB->lpszPathTranslated, path_translated_buf_size);
Line 324  void real_parser_handlerLPEXTENSION_CONT Line 323  void real_parser_handlerLPEXTENSION_CONT
         back_slashes_to_slashes(filespec_to_process);          back_slashes_to_slashes(filespec_to_process);
 #endif  #endif
   
         if(const char* path_info=SAPI::get_env(pool, "PATH_INFO")) {          if(const char* path_info=SAPI::get_env("PATH_INFO")) {
                 // IIS                  // IIS
                 size_t len=strlen(filespec_to_process)-strlen(path_info);                  size_t len=strlen(filespec_to_process)-strlen(path_info);
                 char *buf=new char[len+1];                  char *buf=new(PointerFreeGC) char[len+1];
                 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
Line 339  void real_parser_handlerLPEXTENSION_CONT Line 338  void real_parser_handlerLPEXTENSION_CONT
         request_info.method=lpECB->lpszMethod;          request_info.method=lpECB->lpszMethod;
         request_info.query_string=lpECB->lpszQueryString;          request_info.query_string=lpECB->lpszQueryString;
         if(lpECB->lpszQueryString && *lpECB->lpszQueryString) {          if(lpECB->lpszQueryString && *lpECB->lpszQueryString) {
                 char *reconstructed_uri=new char[                  char *reconstructed_uri=new(PointerFreeGC) char[
                         strlen(lpECB->lpszPathInfo)+1/*'?'*/+                          strlen(lpECB->lpszPathInfo)+1/*'?'*/+
                         strlen(lpECB->lpszQueryString)+1/*0*/];                          strlen(lpECB->lpszQueryString)+1/*0*/];
                 strcpy(reconstructed_uri, lpECB->lpszPathInfo);                  strcpy(reconstructed_uri, lpECB->lpszPathInfo);
Line 351  void real_parser_handlerLPEXTENSION_CONT Line 350  void real_parser_handlerLPEXTENSION_CONT
                   
         request_info.content_type=lpECB->lpszContentType;          request_info.content_type=lpECB->lpszContentType;
         request_info.content_length=lpECB->cbTotalBytes;          request_info.content_length=lpECB->cbTotalBytes;
         request_info.cookie=SAPI::get_env(pool, "HTTP_COOKIE");          request_info.cookie=SAPI::get_env("HTTP_COOKIE");
         request_info.mail_received=false;          request_info.mail_received=false;
                   
         // prepare to process request          // prepare to process request
         Request request(pool,          Request request(pool,
                 request_info,                  request_info,
                 String::UL_HTML|String::UL_OPTIMIZE_BIT,                  String::L_HTML|String::L_OPTIMIZE_BIT,
 #ifdef _DEBUG  #ifdef _DEBUG
                 true                  true
 #else  #else
Line 393  void call_real_parser_handler__do_SEH Line 392  void call_real_parser_handler__do_SEH
         LPEXCEPTION_POINTERS system_exception=0;          LPEXCEPTION_POINTERS system_exception=0;
         __try {          __try {
 #endif  #endif
                 real_parser_handler(pool, lpECB, header_only);                  real_parser_handler(lpECB, header_only);
                                   
 #if _MSC_VER & !defined(_DEBUG)  #if _MSC_VER & !defined(_DEBUG)
         } __except (          } __except (
Line 425  inline DWORD RealHttpExtensionProc(LPEXT Line 424  inline DWORD RealHttpExtensionProc(LPEXT
   
         bool header_only=strcasecmp(lpECB->lpszMethod, "HEAD")==0;          bool header_only=strcasecmp(lpECB->lpszMethod, "HEAD")==0;
         try { // global try          try { // global try
                 call_real_parser_handler__do_SEH(pool, lpECB, header_only);                  call_real_parser_handler__do_SEH(lpECB, header_only);
                 // successful finish                  // successful finish
         } catch(const Exception& e) { // global problem          } catch(const Exception& e) { // global problem
                 // don't allocate anything on pool here:                  // don't allocate anything on pool here:
Line 433  inline DWORD RealHttpExtensionProc(LPEXT Line 432  inline DWORD RealHttpExtensionProc(LPEXT
                         //   and there could be out-of-memory exception                          //   and there could be out-of-memory exception
                 const char* body=e.comment();                  const char* body=e.comment();
                 // log it                  // log it
                 SAPI::log(pool, "exception in request exception handler: %s", body);                  SAPI::log("exception in request exception handler: %s", body);
   
                 //                  //
                 int content_length=strlen(body);                  int content_length=strlen(body);
Line 461  inline DWORD RealHttpExtensionProc(LPEXT Line 460  inline DWORD RealHttpExtensionProc(LPEXT
   
                 // send body                  // send body
                 if(!header_only)                  if(!header_only)
                         SAPI::send_body(pool, body, content_length);                          SAPI::send_body(body, content_length);
   
                 // unsuccessful finish                  // unsuccessful finish
         }          }

Removed from v.1.82.2.6.2.1  
changed lines
  Added in v.1.82.2.6.2.7


E-mail: