void srv_take(struct server *srv);
struct server *srv_drop(struct server *srv);
int srv_init_per_thr(struct server *srv);
+void srv_set_ssl(struct server *s, int use_ssl);
/* functions related to server name resolution */
int srv_prepare_for_resolution(struct server *srv, const char *hostname);
int ssl_sock_parse_alpn(char *arg, char **alpn_str, int *alpn_len, char **err);
void ssl_sock_set_alpn(struct connection *conn, const unsigned char *, int);
void ssl_sock_set_servername(struct connection *conn, const char *hostname);
-void ssl_sock_set_srv(struct server *s, signed char use_ssl);
int ssl_sock_get_cert_used_sess(struct connection *conn);
int ssl_sock_get_cert_used_conn(struct connection *conn);
#include <haproxy/resolvers.h>
#include <haproxy/sample.h>
#include <haproxy/server.h>
-#include <haproxy/ssl_sock.h>
#include <haproxy/stats.h>
#include <haproxy/stream.h>
#include <haproxy/stream_interface.h>
}
}
}
-#endif
+
+/* Activate ssl on server <s>.
+ * do nothing if there is no change to apply
+ *
+ * Must be called with the server lock held.
+ */
+void srv_set_ssl(struct server *s, int use_ssl)
+{
+ if (s->use_ssl == use_ssl)
+ return;
+
+ s->use_ssl = use_ssl;
+ if (s->use_ssl)
+ s->xprt = xprt_get(XPRT_SSL);
+ else
+ s->xprt = s->check.xprt = s->agent.xprt = xprt_get(XPRT_RAW);
+}
+
+#endif /* USE_OPENSSL */
/*
* Prepare <srv> for hostname resolution.
HA_SPIN_LOCK(SERVER_LOCK, &sv->lock);
if (strcmp(args[4], "on") == 0) {
- ssl_sock_set_srv(sv, 1);
+ srv_set_ssl(sv, 1);
} else if (strcmp(args[4], "off") == 0) {
- ssl_sock_set_srv(sv, 0);
+ srv_set_ssl(sv, 0);
} else {
HA_SPIN_UNLOCK(SERVER_LOCK, &sv->lock);
cli_err(appctx, "'set server <srv> ssl' expects 'on' or 'off'.\n");
#include <haproxy/proxy.h>
#include <haproxy/resolvers.h>
#include <haproxy/server.h>
-#include <haproxy/ssl_sock.h>
#include <haproxy/tools.h>
#include <haproxy/xxhash.h>
/* configure ssl if connection has been initiated at startup */
if (srv->ssl_ctx.ctx != NULL)
- ssl_sock_set_srv(srv, use_ssl);
+ srv_set_ssl(srv, use_ssl);
#endif
}
BIO_meth_free(ha_meth);
}
-/* Activate ssl on server <s>.
- * do nothing if there is no change to apply
- *
- * Must be called with the server lock held.
- */
-void ssl_sock_set_srv(struct server *s, signed char use_ssl)
-{
- if (s->use_ssl == use_ssl)
- return;
-
- s->use_ssl = use_ssl;
- if (s->use_ssl == 1)
- s->xprt = &ssl_sock;
- else
- s->xprt = s->check.xprt = s->agent.xprt = xprt_get(XPRT_RAW);
-}
/*
* Local variables: