Diff for /parser3/src/main/pa_request.C between versions 1.245.2.37.2.9 and 1.245.2.37.2.18

version 1.245.2.37.2.9, 2003/03/24 11:05:28 version 1.245.2.37.2.18, 2003/03/27 14:51:28
Line 30  static const char* IDENT_REQUEST_C="$Dat Line 30  static const char* IDENT_REQUEST_C="$Dat
 #include "pa_vform.h"  #include "pa_vform.h"
 #include "pa_vcookie.h"  #include "pa_vcookie.h"
 #include "pa_vresponse.h"  #include "pa_vresponse.h"
   #include "pa_vmemory.h"
   
 // consts  // consts
   
Line 96  Request::Request(SAPI_Info& asapi_info, Line 97  Request::Request(SAPI_Info& asapi_info,
         rcontext(0),          rcontext(0),
         wcontext(0),          wcontext(0),
         flang(adefault_lang),          flang(adefault_lang),
         fconnection(),          fconnection(0),
         finterrupted(false),          finterrupted(false),
   
         // public          // public
Line 136  Request::Request(SAPI_Info& asapi_info, Line 137  Request::Request(SAPI_Info& asapi_info,
   
         /// methodless          /// methodless
         // env class          // env class
         classes().put(*new StringBody(ENV_CLASS_NAME), new VEnv(asapi_info));          classes().put(StringBody(ENV_CLASS_NAME), new VEnv(asapi_info));
         // status class          // status class
         if(status_allowed)          if(status_allowed)
                 classes().put(*new StringBody(STATUS_CLASS_NAME), new VStatus());                  classes().put(StringBody(STATUS_CLASS_NAME), new VStatus());
         // request class          // request class
         classes().put(*new StringBody(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets));                classes().put(StringBody(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets));   
         // cookie class          // cookie class
         classes().put(*new StringBody(COOKIE_CLASS_NAME), &cookie);          classes().put(StringBody(COOKIE_CLASS_NAME), &cookie);
   
         /// methoded          /// methoded
         // response class          // response class
Line 159  Request::Request(SAPI_Info& asapi_info, Line 160  Request::Request(SAPI_Info& asapi_info,
                 Value& math=*new VMath;                  Value& math=*new VMath;
                 classes().put(math.get_class()->base_class()->name(), &math);                  classes().put(math.get_class()->base_class()->name(), &math);
         }          }
           // memory class
           {
                   Value& memory=*new VMemory;
                   classes().put(memory.get_class()->base_class()->name(), &memory);
           }
 }  }
   
 Request::~Request() {  Request::~Request() {
Line 250  gettimeofday(&mt[0],NULL); Line 256  gettimeofday(&mt[0],NULL);
                         while(const char* before=strchr(after, '/')) {                          while(const char* before=strchr(after, '/')) {
                                 String& sfile_spec=*new String;                                  String& sfile_spec=*new String;
                                 if(after!=request_info.path_translated) {                                  if(after!=request_info.path_translated) {
                                         sfile_spec.append(                                          sfile_spec.append_strdup(
                                                 request_info.path_translated, before-request_info.path_translated,                                                  request_info.path_translated, before-request_info.path_translated,
                                                 String::L_CLEAN);                                                  String::L_CLEAN);
                                         sfile_spec << "/" AUTO_FILE_NAME;                                          sfile_spec << "/" AUTO_FILE_NAME;
Line 265  gettimeofday(&mt[0],NULL); Line 271  gettimeofday(&mt[0],NULL);
   
                 // compile requested file                  // compile requested file
                 String& spath_translated=*new String;                  String& spath_translated=*new String;
                 spath_translated.append(request_info.path_translated, 0, String::L_TAINTED);                  spath_translated.append_help_length(request_info.path_translated, 0, String::L_TAINTED);
                 use_file(main_class,                  use_file(main_class,
                         spath_translated, true/* ignore class_path */,                           spath_translated, true/* ignore class_path */, 
                         true/* fail on read problem*/, true/* fail on abscence */);                          true/* fail on read problem*/, true/* fail on abscence */);
Line 324  gettimeofday(&mt[2],NULL); Line 330  gettimeofday(&mt[2],NULL);
                                 }                                  }
   
                 VFile* body_file=body_vstring_after_post_process->as_vfile(                  VFile* body_file=body_vstring_after_post_process->as_vfile(
                         String::L_UNSPECIFIED);                          String::L_UNSPECIFIED, &charsets);
   
                 // extract response body                  // extract response body
                 Value* body_value=response.fields().get(download_name);                  Value* body_value=response.fields().get(download_name);
Line 333  gettimeofday(&mt[2],NULL); Line 339  gettimeofday(&mt[2],NULL);
                         body_value=response.fields().get(body_name);                          body_value=response.fields().get(body_name);
   
                 if(body_value) // there is some $response:body                  if(body_value) // there is some $response:body
                         body_file=body_value->as_vfile();                          body_file=body_value->as_vfile(String::L_UNSPECIFIED, &charsets);
   
 #ifdef RESOURCES_DEBUG  #ifdef RESOURCES_DEBUG
 //measure:after postprocess  //measure:after postprocess
Line 421  t[9]-t[3] Line 427  t[9]-t[3]
 #ifndef NO_STRING_ORIGIN  #ifndef NO_STRING_ORIGIN
                                                         const String_fragment::Origin& origin=name->origin();                                                          const String_fragment::Origin& origin=name->origin();
                                                         if(origin.file) {                                                          if(origin.file) {
                                                                 *row+=*new StringBody(origin.file, 0, true)); // file column                                                                  *row+=StringBody(origin.file, 0, true)); // file column
                                                                 *row+=*new StringBody(                                                                  *row+=StringBody(
                                                                         pool().format_integer(1+origin.line),                                                                           pool().format_integer(1+origin.line), 
                                                                         0, true)); // line column                                                                          0, true)); // line column
                                                         }                                                          }
Line 442  t[9]-t[3] Line 448  t[9]-t[3]
                                 // doing that ugly                                  // doing that ugly
   
                                 // make up result: $origin $source $comment $type $code                                  // make up result: $origin $source $comment $type $code
                                 char *buf=new char[MAX_STRING];                                  char *buf=new(PointerFreeGC) char[MAX_STRING];
                                 size_t printed=0;                                  size_t printed=0;
                                 if(const String* problem_source=e.problem_source()) {                                  if(const String* problem_source=e.problem_source()) {
                                         /*const String_fragment::Origin& origin=problem_source->origin();                                          /*const String_fragment::Origin& origin=problem_source->origin();
Line 468  t[9]-t[3] Line 474  t[9]-t[3]
                         }                          }
   
                         VString body_vstring(*body_string);                          VString body_vstring(*body_string);
                         VFile* body_file=body_vstring.as_vfile();                          VFile* body_file=body_vstring.as_vfile(String::L_UNSPECIFIED, &charsets);
   
                         // ERROR. write it out                          // ERROR. write it out
                         output_result(body_file, header_only, false);                          output_result(body_file, header_only, false);
Line 567  const String& Request::absolute(const St Line 573  const String& Request::absolute(const St
                 result << relative_name;                  result << relative_name;
                 return result;                  return result;
         } else           } else 
                 return relative_name.pos("://")<0? relative(request_info.path_translated, relative_name)                  return relative_name.pos("://")==STRING_NOT_FOUND?
                           relative(request_info.path_translated, relative_name)
                         :relative_name; // something like "http://xxx"                          :relative_name; // something like "http://xxx"
 }  }
   
Line 582  static void add_header_attribute( Line 589  static void add_header_attribute(
   
         SAPI::add_header_attribute(r->sapi_info,          SAPI::add_header_attribute(r->sapi_info,
                 aattribute.cstr(),                   aattribute.cstr(), 
                 attributed_meaning_to_string(ameaning, String::L_HTTP_HEADER, false).                  attributed_meaning_to_string(*ameaning, String::L_HTTP_HEADER, false).
                         cstr(String::L_UNSPECIFIED));                          cstr(String::L_UNSPECIFIED));
 }  }
 void Request::output_result(VFile* body_file, bool header_only, bool as_attachment) {  void Request::output_result(VFile* body_file, bool header_only, bool as_attachment) {
Line 660  const String& Request::mime_type_of(cons Line 667  const String& Request::mime_type_of(cons
 }  }
   
 #ifdef XML  #ifdef XML
   
 GdomeDOMString_auto_ptr Request::transcode(const String& s) {  GdomeDOMString_auto_ptr Request::transcode(const String& s) {
         return charsets.source().transcode(s);          return charsets.source().transcode(s);
 }  }
   
 const String& Request::transcode(GdomeDOMString* s  GdomeDOMString_auto_ptr Request::transcode(const StringBody s) {
 #ifndef NO_STRING_ORIGIN          return charsets.source().transcode(s);
         , const String& origin  
 #endif  
         ) {  
         return charsets.source().transcode(s  
 #ifndef NO_STRING_ORIGIN  
                 , origin  
 #endif  
                 );  
 }  }
   
 const String& Request::transcode(xmlChar* s  const String& Request::transcode(GdomeDOMString* s) {
 #ifndef NO_STRING_ORIGIN          return charsets.source().transcode(s);
         , const String& origin  }
 #endif  
         ) {  const String& Request::transcode(xmlChar* s) {
         return charsets.source().transcode(s          return charsets.source().transcode(s);
 #ifndef NO_STRING_ORIGIN  
                 , origin  
 #endif  
                 );  
 }  }
 #endif  #endif

Removed from v.1.245.2.37.2.9  
changed lines
  Added in v.1.245.2.37.2.18


E-mail: