ssl opens a ciphered connection
+ linger cleanly close the connection instead of using a single RST.
+
Examples:
# check HTTP and HTTPs services on a server.
# first open port 80 thanks to server line port directive, then
# check both POP and IMAP from a single server:
option tcp-check
- tcp-check connect port 110
+ tcp-check connect port 110 linger
tcp-check expect string +OK\ POP3\ ready
tcp-check connect port 143
tcp-check expect string *\ OK\ IMAP4\ ready
#define TCPCHK_OPT_NONE 0x0000 /* no options specified, default */
#define TCPCHK_OPT_SEND_PROXY 0x0001 /* send proxy-protocol string */
#define TCPCHK_OPT_SSL 0x0002 /* SSL connection */
+#define TCPCHK_OPT_LINGER 0x0004 /* Do not RST connection, let it linger */
struct tcpcheck_rule {
struct list list; /* list linked to from the proxy */
cur_arg++;
}
#endif /* USE_OPENSSL */
+ else if (strcmp(args[cur_arg], "linger") == 0) {
+ tcpcheck->conn_opts |= TCPCHK_OPT_LINGER;
+ cur_arg++;
+ }
/* comment for this tcpcheck line */
else if (strcmp(args[cur_arg], "comment") == 0) {
if (!*args[cur_arg + 1]) {
}
else {
#ifdef USE_OPENSSL
- ha_alert("parsing [%s:%d] : '%s %s' expects 'comment', 'port', 'send-proxy' or 'ssl' but got '%s' as argument.\n",
+ ha_alert("parsing [%s:%d] : '%s %s' expects 'comment', 'port', 'send-proxy', 'ssl' or 'linger' but got '%s' as argument.\n",
#else /* USE_OPENSSL */
- ha_alert("parsing [%s:%d] : '%s %s' expects 'comment', 'port', 'send-proxy' or but got '%s' as argument.\n",
+ ha_alert("parsing [%s:%d] : '%s %s' expects 'comment', 'port', 'send-proxy' or 'linger' but got '%s' as argument.\n",
#endif /* USE_OPENSSL */
file, linenum, args[0], args[1], args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL;
ret = SF_ERR_RESOURCE;
}
+ if (conn_ctrl_ready(conn) &&
+ check->current_step->conn_opts & TCPCHK_OPT_LINGER) {
+ /* Some servers don't like reset on close */
+ fdtab[cs->conn->handle.fd].linger_risk = 0;
+ }
+
/* It can return one of :
* - SF_ERR_NONE if everything's OK
* - SF_ERR_SRVTO if there are no more servers