Annotation of parser3/src/types/pa_vrequest.C, revision 1.27.2.9.2.2

1.2       paf         1: /** @file
1.5       paf         2:        Parser: @b request class.
1.2       paf         3: 
1.27.2.5  paf         4:        Copyright(c) 2001-2003 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.27.2.9.2.2! paf         8: static const char* IDENT_VREQUEST_C="$Date: 2003/03/18 15:14:22 $";
1.1       paf         9: 
                     10: #include "pa_vrequest.h"
1.27.2.1  paf        11: #include "pa_request_info.h"
1.27.2.6  paf        12: #include "pa_request_charsets.h"
1.13      paf        13: #include "pa_charsets.h"
1.27.2.1  paf        14: #include "pa_vstring.h"
1.1       paf        15: 
1.7       parser     16: // request: CLASS,method,field
1.27.2.9.2.2! paf        17: Value* VRequest::get_element(const String& aname, Value&  /*aself*/, bool /*looking_up*/) {
1.12      paf        18:        // $charset
1.27.2.9.2.2! paf        19:        if(aname==CHARSET_NAME)
        !            20:                return Value*(new VString(fcharsets.source().name()));
1.12      paf        21:        else {  
1.24      paf        22:                // $query $uri $body
1.27.2.5  paf        23:                const char* buf;
1.25      paf        24:                size_t size=0;
1.27.2.9.2.2! paf        25:                if(aname=="query")
1.27.2.1  paf        26:                        buf=finfo.query_string;
1.27.2.9.2.2! paf        27:                else if(aname=="uri")
1.27.2.1  paf        28:                        buf=finfo.uri;
1.27.2.9.2.2! paf        29:                else if(aname=="body") {
1.27.2.1  paf        30:                        buf=finfo.post_data;
                     31:                        size=finfo.post_size;
1.25      paf        32:                } else
1.27.2.1  paf        33:                        bark("%s field not found", 0, aname);
1.12      paf        34: 
1.27.2.9.2.1  paf        35:                const String& string(new String);
1.27.2.1  paf        36:                string->APPEND_TAINTED(buf?buf:"", size, "request", 0);
1.27.2.9.2.2! paf        37:                return Value*(new VString(string));
1.12      paf        38:        }
1.1       paf        39: }
                     40: 
1.27.2.9.2.2! paf        41: bool VRequest::put_element(const String& aname, Value* avalue, bool replace) {
1.12      paf        42:        // guard charset change
1.27.2.9.2.2! paf        43:        if(aname==CHARSET_NAME) {
1.27.2.3  paf        44:                fcharsets.set_source(charsets.get(avalue->as_string(0)));
1.20      paf        45:                return true;
                     46:        } else
                     47:                return Value::put_element(aname, avalue, replace);
1.12      paf        48: }

E-mail: