Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
#include "../IPAllow.h"
#include "I_Machine.h"

namespace
{
char const Dns_error_body[] = "connect#dns_failed";
}

// Support ip_resolve override.
const MgmtConverter HttpTransact::HOST_RES_CONV{[](const void *data) -> std::string_view {
const HostResData *host_res_data = static_cast<const HostResData *>(data);
Expand Down Expand Up @@ -1899,7 +1904,7 @@ HttpTransact::ReDNSRoundRobin(State *s)
} else {
// Our ReDNS failed so output the DNS failure error message
// Set to internal server error so later logging will pick up SQUID_LOG_ERR_DNS_FAIL
build_error_response(s, HTTP_STATUS_INTERNAL_SERVER_ERROR, "Cannot find server.", "connect#dns_failed");
build_error_response(s, HTTP_STATUS_INTERNAL_SERVER_ERROR, "Cannot find server.", Dns_error_body);
s->cache_info.action = CACHE_DO_NO_ACTION;
s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
// s->next_action = PROXY_INTERNAL_CACHE_NOOP;
Expand Down Expand Up @@ -8144,7 +8149,11 @@ HttpTransact::build_error_response(State *s, HTTPStatus status_code, const char
SET_VIA_STRING(VIA_ERROR_TYPE, VIA_ERROR_SERVER);
break;
case HTTP_STATUS_INTERNAL_SERVER_ERROR:
SET_VIA_STRING(VIA_ERROR_TYPE, VIA_ERROR_DNS_FAILURE);
if (Dns_error_body == error_body_type) {
SET_VIA_STRING(VIA_ERROR_TYPE, VIA_ERROR_DNS_FAILURE);
} else {
SET_VIA_STRING(VIA_ERROR_TYPE, VIA_ERROR_UNKNOWN);
}
break;
case HTTP_STATUS_MOVED_TEMPORARILY:
SET_VIA_STRING(VIA_ERROR_TYPE, VIA_ERROR_MOVED_TEMPORARILY);
Expand Down
1 change: 1 addition & 0 deletions proxy/http/HttpTransact.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ enum ViaString_t {
VIA_ERROR_CACHE_READ = 'R',
VIA_ERROR_MOVED_TEMPORARILY = 'M',
VIA_ERROR_LOOP_DETECTED = 'L',
VIA_ERROR_UNKNOWN = ' ',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank space value for this come from traffic_via:

viaTable->viaData[static_cast<unsigned char>(' ')] = "unknown";

//
// Now the detailed stuff
//
Expand Down
4 changes: 4 additions & 0 deletions proxy/http/HttpTransactHeaders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@ HttpTransactHeaders::generate_and_set_squid_codes(HTTPHdr *header, char *via_str
log_code = SQUID_LOG_ERR_LOOP_DETECTED;
hier_code = SQUID_HIER_NONE;
break;
case VIA_ERROR_UNKNOWN:
log_code = SQUID_LOG_ERR_UNKNOWN;
hier_code = SQUID_HIER_NONE;
break;
default:
break;
}
Expand Down