--- parser3/src/include/pa_request.h 2001/03/13 16:38:22 1.48 +++ parser3/src/include/pa_request.h 2001/03/16 09:26:42 1.55 @@ -3,7 +3,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_request.h,v 1.48 2001/03/13 16:38:22 paf Exp $ + $Id: pa_request.h,v 1.55 2001/03/16 09:26:42 paf Exp $ */ #ifndef PA_REQUEST_H @@ -19,17 +19,6 @@ #include "pa_venv.h" #include "pa_vform.h" -#define UNNAMED_NAME "unnamed" - -#define MAIN_METHOD_NAME "main" -#define AUTO_METHOD_NAME "auto" - -#define ROOT_CLASS_NAME "ROOT" -#define MAIN_CLASS_NAME "MAIN" -#define TABLE_CLASS_NAME "table" -#define ENV_CLASS_NAME "env" -#define FORM_CLASS_NAME "form" - #ifndef NO_STRING_ORIGIN # define COMPILE_PARAMS \ const char *source, \ @@ -53,14 +42,29 @@ class Request : public Pooled { friend Temp_lang; public: - Request(Pool& apool); + struct Info { + const char *document_root; + const char *path_translated; + const char *request_method; + const char *query_string; + const char *request_uri; + const char *content_type; + size_t content_length; + }; + + Request(Pool& apool, + Info& ainfo, + String::Untaint_lang alang + ); ~Request() {} // global classes Hash& classes() { return fclasses; } // core request processing - void core(); + char *core( + const char *sys_auto_path1, + const char *sys_auto_path2); void execute(const Array& ops); @@ -77,18 +81,30 @@ public: const String *name=0, bool intercept_string=true); // execute.C + // write(const) = clean void write(const String& astring) { - wcontext->write(astring, String::Untaint_lang::NO); // write(const) = clean + wcontext->write(astring, String::Untaint_lang::NO); } - + // appending, sure of clean string inside + void write_no_lang(String& astring) { + wcontext->write(astring, String::Untaint_lang::NO); + } + // appending possible string, assigning untaint language void write_assign_lang(Value& avalue) { - // appending possible string, assigning untaint language wcontext->write(avalue, flang); } + // appending possible string, passing language built into string being written void write_pass_lang(Value& avalue) { - // appending possible string, passing language built into string being written wcontext->write(avalue, String::Untaint_lang::PASS_APPENDED); } + // appending sure value, that would be converted to clean string + void write_no_lang(Value& avalue) { + wcontext->write(avalue, String::Untaint_lang::NO); + } + // appending sure value, not VString + void write_expr_result(Value& avalue) { + wcontext->write(avalue); + } void fail_if_junction_(bool is, Value& value, const String& method_name, char *msg); @@ -97,6 +113,9 @@ public: public: + // + Info& info; + // default base VClass root_class; // $env:fields here @@ -122,8 +141,8 @@ private: // compile.C private: // execute.C - char *execute_method(Value& aself, const Method& method, bool return_cstr); - char *execute_method(Value& aself, const String& method_name, bool return_cstr); + char *execute_method(Value& aself, const Method& method, bool return_cstr=true); + char *execute_method(Value& aself, const String& method_name, bool return_cstr=true); Value *get_element(); @@ -142,11 +161,6 @@ private: // lang manipulation flang=alang; } -private: // web - - const char *document_root; - const char *page_filespec; - }; class Temp_lang {