Hopefully bugfix
This commit is contained in:
@ -16,6 +16,8 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client
|
|||||||
char * err_msg) {
|
char * err_msg) {
|
||||||
char buffer[CHUNK_SIZE];
|
char buffer[CHUNK_SIZE];
|
||||||
long ret;
|
long ret;
|
||||||
|
int new = 0;
|
||||||
|
int retry = 0;
|
||||||
|
|
||||||
if (rev_proxy.socket != 0 && rev_proxy_host == conf->name) {
|
if (rev_proxy.socket != 0 && rev_proxy_host == conf->name) {
|
||||||
goto rev_proxy;
|
goto rev_proxy;
|
||||||
@ -23,6 +25,10 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client
|
|||||||
sock_close(&rev_proxy);
|
sock_close(&rev_proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retry:
|
||||||
|
retry = 0;
|
||||||
|
new = 1;
|
||||||
|
|
||||||
rev_proxy.socket = socket(AF_INET6, SOCK_STREAM, 0);
|
rev_proxy.socket = socket(AF_INET6, SOCK_STREAM, 0);
|
||||||
if (rev_proxy.socket < 0) {
|
if (rev_proxy.socket < 0) {
|
||||||
print(ERR_STR "Unable to create socket: %s" CLR_STR, strerror(errno));
|
print(ERR_STR "Unable to create socket: %s" CLR_STR, strerror(errno));
|
||||||
@ -97,6 +103,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client
|
|||||||
res->status = http_get_status(502);
|
res->status = http_get_status(502);
|
||||||
print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
||||||
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
|
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
|
||||||
|
retry = !new;
|
||||||
goto proxy_err;
|
goto proxy_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +120,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client
|
|||||||
res->status = http_get_status(502);
|
res->status = http_get_status(502);
|
||||||
print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
||||||
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
|
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
|
||||||
|
retry = !new;
|
||||||
goto proxy_err;
|
goto proxy_err;
|
||||||
}
|
}
|
||||||
content_len -= len;
|
content_len -= len;
|
||||||
@ -123,6 +131,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client
|
|||||||
res->status = http_get_status(502);
|
res->status = http_get_status(502);
|
||||||
print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
||||||
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
|
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
|
||||||
|
retry = !new;
|
||||||
goto proxy_err;
|
goto proxy_err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,6 +142,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client
|
|||||||
res->status = http_get_status(502);
|
res->status = http_get_status(502);
|
||||||
print(ERR_STR "Unable to receive response from server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
print(ERR_STR "Unable to receive response from server: %s" CLR_STR, sock_strerror(&rev_proxy));
|
||||||
sprintf(err_msg, "Unable to receive response from server: %s.", sock_strerror(&rev_proxy));
|
sprintf(err_msg, "Unable to receive response from server: %s.", sock_strerror(&rev_proxy));
|
||||||
|
retry = !new;
|
||||||
goto proxy_err;
|
goto proxy_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,6 +215,9 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client
|
|||||||
proxy_err:
|
proxy_err:
|
||||||
print(BLUE_STR "Closing proxy connection" CLR_STR);
|
print(BLUE_STR "Closing proxy connection" CLR_STR);
|
||||||
sock_close(&rev_proxy);
|
sock_close(&rev_proxy);
|
||||||
|
if (retry) {
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user