mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MINOR: connection: check EINTR when sending a PROXY header
PROXY protocol header was not tolerant to signals, so it might cause a connection to report an error if a signal comes in at the exact same moment the send is done. This is 1.5-specific and does not need any backport.
This commit is contained in:
parent
f12a20ebce
commit
7fe45698f5
@ -563,6 +563,7 @@ int conn_local_send_proxy(struct connection *conn, unsigned int flag)
|
|||||||
/* we have to send the whole trash. If the data layer has a
|
/* we have to send the whole trash. If the data layer has a
|
||||||
* pending write, we'll also set MSG_MORE.
|
* pending write, we'll also set MSG_MORE.
|
||||||
*/
|
*/
|
||||||
|
do {
|
||||||
ret = send(conn->t.sock.fd, trash.str, trash.len, (conn->flags & CO_FL_DATA_WR_ENA) ? MSG_MORE : 0);
|
ret = send(conn->t.sock.fd, trash.str, trash.len, (conn->flags & CO_FL_DATA_WR_ENA) ? MSG_MORE : 0);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
@ -571,8 +572,11 @@ int conn_local_send_proxy(struct connection *conn, unsigned int flag)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EAGAIN || errno == ENOTCONN)
|
if (errno == EAGAIN || errno == ENOTCONN)
|
||||||
goto out_wait;
|
goto out_wait;
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
goto out_error;
|
goto out_error;
|
||||||
}
|
}
|
||||||
|
} while (0);
|
||||||
|
|
||||||
if (ret != trash.len)
|
if (ret != trash.len)
|
||||||
goto out_error;
|
goto out_error;
|
||||||
|
@ -442,7 +442,7 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
|
|||||||
* connection, in which case the connection is validated only once
|
* connection, in which case the connection is validated only once
|
||||||
* we've sent the whole proxy line. Otherwise we use connect().
|
* we've sent the whole proxy line. Otherwise we use connect().
|
||||||
*/
|
*/
|
||||||
if (si->send_proxy_ofs) {
|
while (si->send_proxy_ofs) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* The target server expects a PROXY line to be sent first.
|
/* The target server expects a PROXY line to be sent first.
|
||||||
@ -470,6 +470,8 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EAGAIN || errno == ENOTCONN)
|
if (errno == EAGAIN || errno == ENOTCONN)
|
||||||
goto out_wait;
|
goto out_wait;
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
goto out_error;
|
goto out_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,6 +480,7 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
|
|||||||
goto out_wait;
|
goto out_wait;
|
||||||
|
|
||||||
/* OK we've sent the whole line, we're connected */
|
/* OK we've sent the whole line, we're connected */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The connection is ready now, simply return and let the connection
|
/* The connection is ready now, simply return and let the connection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user