--- parser3/src/classes/xdoc.C 2007/08/20 10:37:21 1.156 +++ parser3/src/classes/xdoc.C 2009/07/07 05:47:43 1.163 @@ -1,7 +1,7 @@ /** @file Parser: @b xdoc parser class. - Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -9,7 +9,7 @@ #ifdef XML -static const char * const IDENT_XDOC_C="$Date: 2007/08/20 10:37:21 $"; +static const char * const IDENT_XDOC_C="$Date: 2009/07/07 05:47:43 $"; #include "libxml/tree.h" #include "libxml/HTMLtree.h" @@ -42,7 +42,7 @@ static const char * const IDENT_XDOC_C=" class MXdoc: public MXnode { public: // VStateless_class - Value* create_new_value(Pool&, HashStringValue&) { return new VXdoc(); } + Value* create_new_value(Pool&, HashStringValue*) { return new VXdoc(); } public: MXdoc(); @@ -391,8 +391,9 @@ static void _create(Request& r, MethodPa Temp_lang temp_lang(r, String::L_XML); const String& xml=r.process_to_string(param); - const char* cstr=xml.cstr(String::L_UNSPECIFIED, 0, &r.charsets); - xmldoc=xmlParseMemory(cstr, strlen(cstr)); + String::Body sbody=xml.cstr_to_string_body_untaint(r.flang, 0, &r.charsets); + xmldoc=xmlParseMemory(sbody.cstr(), sbody.length()); + //printf("document=0x%p\n", document); if(!xmldoc || xmlHaveGenericErrors()) throw XmlException(0); @@ -424,7 +425,7 @@ static void _create(Request& r, MethodPa set_encoding=true; // must be last action in if, see after if} } else { - VFile* vfile=param.as_vfile(String::L_UNSPECIFIED); + VFile* vfile=param.as_vfile(String::L_AS_IS); xmldoc=xmlParseMemory(vfile->value_ptr(), vfile->value_size()); if(!xmldoc || xmlHaveGenericErrors()) throw XmlException(0); @@ -457,11 +458,11 @@ static void _load(Request& r, MethodPara const String* uri=¶ms.as_string(0, "URI must be string"); const char* uri_cstr; if(uri->pos("://")==STRING_NOT_FOUND) // disk path - uri_cstr=r.absolute(*uri).cstr(String::L_FILE_SPEC); + uri_cstr=r.absolute(*uri).taint_cstr(String::L_FILE_SPEC); else // xxx:// - uri_cstr=uri->cstr(String::L_AS_IS); // leave as-is for xmlParseFile to handle + uri_cstr=uri->taint_cstr(String::L_AS_IS); // leave as-is for xmlParseFile to handle - /// todo!! add SAFE MODE!! + /// @todo!! add SAFE MODE!! xmlDoc* xmldoc=xmlParseFile(uri_cstr); if(!xmldoc || xmlHaveGenericErrors()) throw XmlException(uri); @@ -647,7 +648,7 @@ static void _file(Request& r, MethodPara oo, 0/*not to file, to memory*/); // write out result - r.write_no_lang(String(buf.str, buf.length)); + r.write_no_lang(String(buf.str)); // write out result VFile& vfile=*new VFile; @@ -683,7 +684,7 @@ static void _string(Request& r, MethodPa 0/*not to file, to memory*/, true/*use source charset to render, client charset to put to header*/); // write out result - r.write_no_lang(String(String::Body(buf.str), String::L_AS_IS)); + r.write_no_lang(String(buf.str, String::L_AS_IS)); } #ifndef DOXYGEN