Update proxy 504/502 error codes responses

This commit is contained in:
2023-07-07 22:23:15 +02:00
parent d6b315c91c
commit 9ec1c1c3a2

View File

@ -315,10 +315,10 @@ static int proxy_connect(proxy_ctx_t *proxy, host_config_t *conf, http_res *res,
int fd;
if ((fd = sock_connect(conf->proxy.hostname, conf->proxy.port, SERVER_TIMEOUT_INIT, addr_buf, sizeof(addr_buf))) == -1) {
if (errno == ETIMEDOUT || errno == EINPROGRESS) {
if (errno == ETIMEDOUT || errno == EINPROGRESS || errno == EHOSTDOWN || errno == EHOSTUNREACH || errno == ECONNREFUSED) {
res->status = http_get_status(504);
ctx->origin = SERVER_REQ;
} else if (errno == ECONNREFUSED) {
} else if (errno == ECONNABORTED || errno == ECONNRESET) {
res->status = http_get_status(502);
ctx->origin = SERVER_REQ;
} else {