--- parser3/src/main/pa_request.C 2025/05/26 01:56:54 1.435 +++ 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.435 2025/05/26 01:56:54 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 @@ -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(String::Body(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()) @@ -725,18 +722,14 @@ const String& Request::relative(const ch } const String& Request::full_disk_path(const String& relative_name) { + if(is_os_absolute_path(relative_name)) + return relative_name; if(relative_name.first_char()=='/') { String& result=*new String(pa_strdup(request_info.document_root)); result << relative_name; return result; } - if(relative_name.starts_with("http://") || relative_name.starts_with("parser://") -#ifdef WIN32 - || relative_name.pos(":")==1 // DRIVE: - || relative_name.starts_with("\\\\") // UNC1 - || relative_name.starts_with("//") // UNC2 -#endif - ) + if(relative_name.starts_with("http://") || relative_name.starts_with("parser://")) return relative_name; return relative(request_info.path_translated ? request_info.path_translated : request_info.document_root, relative_name); @@ -807,7 +800,7 @@ static void parse_range(const String* s, if(*p >= '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;