commit d7ed711f28717554c22cdd8efc620524268760a0
parent 05ca154290d4cde25b629122f0ba36d43442ed62
Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 7 Jun 2020 22:39:58 +0200
Add some help for TLS clients, in case we only serve plaintext.
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/main.c b/main.c
@@ -777,7 +777,23 @@ main(int argc, char *argv[])
if (tls_handshake(tlsclientctx) < 0)
return 1;
}
-#endif /* ENABLE_TLS */
+#else /* ENABLE_TLS */
+ /*
+ * Some TLS request. Help them determine we only
+ * serve plaintext.
+ */
+ if (byte0 == 0x16) {
+ if (loglvl & CONN) {
+ logentry(clienth, clientp, "-",
+ "disconnected");
+ }
+
+ shutdown(sock, SHUT_RDWR);
+ close(sock);
+
+ return 1;
+ }
+#endif
maxrecv = sizeof(recvb) - 1;
do {