--- parser3/src/main/pa_common.C 2003/01/23 17:05:34 1.143.2.1 +++ parser3/src/main/pa_common.C 2003/01/24 08:19:09 1.143.2.2 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_COMMON_C="$Date: 2003/01/23 17:05:34 $"; +static const char* IDENT_COMMON_C="$Date: 2003/01/24 08:19:09 $"; #include "pa_common.h" #include "pa_exception.h" @@ -140,7 +140,7 @@ static bool set_addr(struct sockaddr_in } static int http_read_response(Pool& pool, String& response, int sock, bool fail_on_status_ne_200){ - const String* status_code=0; + int result=0; ssize_t EOLat=0; while(true) { char *buf=(char *)pool.malloc(MAX_STRING); @@ -148,11 +148,11 @@ static int http_read_response(Pool& pool if(size<=0) break; response.APPEND_TAINTED(buf, size, "remote HTTP server response", 0); - if(!status_code && (EOLat=response.pos("\r\n", 2))>=0) { // checking status in first response + if(!result && (EOLat=response.pos("\r\n", 2))>=0) { // checking status in first response const String& status_line=response.mid(0, (size_t)EOLat); Array astatus(response.pool()); size_t pos_after_ref=0; status_line.split(astatus, &pos_after_ref, " ", 1); - status_code=astatus.get_string(1); + result=astatus.get_string(1)->as_int(); if(fail_on_status_ne_200 && *status_code!="200") throw Exception("http.status", @@ -160,8 +160,8 @@ static int http_read_response(Pool& pool "invalid HTTP response status"); } } - if(status_code) - return status_code->as_int(); + if(result) + return result; else throw Exception("http.response", 0,