|
version 1.160.2.10, 2003/01/31 14:03:53
|
version 1.160.2.33, 2003/03/08 16:41:30
|
|
Line 18 static const char* IDENT_REQUEST_H="$Dat
|
Line 18 static const char* IDENT_REQUEST_H="$Dat
|
| #include "pa_stack.h" |
#include "pa_stack.h" |
| #include "pa_vclass.h" |
#include "pa_vclass.h" |
| #include "pa_vobject.h" |
#include "pa_vobject.h" |
| #include "pa_venv.h" |
|
| #include "pa_vstatus.h" |
|
| #include "pa_vform.h" |
|
| #include "pa_vmail.h" |
|
| #include "pa_vmath.h" |
|
| #include "pa_vrequest.h" |
|
| #include "pa_vresponse.h" |
|
| #include "pa_vcookie.h" |
|
| #include "pa_request_info.h" |
#include "pa_request_info.h" |
| #include "pa_request_charsets.h" |
#include "pa_request_charsets.h" |
| #include "pa_sapi.h" |
#include "pa_sapi.h" |
|
Line 58 const uint ANTI_ENDLESS_EXECUTE_RECOURSI
|
Line 50 const uint ANTI_ENDLESS_EXECUTE_RECOURSI
|
| class Temp_lang; |
class Temp_lang; |
| class Methoded; |
class Methoded; |
| class VMethodFrame; |
class VMethodFrame; |
| |
class GdomeDOMString_auto_ptr; |
| |
class VMail; DECLARE_OBJECT_PTR(VMail); |
| |
class VForm; DECLARE_OBJECT_PTR(VForm); |
| |
class VResponse; DECLARE_OBJECT_PTR(VResponse); |
| |
class VCookie; DECLARE_OBJECT_PTR(VCookie); |
| |
|
| /// Main workhorse. |
/// Main workhorse. |
| class Request: public PA_Object { |
class Request: public PA_Object { |
|
Line 67 class Request: public PA_Object {
|
Line 64 class Request: public PA_Object {
|
| friend class Temp_request_self; |
friend class Temp_request_self; |
| |
|
| /// all files and classes and other hard-to-place allocations go to this pool |
/// all files and classes and other hard-to-place allocations go to this pool |
| Pool fpool; |
Pool& fpool; |
| |
|
| ///@{ core data |
///@{ core data |
| |
|
|
Line 85 class Request: public PA_Object {
|
Line 82 class Request: public PA_Object {
|
| ///@} |
///@} |
| |
|
| public: |
public: |
| |
|
| |
class StackItem { |
| |
public: |
| |
StringPtr string(Pool& pool) const { return value->get_string(&pool); } |
| |
ValuePtr value; |
| |
ArrayOperationPtr ops; |
| |
void *ptr; |
| |
|
| |
/// needed to fill unused Array entries |
| |
StackItem() {} |
| |
StackItem(ValuePtr avalue): value(avalue) {} |
| |
StackItem(ArrayOperationPtr aops): ops(aops) {} |
| |
StackItem(void *aptr): ptr(aptr) {} |
| |
}; |
| |
|
| //@{ request processing status |
//@{ request processing status |
| /// exception stack trace |
/// exception stack trace |
| Stack<StringPtr> exception_trace; |
Stack<StringPtr> exception_trace; |
| /// execution stack |
/// execution stack |
| Stack<void *> stack; |
Stack<StackItem> stack; |
| /// contexts |
/// contexts |
| VMethodFrame *method_frame; |
VMethodFrame *method_frame; |
| Value *rcontext; |
Value *rcontext; |
| WContext *wcontext; |
WContext *wcontext; |
| /// current language |
/// current language |
| uchar flang; |
String_UL flang; |
| /// current connection |
/// current connection |
| SQL_Connection *fconnection; |
SQL_Connection *fconnection; |
| //@} |
//@} |
|
Line 113 public:
|
Line 125 public:
|
| double sql_request_time; |
double sql_request_time; |
| #endif |
#endif |
| |
|
| Request(SAPI_Info& asapi_info, Request_info& arequest_info, |
Request(Pool& apool, SAPI_Info& asapi_info, Request_info& arequest_info, |
| uchar adefault_lang, ///< all tainted data default untainting lang |
String_UL adefault_lang, ///< all tainted data default untainting lang |
| bool status_allowed ///< status class allowed |
bool status_allowed ///< status class allowed |
| ); |
); |
| ~Request(); |
~Request(); |
|
Line 133 public:
|
Line 145 public:
|
| bool header_only); |
bool header_only); |
| |
|
| /// executes ops |
/// executes ops |
| void execute(const Array& ops); // execute.C |
void execute(ArrayOperation& ops); // execute.C |
| /// execute ops with anti-recoursion check |
/// execute ops with anti-recoursion check |
| void recoursion_checked_execute(StringPtr name, const Array& ops) { |
void recoursion_checked_execute(StringPtr name, ArrayOperation& ops) { |
| // anti_endless_execute_recoursion |
// anti_endless_execute_recoursion |
| if(++anti_endless_execute_recoursion==ANTI_ENDLESS_EXECUTE_RECOURSION) { |
if(++anti_endless_execute_recoursion==ANTI_ENDLESS_EXECUTE_RECOURSION) { |
| anti_endless_execute_recoursion=0; // give @exception a chance |
anti_endless_execute_recoursion=0; // give @exception a chance |
|
Line 260 public:
|
Line 272 public:
|
| |
|
| /// 'MAIN' class conglomerat & operators are methods of this class |
/// 'MAIN' class conglomerat & operators are methods of this class |
| VStateless_classPtr main_class; |
VStateless_classPtr main_class; |
| /// $env:fields |
|
| //VEnv env; |
|
| /// $status:fields |
|
| //VStatus status; |
|
| /// $form:elements |
/// $form:elements |
| VFormPtr form; |
VFormPtr form; |
| /// $mail |
/// $mail |
| VMailPtr mail; |
VMailPtr mail; |
| /// $math:constants |
|
| //VMath math; |
|
| /// $request:elements |
|
| //VRequest request; |
|
| /// $response:elements |
/// $response:elements |
| VResponsePtr response; |
VResponsePtr response; |
| /// $cookie:elements |
/// $cookie:elements |
| VCookiePtr cookie; |
VCookiePtr cookie; |
| |
|
| /// classes configured data |
/// classes configured data |
| HashStringValue classes_conf; |
HashStringObject classes_conf; |
| |
|
| public: // status read methods |
public: // status read methods |
| |
|
| VMethodFrame *get_method_frame() { return method_frame; } |
VMethodFrame *get_method_frame() { return method_frame; } |
| Value *get_self(); |
ValuePtr get_self(); |
| |
#define GET_SELF(request, type) (*static_cast<type *>(request.get_self().get())) |
| |
/* for strange reason call to this: |
| |
r.get_self<VHash>() |
| |
refuses to compile |
| |
|
| |
template<typename T> T& get_self() { |
| |
return *static_cast<T*>(get_self().get()); |
| |
} |
| |
*/ |
| |
|
| |
#ifdef XML |
| |
public: // charset helpers |
| |
|
| |
/// @see Charset::transcode |
| |
GdomeDOMString_auto_ptr transcode(StringPtr s); |
| |
/// @see Charset::transcode |
| |
StringPtr transcode(GdomeDOMString* s |
| |
#ifndef NO_STRING_ORIGIN |
| |
, StringPtr origin |
| |
#endif |
| |
); |
| |
/// @see Charset::transcode |
| |
StringPtr transcode(xmlChar* s |
| |
#ifndef NO_STRING_ORIGIN |
| |
, StringPtr origin |
| |
#endif |
| |
); |
| |
|
| |
#endif |
| |
|
| private: |
private: |
| |
|
|
Line 301 private: // execute.C
|
Line 334 private: // execute.C
|
| /// for @postprocess[body] |
/// for @postprocess[body] |
| StringPtr execute_method(VMethodFrame& amethodFrame, const Method& method); |
StringPtr execute_method(VMethodFrame& amethodFrame, const Method& method); |
| //{ for @conf[filespec] and @auto[filespec] |
//{ for @conf[filespec] and @auto[filespec] |
| StringPtr execute_method(Value& aself, |
StringPtr execute_method(ValuePtr aself, |
| const Method& method, VStringPtr optional_param, |
const Method& method, VStringPtr optional_param, |
| bool do_return_string); |
bool do_return_string); |
| StringPtr execute_nonvirtual_method(VStateless_class& aclass, |
struct Execute_nonvirtual_method_result { |
| |
StringPtr string; |
| |
MethodPtr method; |
| |
}; |
| |
Execute_nonvirtual_method_result execute_nonvirtual_method(VStateless_class& aclass, |
| StringPtr method_name, VStringPtr optional_param, |
StringPtr method_name, VStringPtr optional_param, |
| bool do_return_string, |
bool do_return_string); |
| const Method **return_method=0); |
|
| //} |
//} |
| /// for @main[] |
/// for @main[] |
| StringPtr execute_virtual_method(Value& aself, StringPtr method_name); |
StringPtr execute_virtual_method(ValuePtr aself, StringPtr method_name); |
| |
|
| Value *get_element(StringPtr & remember_name, bool can_call_operator); |
ValuePtr get_element(StringPtr& remember_name, bool can_call_operator); |
| |
|
| private: // defaults |
private: // defaults |
| |
|
| const uchar fdefault_lang; |
const String_UL fdefault_lang; |
| Value *default_content_type; |
|
| |
|
| private: // mime types |
private: // mime types |
| |
|
|
Line 326 private: // mime types
|
Line 361 private: // mime types
|
| |
|
| private: // lang manipulation |
private: // lang manipulation |
| |
|
| uchar set_lang(uchar alang) { |
String_UL set_lang(String_UL alang) { |
| uchar result=flang; |
String_UL result=flang; |
| flang=alang; |
flang=alang; |
| return result; |
return result; |
| } |
} |
| void restore_lang(uchar alang) { |
void restore_lang(String_UL alang) { |
| flang=alang; |
flang=alang; |
| } |
} |
| |
|
|
Line 348 private: // connection manipulation
|
Line 383 private: // connection manipulation
|
| |
|
| private: |
private: |
| |
|
| void output_result(const VFile& body_file, bool header_only, bool as_attachment); |
void output_result(VFilePtr body_file, bool header_only, bool as_attachment); |
| }; |
}; |
| |
|
| /// Auto-object used to save request context across ^try body |
/// Auto-object used to save request context across ^try body |
|
Line 364 class Request_context_saver {
|
Line 399 class Request_context_saver {
|
| Value *rcontext; |
Value *rcontext; |
| WContext *wcontext; |
WContext *wcontext; |
| /// current language |
/// current language |
| uchar flang; |
String_UL flang; |
| /// current connection |
/// current connection |
| SQL_Connection *fconnection; |
SQL_Connection *fconnection; |
| |
|
|
Line 390 public:
|
Line 425 public:
|
| /// 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; |
| uchar saved_lang; |
String_UL saved_lang; |
| public: |
public: |
| Temp_lang(Request& arequest, uchar alang) : |
Temp_lang(Request& arequest, String_UL alang) : |
| frequest(arequest), |
frequest(arequest), |
| saved_lang(arequest.set_lang(alang)) { |
saved_lang(arequest.set_lang(alang)) { |
| } |
} |
|
Line 415 public:
|
Line 450 public:
|
| } |
} |
| }; |
}; |
| |
|
| |
|
| |
// defines for externs |
| |
|
| |
#define CONTENT_DISPOSITION_NAME "content-disposition" |
| |
#define CONTENT_DISPOSITION_VALUE "attachment" |
| |
#define CONTENT_DISPOSITION_FILENAME_NAME "filename" |
| |
|
| // externs |
// externs |
| |
|
| extern StringPtr main_method_name; |
extern StringPtr main_method_name; |
| |
extern StringPtr auto_method_name; |
| |
extern StringPtr body_name; |
| |
extern StringPtr content_disposition_name; |
| |
extern StringPtr content_disposition_value; |
| |
extern StringPtr content_disposition_filename_name; |
| |
|
| |
// defines for statics |
| |
|
| |
#define MAIN_CLASS_NAME "MAIN" |
| |
#define AUTO_FILE_NAME "auto.p" |
| |
|
| #endif |
#endif |