--- parser3/src/include/pa_request.h 2001/10/22 08:27:44 1.105 +++ parser3/src/include/pa_request.h 2001/12/15 21:28:19 1.115 @@ -2,15 +2,14 @@ Parser: request class decl. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + Author: Alexander Petrosyan (http://paf.design.ru) - $Id: pa_request.h,v 1.105 2001/10/22 08:27:44 parser Exp $ + $Id: pa_request.h,v 1.115 2001/12/15 21:28:19 paf 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" @@ -19,6 +18,7 @@ #include "pa_vclass.h" #include "pa_vobject.h" #include "pa_venv.h" +#include "pa_vstatus.h" #include "pa_vform.h" #include "pa_vmath.h" #include "pa_vrequest.h" @@ -26,6 +26,10 @@ #include "pa_vcookie.h" #include "pa_sql_driver_manager.h" +#ifdef RESOURCES_DEBUG +#include +#endif + #ifndef NO_STRING_ORIGIN # define COMPILE_PARAMS \ const char *source, \ @@ -48,9 +52,15 @@ class Methoded; /// Main workhorse. class Request : public Pooled { - friend Temp_lang; + friend class Temp_lang; public: +#ifdef RESOURCES_DEBUG + /// measures + double sql_connect_time; + double sql_request_time; +#endif + /// some information from web server class Info { public: @@ -67,7 +77,8 @@ public: Request(Pool& apool, 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() {} @@ -108,7 +119,8 @@ public: /// appending, sure of clean string inside 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 void write_pass_lang(const String& astring) { @@ -118,13 +130,18 @@ public: void write_assign_lang(Value& avalue) { wcontext->write(avalue, flang); } + /// appending string, assigning untaint language + void write_assign_lang(const String& astring) { + wcontext->write(astring, flang); + } /// appending possible string, passing language built into string being written void write_pass_lang(Value& avalue) { wcontext->write(avalue, String::UL_PASS_APPENDED); } /// appending sure value, that would be converted to clean string 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 void write_expr_result(Value& avalue) { @@ -140,9 +157,6 @@ public: /// returns the mime type of 'user_file_name_cstr' const String& mime_type_of(const char *user_file_name_cstr); - /// PCRE character tables - const unsigned char *pcre_tables(); - public: /// info from web server @@ -154,6 +168,8 @@ public: Methoded& OP; /// $env:fields VEnv env; + /// $status:fields + VStatus status; /// $form:elements VForm form; /// $math:constants @@ -195,9 +211,6 @@ private: // core data */ uint anti_endless_execute_recoursion; - /// charset->pcre_tables - Hash CTYPE; - /// stack trace Stack trace; @@ -218,11 +231,11 @@ private: // execute.C private: // lang&raw - String::Untaint_lang flang; + uchar flang; private: // defaults - const String::Untaint_lang fdefault_lang; + const uchar fdefault_lang; Value *default_content_type; private: // mime types @@ -232,12 +245,12 @@ private: // mime types private: // lang manipulation - String::Untaint_lang set_lang(String::Untaint_lang alang) { - String::Untaint_lang result=flang; + uchar set_lang(uchar alang) { + uchar result=flang; flang=alang; return result; } - void restore_lang(String::Untaint_lang alang) { + void restore_lang(uchar alang) { flang=alang; } @@ -249,9 +262,9 @@ private: /// Auto-object used for temporary changing Request::flang. class Temp_lang { Request& frequest; - String::Untaint_lang saved_lang; + uchar saved_lang; public: - Temp_lang(Request& arequest, String::Untaint_lang alang) : + Temp_lang(Request& arequest, uchar alang) : frequest(arequest), saved_lang(arequest.set_lang(alang)) { }