--- parser3/src/include/pa_request.h 2002/10/14 15:22:41 1.154 +++ parser3/src/include/pa_request.h 2003/01/28 15:16:49 1.160.2.2 @@ -1,14 +1,14 @@ /** @file Parser: request class decl. - Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_REQUEST_H #define PA_REQUEST_H -static const char* IDENT_REQUEST_H="$Date: 2002/10/14 15:22:41 $"; +static const char* IDENT_REQUEST_H="$Date: 2003/01/28 15:16:49 $"; #include "pa_pool.h" #include "pa_hash.h" @@ -60,8 +60,11 @@ class Request : public Pooled { friend class Temp_lang; friend class Temp_connection; friend class Request_context_saver; + friend class Temp_request_self; public: + Pool& pool() { return fpool; } + #ifdef RESOURCES_DEBUG /// measures double sql_connect_time; @@ -82,7 +85,7 @@ public: bool mail_received; }; - Request(Pool& apool, + Request( Info& ainfo, uchar adefault_lang, ///< all tainted data default untainting lang bool status_allowed ///< status class allowed @@ -215,6 +218,9 @@ public: bool origins_mode(); + void interrupt() { finterrupted=true; } + bool interrupted() { return finterrupted; } + public: /// info from web server @@ -222,6 +228,9 @@ public: /// user's post data const char *post_data; size_t post_size; + /// source, client, mail charsets + Request_charsets charsets; + /// name of 'main' method const String main_method_name; @@ -249,13 +258,14 @@ public: private: + Pool fpool; + //@{ request processing status /// exception stack trace Stack exception_trace; /// execution stack Stack stack; /// contexts - Value *self; VMethodFrame *method_frame; Value *rcontext; WContext *wcontext; @@ -264,11 +274,13 @@ private: /// current connection SQL_Connection *fconnection; //@} + /// interrupted flag, raised on signals [SIGPIPE] + bool finterrupted; public: // status read methods - Value *get_self() { return self; } VMethodFrame *get_method_frame() { return method_frame; } + Value *get_self(); private: // core data @@ -310,8 +322,7 @@ private: // execute.C /// for @main[] const String *execute_virtual_method(Value& aself, const String& method_name); - Value *get_element(const String *& remember_name, - bool can_call_operator, bool should_explode_junction=false/*there's only one place when true*/); + Value *get_element(const String *& remember_name, bool can_call_operator); private: // defaults @@ -347,7 +358,7 @@ private: // connection manipulation private: - void output_result(const VFile& body_file, bool header_only); + void output_result(const VFile& body_file, bool header_only, bool as_attachment); }; /// Auto-object used to save request context across ^try body @@ -359,7 +370,6 @@ class Request_context_saver { /// execution stack int stack; /// contexts - Value *self; VMethodFrame *method_frame; Value *rcontext; WContext *wcontext; @@ -372,7 +382,6 @@ public: Request_context_saver(Request& ar) : exception_trace(ar.exception_trace.top_index()), stack(ar.stack.top_index()), - self(ar.self), method_frame(ar.method_frame), rcontext(ar.rcontext), wcontext(ar.wcontext), @@ -382,7 +391,7 @@ public: void restore() { fr.exception_trace.top_index(exception_trace); fr.stack.top_index(stack); - fr.self=self; fr.method_frame=method_frame, fr.rcontext=rcontext; fr.wcontext=wcontext; + fr.method_frame=method_frame, fr.rcontext=rcontext; fr.wcontext=wcontext; fr.flang=flang; fr.fconnection=fconnection; }