|
|
| version 1.106, 2001/10/24 10:49:47 | version 1.115, 2001/12/15 21:28:19 |
|---|---|
| Line 2 | Line 2 |
| Parser: request class decl. | 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://paf.design.ru) |
| $Id$ | $Id$ |
| */ | */ |
| Line 10 | Line 10 |
| #ifndef PA_REQUEST_H | #ifndef PA_REQUEST_H |
| #define PA_REQUEST_H | #define PA_REQUEST_H |
| #include "pa_config_includes.h" | |
| #include "pa_pool.h" | #include "pa_pool.h" |
| #include "pa_hash.h" | #include "pa_hash.h" |
| #include "pa_wcontext.h" | #include "pa_wcontext.h" |
| Line 19 | Line 18 |
| #include "pa_vclass.h" | #include "pa_vclass.h" |
| #include "pa_vobject.h" | #include "pa_vobject.h" |
| #include "pa_venv.h" | #include "pa_venv.h" |
| #include "pa_vstatus.h" | |
| #include "pa_vform.h" | #include "pa_vform.h" |
| #include "pa_vmath.h" | #include "pa_vmath.h" |
| #include "pa_vrequest.h" | #include "pa_vrequest.h" |
| Line 26 | Line 26 |
| #include "pa_vcookie.h" | #include "pa_vcookie.h" |
| #include "pa_sql_driver_manager.h" | #include "pa_sql_driver_manager.h" |
| #ifdef RESOURCES_DEBUG | |
| #include <sys/resource.h> | |
| #endif | |
| #ifndef NO_STRING_ORIGIN | #ifndef NO_STRING_ORIGIN |
| # define COMPILE_PARAMS \ | # define COMPILE_PARAMS \ |
| const char *source, \ | const char *source, \ |
| Line 48 class Methoded; | Line 52 class Methoded; |
| /// Main workhorse. | /// Main workhorse. |
| class Request : public Pooled { | class Request : public Pooled { |
| friend Temp_lang; | friend class Temp_lang; |
| public: | public: |
| #ifdef RESOURCES_DEBUG | |
| /// measures | |
| double sql_connect_time; | |
| double sql_request_time; | |
| #endif | |
| /// some information from web server | /// some information from web server |
| class Info { | class Info { |
| public: | public: |
| Line 67 public: | Line 77 public: |
| Request(Pool& apool, | Request(Pool& apool, |
| Info& ainfo, | Info& ainfo, |
| String::Untaint_lang adefault_lang ///< all tainted data default untainting lang | uchar adefault_lang, ///< all tainted data default untainting lang |
| bool status_allowed ///< status class allowed | |
| ); | ); |
| ~Request() {} | ~Request() {} |
| Line 108 public: | Line 119 public: |
| /// appending, sure of clean string inside | /// appending, sure of clean string inside |
| void write_no_lang(const String& astring) { | void write_no_lang(const String& astring) { |
| wcontext->write(astring, String::UL_CLEAN); | wcontext->write(astring, |
| String::UL_CLEAN | flang&String::UL_OPTIMIZE_BIT); | |
| } | } |
| /// appending string, passing language built into string being written | /// appending string, passing language built into string being written |
| void write_pass_lang(const String& astring) { | void write_pass_lang(const String& astring) { |
| Line 128 public: | Line 140 public: |
| } | } |
| /// 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::UL_CLEAN); | wcontext->write(avalue, |
| String::UL_CLEAN | flang&String::UL_OPTIMIZE_BIT); | |
| } | } |
| /// appending sure value, not VString | /// appending sure value, not VString |
| void write_expr_result(Value& avalue) { | void write_expr_result(Value& avalue) { |
| Line 144 public: | Line 157 public: |
| /// returns the mime type of 'user_file_name_cstr' | /// returns the mime type of 'user_file_name_cstr' |
| const String& mime_type_of(const char *user_file_name_cstr); | const String& mime_type_of(const char *user_file_name_cstr); |
| /// PCRE character tables | |
| const unsigned char *pcre_tables(); | |
| public: | public: |
| /// info from web server | /// info from web server |
| Line 158 public: | Line 168 public: |
| Methoded& OP; | Methoded& OP; |
| /// $env:fields | /// $env:fields |
| VEnv env; | VEnv env; |
| /// $status:fields | |
| VStatus status; | |
| /// $form:elements | /// $form:elements |
| VForm form; | VForm form; |
| /// $math:constants | /// $math:constants |
| Line 199 private: // core data | Line 211 private: // core data |
| */ | */ |
| uint anti_endless_execute_recoursion; | uint anti_endless_execute_recoursion; |
| /// charset->pcre_tables | |
| Hash CTYPE; | |
| /// stack trace | /// stack trace |
| Stack trace; | Stack trace; |
| Line 222 private: // execute.C | Line 231 private: // execute.C |
| private: // lang&raw | private: // lang&raw |
| String::Untaint_lang flang; | uchar flang; |
| private: // defaults | private: // defaults |
| const String::Untaint_lang fdefault_lang; | const uchar fdefault_lang; |
| Value *default_content_type; | Value *default_content_type; |
| private: // mime types | private: // mime types |
| Line 236 private: // mime types | Line 245 private: // mime types |
| private: // lang manipulation | private: // lang manipulation |
| String::Untaint_lang set_lang(String::Untaint_lang alang) { | uchar set_lang(uchar alang) { |
| String::Untaint_lang result=flang; | uchar result=flang; |
| flang=alang; | flang=alang; |
| return result; | return result; |
| } | } |
| void restore_lang(String::Untaint_lang alang) { | void restore_lang(uchar alang) { |
| flang=alang; | flang=alang; |
| } | } |
| Line 253 private: | Line 262 private: |
| /// Auto-object used for temporary changing Request::flang. | /// Auto-object used for temporary changing Request::flang. |
| class Temp_lang { | class Temp_lang { |
| Request& frequest; | Request& frequest; |
| String::Untaint_lang saved_lang; | uchar saved_lang; |
| public: | public: |
| Temp_lang(Request& arequest, String::Untaint_lang alang) : | Temp_lang(Request& arequest, uchar alang) : |
| frequest(arequest), | frequest(arequest), |
| saved_lang(arequest.set_lang(alang)) { | saved_lang(arequest.set_lang(alang)) { |
| } | } |