--- parser3/src/main/pa_http.C 2020/10/14 11:24:46 1.93 +++ parser3/src/main/pa_http.C 2020/10/14 21:22:59 1.96 @@ -14,7 +14,7 @@ #include "pa_vfile.h" #include "pa_random.h" -volatile const char * IDENT_PA_HTTP_C="$Id: pa_http.C,v 1.93 2020/10/14 11:24:46 moko Exp $" IDENT_PA_HTTP_H; +volatile const char * IDENT_PA_HTTP_C="$Id: pa_http.C,v 1.96 2020/10/14 21:22:59 moko Exp $" IDENT_PA_HTTP_H; #ifdef _MSC_VER #include @@ -59,7 +59,7 @@ bool HTTP_Headers::add_header(const char content_type=header.value; if(header.name == String::Body("CONTENT-LENGTH") && content_length==0) - content_length=pa_atoul(header.value.cstr(), 10); + ALTER_EXCEPTION_COMMENT(content_length=pa_atoul(header.value.cstr()), " for content-length"); headers+=header; @@ -153,7 +153,7 @@ public: return status_line; const char *result_str=pa_strdup(status_start, status_end-status_start); - result=pa_atoui(result_str, 10); + ALTER_EXCEPTION_COMMENT(result=pa_atoui(result_str), " for HTTP status"); return result_str; } @@ -227,7 +227,7 @@ int HTTP_response::read_response(int soc parse_headers(); - size_t content_length=check_file_size(headers.content_length, url); + size_t content_length=check_file_size(headers.content_length, &url); if(content_length>0 && (content_length + body_offset) > length){ resize(content_length + body_offset + 0x400*64); } @@ -867,7 +867,8 @@ File_read_http_result pa_internal_file_r HTTP_response response(connect_string); // sending request - int status_code=http_request(response, idna_host, port, request, request_size, timeout_secs, fail_on_status_ne_200); + int status_code; + ALTER_EXCEPTION_SOURCE(status_code=http_request(response, idna_host, port, request, request_size, timeout_secs, fail_on_status_ne_200), &connect_string); // processing results char* raw_body=response.buf + response.body_offset; @@ -1110,7 +1111,7 @@ int HTTPD_Server::bind(const char *host_ port = host_port; } - if(!set_addr(&me, host, pa_atoui(port, 10))){ + if(!set_addr(&me, host, pa_atoui(port))){ if (host) throw Exception("httpd.bind", 0, "can not resolve hostname \"%s\"", host); me.sin_addr.s_addr=INADDR_ANY;