Diff for /parser3/src/include/pa_request.h between versions 1.61 and 1.86

version 1.61, 2001/03/19 15:29:38 version 1.86, 2001/04/28 12:58:41
Line 1 Line 1
 /** @file  /** @file
         Parser          Parser: request class decl.
   
         Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
   
         Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)          Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
   
         $Id$          $Id$
Line 21 Line 23
 #include "pa_vrequest.h"  #include "pa_vrequest.h"
 #include "pa_vresponse.h"  #include "pa_vresponse.h"
 #include "pa_vcookie.h"  #include "pa_vcookie.h"
   #include "pa_sql_driver_manager.h"
   
 #ifndef NO_STRING_ORIGIN  #ifndef NO_STRING_ORIGIN
 #       define COMPILE_PARAMS  \  #       define COMPILE_PARAMS  \
Line 40 Line 43
 #endif  #endif
   
 class Temp_lang;  class Temp_lang;
   class Methoded;
   
 /// Main workhorse.  /// Main workhorse.
 class Request : public Pooled {  class Request : public Pooled {
Line 47  class Request : public Pooled { Line 51  class Request : public Pooled {
 public:  public:
   
         /// some information from web server          /// some information from web server
         struct Info {          class Info {
           public:
                 const char *document_root;                  const char *document_root;
                 const char *path_translated;                  const char *path_translated;
                 const char *method;                  const char *method;
Line 56  public: Line 61  public:
                 const char *content_type;                  const char *content_type;
                 size_t content_length;                  size_t content_length;
                 const char *cookie;                  const char *cookie;
                   const char *user_agent;
         };          };
                   
         Request(Pool& apool,          Request(Pool& apool,
                 Info& ainfo,                  Info& ainfo,
                 String::Untaint_lang adefault_lang ///< all tainted data default untainted                  String::Untaint_lang adefault_lang ///< all tainted data default untainting lang
         );          );
         ~Request() {}          ~Request() {}
   
         /// global classes          /// global classes
         Hash& classes() { return fclasses; }          Hash& classes() { return fclasses; }
   
         /// core request processing          /**
         void core(Exception& system_exception,                  core request processing
                 const char *sys_auto_path1,  
                 const char *sys_auto_path2);                  BEWARE: may throw exception to you: catch it!
           */
           void core(
                   const char *root_auto_path, ///< path to system auto.p file
                   bool root_auto_fail, ///< fail if system auto.p file not found
                   const char *site_auto_path, ///< path to site auto.p file
                   bool site_auto_fail, ///< fail if site auto.p file not found
                   bool header_only);
   
         /// executes ops          /// executes ops
         void execute(const Array& ops);          void execute(const Array& ops);
   
         /// compiles the file, maybe forcing it's class \a name and \a base_class.          /// compiles the file, maybe forcing it's class @a name and @a base_class.
         VStateless_class *use_file(          VStateless_class *use_file(
                 const char *file, bool fail_on_read_problem=true,                  const String& file_spec, bool fail_on_read_problem=true,
                 const String *name=0,                   const String *name=0, 
                 VStateless_class *base_class=0); // core.C                  VStateless_class *base_class=0); // core.C
         /// compiles a \a source buffer          /// compiles a @a source buffer
         VStateless_class *use_buf(          VStateless_class *use_buf(
                 const char *source, const char *file,                  const char *source, const char *file,
                 VStateless_class *aclass=0, const String *name=0,                   VStateless_class *aclass=0, const String *name=0, 
                 VStateless_class *base_class=0); // core.C                  VStateless_class *base_class=0); // core.C
         /// processes any code-junction there may be inside of \a value          /// processes any code-junction there may be inside of @a value
         Value& process(          Value& process(
                 Value& value,                   Value& value, 
                 const String *name=0,                  const String *name=0,
                 bool intercept_string=true); // execute.C                  bool intercept_string=true); // execute.C
   
         /// write(const) = clean  
         void write(const String& astring) {  
                 wcontext->write(astring, String::Untaint_lang::NO);  
         }  
         /// appending, sure of clean string inside          /// appending, sure of clean string inside
         void write_no_lang(String& astring) {          void write_no_lang(const String& astring) {
                 wcontext->write(astring, String::Untaint_lang::NO);                  wcontext->write(astring, String::UL_CLEAN);
         }          }
         /// appending string, passing language built into string being written          /// appending string, passing language built into string being written
         void write_pass_lang(String& astring) {          void write_pass_lang(const String& astring) {
                 wcontext->write(astring, String::Untaint_lang::PASS_APPENDED);                   wcontext->write(astring, String::UL_PASS_APPENDED); 
         }          }
         /// appending possible string, assigning untaint language          /// appending possible string, assigning untaint language
         void write_assign_lang(Value& avalue) {          void write_assign_lang(Value& avalue) {
Line 109  public: Line 118  public:
         }          }
         /// appending possible string, passing language built into string being written          /// appending possible string, passing language built into string being written
         void write_pass_lang(Value& avalue) {          void write_pass_lang(Value& avalue) {
                 wcontext->write(avalue, String::Untaint_lang::PASS_APPENDED);                   wcontext->write(avalue, String::UL_PASS_APPENDED); 
         }          }
         /// appending sure value, that would be converted to clean string          /// appending sure value, that would be converted to clean string
         void write_no_lang(Value& avalue) {          void write_no_lang(Value& avalue) {
                 wcontext->write(avalue, String::Untaint_lang::NO);                  wcontext->write(avalue, String::UL_CLEAN);
         }          }
         /// appending sure value, not VString          /// appending sure value, not VString
         void write_expr_result(Value& avalue) {          void write_expr_result(Value& avalue) {
                 wcontext->write(avalue);                   wcontext->write(avalue); 
         }          }
   
         /// handy is-value-a-junction ensurer          /// returns relative to @a path  path to @a file 
         void fail_if_junction_(bool is, Value& value, const String& method_name, char *msg);          const String& relative(const char *apath, const String& relative_name);
   
         /// returns relative to \a path  path to \a file           /// returns an absolute @a path to relative @a name
         char *relative(const char *path, const char *file);          const String& absolute(const String& relative_name);
   
         /// returns an absolute \a path to relative \a name          /// returns the mime type of 'user_file_name_cstr'
         char *absolute(const char *name);          const String& mime_type_of(const char *user_file_name_cstr);
   
 public:  public:
                   
         /// info from web server          /// info from web server
         Info& info;          Info& info;
           /// user's post data
           char *post_data;  size_t post_size;
   
         /// default base          /// operators are methods of this class
         VClass ROOT;          Methoded& OP;
         /// $env:fields here          /// $env:fields
         VEnv env;          VEnv env;
         /// $form:elements here          /// $form:elements
         VForm form;          VForm form;
         /// $request:elements here          /// $request:elements
         VRequest request;          VRequest request;
         /// $response:          /// $response:elements
         VResponse response;          VResponse response;
         /// $cookie:          /// $cookie:elements
         VCookie cookie;          VCookie cookie;
   
         /// contexts          /// contexts
Line 152  public: Line 163  public:
         /// contexts          /// contexts
         WContext *wcontext;          WContext *wcontext;
   
           /// 'MAIN' class conglomerat
           VStateless_class *main_class;
   
           /// connection
           SQL_Connection *connection;
           /// table of protocol's libraries. read from $SQL:drivers
           Table *protocol2library;
           /// mail options
           Hash *mail;
           /// PCRE character tables
           unsigned char *pcre_tables;
   
 private: // core data  private: // core data
   
         // classes          // classes
         Hash fclasses;          Hash fclasses;
   
           // already used files to avoid cyclic uses
           Hash used_files;
   
         // execution stack          // execution stack
         Stack stack;          Stack stack;
   
Line 180  private: // lang&raw Line 206  private: // lang&raw
 private: // defaults  private: // defaults
   
         const String::Untaint_lang fdefault_lang;          const String::Untaint_lang fdefault_lang;
         Value *fdefault_content_type;          Value *default_content_type;
   
   private: // mime types
   
           /// $MAIN:MIME-TYPES
           Table *mime_types;
   
 private: // lang manipulation  private: // lang manipulation
   
Line 195  private: // lang manipulation Line 226  private: // lang manipulation
   
 private:  private:
   
         void output_result(const String& body_string);          void output_result(const VFile& body_file, bool header_only);
 };  };
   
 ///     Auto-object used for temporary changing Request::flang.  ///     Auto-object used for temporary changing Request::flang.

Removed from v.1.61  
changed lines
  Added in v.1.86


E-mail: