--- parser3/src/include/pa_request.h 2001/03/21 14:06:43 1.65 +++ parser3/src/include/pa_request.h 2001/05/17 15:20:15 1.89 @@ -5,12 +5,13 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_request.h,v 1.65 2001/03/21 14:06:43 paf Exp $ + $Id: pa_request.h,v 1.89 2001/05/17 15:20:15 parser Exp $ */ #ifndef PA_REQUEST_H #define PA_REQUEST_H +#include "pa_config_includes.h" #include "pa_pool.h" #include "pa_hash.h" #include "pa_wcontext.h" @@ -23,6 +24,7 @@ #include "pa_vrequest.h" #include "pa_vresponse.h" #include "pa_vcookie.h" +#include "pa_sql_driver_manager.h" #ifndef NO_STRING_ORIGIN # define COMPILE_PARAMS \ @@ -42,6 +44,7 @@ #endif class Temp_lang; +class Methoded; /// Main workhorse. class Request : public Pooled { @@ -59,6 +62,7 @@ public: const char *content_type; size_t content_length; const char *cookie; + const char *user_agent; }; Request(Pool& apool, @@ -76,16 +80,18 @@ public: BEWARE: may throw exception to you: catch it! */ void core( - const char *sys_auto_path1, - const char *sys_auto_path2, + 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 - void execute(const Array& ops); + void execute(const Array& ops); // execute.C /// compiles the file, maybe forcing it's class @a name and @a base_class. 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, VStateless_class *base_class=0); // core.C /// compiles a @a source buffer @@ -101,7 +107,7 @@ public: /// appending, sure of clean string inside void write_no_lang(const String& astring) { - wcontext->write(astring, String::UL_NO); + wcontext->write(astring, String::UL_CLEAN); } /// appending string, passing language built into string being written void write_pass_lang(const String& astring) { @@ -117,39 +123,40 @@ public: } /// appending sure value, that would be converted to clean string void write_no_lang(Value& avalue) { - wcontext->write(avalue, String::UL_NO); + wcontext->write(avalue, String::UL_CLEAN); } /// appending sure value, not VString void write_expr_result(Value& avalue) { wcontext->write(avalue); } - /// handy is-value-a-junction ensurer - void fail_if_junction_(bool is, Value& value, - const String& method_name, const char *msg); - /// returns relative to @a path path to @a file - char *relative(const char *path, const char *file); + const String& relative(const char *apath, const String& relative_name); /// returns an absolute @a path to relative @a name - char *absolute(const char *name); + const String& absolute(const String& relative_name); + + /// returns the mime type of 'user_file_name_cstr' + const String& mime_type_of(const char *user_file_name_cstr); public: /// info from web server Info& info; + /// user's post data + char *post_data; size_t post_size; - /// default base - VClass ROOT; - /// $env:fields here + /// operators are methods of this class + Methoded& OP; + /// $env:fields VEnv env; - /// $form:elements here + /// $form:elements VForm form; - /// $request:elements here + /// $request:elements VRequest request; - /// $response: + /// $response:elements VResponse response; - /// $cookie: + /// $cookie:elements VCookie cookie; /// contexts @@ -157,14 +164,34 @@ public: /// contexts WContext *wcontext; + /// 'MAIN' class conglomerat + VStateless_class *main_class; + + /// connection + SQL_Connection *connection; + /// PCRE character tables + unsigned char *pcre_tables; + + /// classes configured data + Hash classes_conf; + + private: // core data - // classes + /// classes Hash fclasses; - // execution stack + /// already used files to avoid cyclic uses + Hash used_files; + + /// execution stack Stack stack; + /** endless execute(execute(... preventing counter + @see ANTI_ENDLESS_EXECUTE_RECOURSION + */ + uint anti_endless_execute_recoursion; + private: // compile.C VStateless_class& real_compile(COMPILE_PARAMS); @@ -185,7 +212,12 @@ private: // lang&raw private: // defaults 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 @@ -200,7 +232,7 @@ private: // lang manipulation private: - void output_result(const String& body_string, bool header_only); + void output_result(const VFile& body_file, bool header_only); }; /// Auto-object used for temporary changing Request::flang.