Annotation of parser3/src/types/pa_vrequest.C, revision 1.24
1.2 paf 1: /** @file
1.5 paf 2: Parser: @b request class.
1.2 paf 3:
1.17 paf 4: Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.16 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.18 paf 6: */
1.2 paf 7:
1.24 ! paf 8: static const char* IDENT_VREQUEST_C="$Date: 2002/08/14 14:18:31 $";
1.1 paf 9:
10: #include "pa_vrequest.h"
11: #include "pa_request.h"
1.13 paf 12: #include "pa_charsets.h"
13: #include "pa_charset.h"
1.1 paf 14:
1.7 parser 15: // request: CLASS,method,field
1.24 ! paf 16: Value *VRequest::get_element(const String& aname, Value * /*aself*/, bool /*looking_up*/) {
1.12 paf 17: // $charset
1.24 ! paf 18: if(aname==CHARSET_NAME)
1.13 paf 19: return NEW VString(pool().get_source_charset().name());
1.12 paf 20: else {
1.24 ! paf 21: // $query $uri $body
! 22: const char *cstr;
! 23: if(aname=="query")
1.12 paf 24: cstr=frequest.info.query_string;
1.24 ! paf 25: else if(aname=="uri")
1.12 paf 26: cstr=frequest.info.uri;
1.24 ! paf 27: else
! 28: bark("%s field not found", 0, &aname);
1.12 paf 29:
30: String& string=*NEW String(pool());
31: string.APPEND_TAINTED(cstr?cstr:"", 0, "request", 0);
32: return NEW VString(string);
33: }
1.1 paf 34: }
35:
1.20 paf 36: bool VRequest::put_element(const String& aname, Value *avalue, bool replace) {
1.12 paf 37: // guard charset change
1.20 paf 38: if(aname==CHARSET_NAME) {
39: pool().set_source_charset(charsets->get_charset(avalue->as_string()));
40: return true;
41: } else
42: return Value::put_element(aname, avalue, replace);
1.12 paf 43: }
E-mail: