From c70c892c2abd2cbd5836fe89b7cbce0bee5c57bc Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 8 Oct 2002 17:42:49 +0000 Subject: [PATCH] return error code on 407 proxy authenticate --- panda/src/downloader/downloader.cxx | 17 ++++++++++++++++- panda/src/express/error_utils.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/panda/src/downloader/downloader.cxx b/panda/src/downloader/downloader.cxx index 8be838f1b8..14ab9669ab 100644 --- a/panda/src/downloader/downloader.cxx +++ b/panda/src/downloader/downloader.cxx @@ -779,8 +779,10 @@ parse_http_response(const string &resp) { downloader_cat.debug() << "Downloader::parse_http_response() - got a 302 redirect" << endl; - return EU_http_redirect; + return EU_error_abort; break; + case 407: + return EU_error_http_proxy_authentication; case 408: return EU_error_http_server_timeout; case 503: @@ -821,6 +823,7 @@ parse_header(DownloadStatus *status) { string bufstr((char *)status->_start, status->_bytes_in_buffer); size_t p = 0; bool redirect = false; + bool authenticate = false; while (p < bufstr.length()) { // Server sends out CR LF (\r\n) as newline delimiter size_t nl = bufstr.find("\015\012", p); @@ -849,6 +852,9 @@ parse_header(DownloadStatus *status) { << "Downloader::parse_header() - Header is valid: " << component << endl; status->_header_is_valid = true; + } else if (parse_ret == EU_error_http_proxy_authentication) { + authenticate = true; + status->_header_is_valid = true; } else if (parse_ret == EU_http_redirect) { redirect = true; status->_header_is_valid = true; @@ -896,6 +902,12 @@ parse_header(DownloadStatus *status) { return EU_error_abort; } + } else if (authenticate && tline == "Proxy-Authenticate") { + // We don't presently support authentication-demanding proxies. + downloader_cat.warning() + << tline << "\n"; + return EU_error_http_proxy_authentication; + } else if (redirect == true && tline == "Location") { tline = component.substr(cpos + 1, string::npos); downloader_cat.error() @@ -912,6 +924,9 @@ parse_header(DownloadStatus *status) { << "Location directive" << endl; return EU_error_abort; } + if (authenticate) { + return EU_error_http_proxy_authentication; + } if (downloader_cat.is_spam()) downloader_cat.spam() << "Downloader::parse_header() - Header is complete" << endl; diff --git a/panda/src/express/error_utils.h b/panda/src/express/error_utils.h index 2c012d7468..6c840a8137 100644 --- a/panda/src/express/error_utils.h +++ b/panda/src/express/error_utils.h @@ -73,6 +73,7 @@ enum ErrorUtilCode { EU_error_http_server_timeout = -70, EU_error_http_gateway_timeout = -71, EU_error_http_service_unavailable = -72, + EU_error_http_proxy_authentication = -73, // Zlib errors EU_error_zlib = -80,