--- parser3/src/include/pa_common.h 2010/05/17 22:54:58 1.142 +++ parser3/src/include/pa_common.h 2012/05/24 12:53:06 1.147 @@ -1,14 +1,14 @@ /** @file Parser: commonly used functions. - Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_COMMON_H #define PA_COMMON_H -static const char * const IDENT_COMMON_H="$Date: 2010/05/17 22:54:58 $"; +#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.147 2012/05/24 12:53:06 misha Exp $" #include "pa_string.h" #include "pa_hash.h" @@ -41,6 +41,8 @@ class Request; #define CONTENT_DISPOSITION_INLINE "inline" #define CONTENT_DISPOSITION_FILENAME_NAME "filename" +#define BASE64_STRICT_OPTION_NAME "strict" + const String http_content_type(HTTP_CONTENT_TYPE); const String content_transfer_encoding_name(CONTENT_TRANSFER_ENCODING_NAME); @@ -274,9 +276,17 @@ int getMonthDays(int year, int month); int remove_crlf(char *start, char *end); +inline bool pa_isalpha(unsigned char c) { + return (((c>='A') && (c<='Z')) || ((c>='a') && (c<='z'))); +} + +inline bool pa_isalnum(unsigned char c) { + return (((c>='0') && (c<='9')) || pa_isalpha(c)); +} + void check_safe_mode(struct stat finfo, const String& file_spec, const char* fname); -void pa_base64_decode(const char *in, size_t in_size, char*& result, size_t& result_size); +void pa_base64_decode(const char *in, size_t in_size, char*& result, size_t& result_size, bool strict=false); char* pa_base64_encode(const char *in, size_t in_size); struct File_base64_action_info { unsigned char** base64; @@ -376,7 +386,6 @@ static String::C date_gmt_string(tm* tms tms->tm_hour,tms->tm_min,tms->tm_sec)); } - // globals extern const String file_status_name;