--- parser3/src/main/pa_request.C 2025/05/25 20:55:23 1.433 +++ parser3/src/main/pa_request.C 2026/09/18 20:08:37 1.441 @@ -1,12 +1,13 @@ /** @file Parser: request class main part. @see compile.C and execute.C. - Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ #include "pa_sapi.h" #include "pa_common.h" +#include "pa_dir.h" #include "pa_os.h" #include "pa_request.h" #include "pa_wwrapper.h" @@ -35,7 +36,7 @@ #include "pa_vdate.h" #include "pa_varray.h" -volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.433 2025/05/25 20:55:23 moko Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; +volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.441 2026/09/18 20:08:37 moko Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; // consts @@ -175,8 +176,8 @@ Request::Request(SAPI_Info& asapi_info, pa_register_thread_request(*this); // file_no=0 => unknown - file_list+="UNKNOWN"; - file_list+="-body of process-"; // pseudo_file_no__process + file_list+=String::Body("UNKNOWN"); + file_list+=String::Body("-body of process-"); // pseudo_file_no__process // maybe expire old caches cache_managers->maybe_expire(); @@ -250,12 +251,11 @@ VStateless_class& Request::get_class_ref } bool Request::add_class(const char* atype, VStateless_class *aclass){ - if(!allow_class_replace){ - if(!classes().put_dont_replace(atype, aclass)) - return true; - if(strcmp(atype, VARRAY_TYPE)) - return false; - } + if(!classes().put_dont_replace(String::Body(atype), aclass)) + return true; + if(!allow_class_replace && strcmp(atype, VARRAY_TYPE)) + return false; + classes().remove(String::Body(atype)); classes().put(atype, aclass); return true; } @@ -463,9 +463,6 @@ void Request::configure() { if(!configure_admin_done) configure_admin(main_class); - // configure not-admin=user options - methoded_array().configure_user(*this); - // $MAIN:MIME-TYPES if(Value* element=main_class.get_element(mime_types_name)) if(Table *table=element->get_table()) @@ -699,7 +696,7 @@ void Request::use_buf(VStateless_class& ArrayClass& cclasses=compile(&aclass, source, main_alias, file_no, line_no_offset); VString* vfilespec= - new VString(*new String(file_list[file_no], String::L_TAINTED)); + new VString(file_list[file_no]); for(size_t i=0; i= '0' && *p <= '9'){ const char *n=p; while(*p>='0' && *p<='9') p++; - r.start = pa_atoul(pa_strdup(n, p-n)); + r.start = pa_atoul(pa_strdup(n, p-n)); // ((uint64_t)-1) is treated as UNSET } while(*p==' ' || *p=='\t') p++; @@ -819,7 +812,7 @@ static void parse_range(const String* s, if(*p >= '0' && *p <= '9'){ const char *n=p; while(*p>='0' && *p<='9') p++; - r.end = pa_atoul(pa_strdup(n, p-n)); + r.end = pa_atoul(pa_strdup(n, p-n)); // ((uint64_t)-1) is treated as UNSET } while(*p==' ' || *p=='\t') p++; @@ -877,6 +870,8 @@ static void output_pieces(Request& r, bo return SAPI::send_error(r.sapi_info, "", "416"); if(rg.start == UNSET && rg.end != UNSET){ + if(rg.end == 0) + return SAPI::send_error(r.sapi_info, "", "416"); if(rg.end > content_length) rg.end = content_length; rg.start = content_length - rg.end; @@ -1054,18 +1049,18 @@ Request::Exception_details Request::get_ // $.source if(problem_source) - hash.put(exception_source_part_name, new VString(*new String(*problem_source, String::L_TAINTED))); + hash.put(exception_source_part_name, new VString(*problem_source)); // $.file $.lineno $.colno if(origin.file_no){ - hash.put("file", new VString(*new String(file_list[origin.file_no], String::L_TAINTED))); - hash.put("lineno", new VInt(1+origin.line)); - hash.put("colno", new VInt(1+origin.col)); + HASH_PUT_CSTR(hash, "file", new VString(file_list[origin.file_no])); + HASH_PUT_CSTR(hash, "lineno", new VInt(1+origin.line)); + HASH_PUT_CSTR(hash, "colno", new VInt(1+origin.col)); } // $.comment if(const char* comment=e.comment(true)) - hash.put(exception_comment_part_name, new VString(*new String(comment, String::L_TAINTED))); + hash.put(exception_comment_part_name, new VString(comment)); // $.handled(0) hash.put(exception_handled_part_name, &VBool::get(false));