--- parser3/src/main/pa_common.C 2003/02/03 15:57:44 1.143.2.12 +++ parser3/src/main/pa_common.C 2003/02/04 15:59:05 1.143.2.15 @@ -5,15 +5,14 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_COMMON_C="$Date: 2003/02/03 15:57:44 $"; +static const char* IDENT_COMMON_C="$Date: 2003/02/04 15:59:05 $"; -//#include "pa_value_includes.h" #include "pa_common.h" #include "pa_exception.h" -#include "pa_value_includes.h" #include "pa_hash.h" #include "pa_vstring.h" #include "pa_vint.h" +#include "pa_globals.h" #ifdef CYGWIN #define _GNU_H_WINDOWS32_SOCKETS @@ -94,8 +93,27 @@ static int unlock(int fd) { FLOCK(F_TLOC #endif #endif +// defines for statics + +#define HTTP_METHOD_NAME "method" +#define HTTP_TIMEOUT_NAME "timeout" +#define HTTP_HEADERS_NAME "headers" +#define HTTP_ANY_STATUS_NAME "any-status" +#define FILE_STATUS_NAME "status" + +// statics + +static StringPtr http_method_name(new String(HTTP_METHOD_NAME)); +static StringPtr http_timeout_name(new String(HTTP_TIMEOUT_NAME)); +static StringPtr http_headers_name(new String(HTTP_HEADERS_NAME)); +static StringPtr http_any_status_name(new String(HTTP_ANY_STATUS_NAME)); +static StringPtr file_status_name(new String(FILE_STATUS_NAME)); + +// defines + #define DEFAULT_USER_AGENT "parser3" +// functions void fix_line_breaks(char* buf, size_t& size) { if(size==0) @@ -162,7 +180,7 @@ static int http_read_response(Pool& pool response.APPEND_TAINTED(buf, size, "remote HTTP server response", 0); if(!result && (EOLat=response.pos("\r\n", 2))>=0) { // checking status in first response StringPtr status_line=response.mid(0, (size_t)EOLat); - Array astatus; + ArrayString astatus; status_line->split(astatus, 0, " ", 1); StringPtr status_code=astatus.get(1); result=status_code->as_int(); @@ -369,7 +387,7 @@ static HashStringValuePtr file_read_http StringPtr header_block=response.mid(0, pos); StringPtr body=response.mid(pos+4, response.size()); - Array aheaders; + ArrayString aheaders; HashStringValuePtr headers(new HashStringValue); header_block->split(aheaders, 0, "\r\n", 2);