11diff --git a/configure.ac b/configure.ac
2- index b8643aae..79dec3a5 100644
2+ index 7429f614..191d4b6a 100644
33--- a/configure.ac
44+++ b/configure.ac
5- @@ -1036 ,6 +1036 ,12 @@ AC_FUNC_MMAP
5+ @@ -1074 ,6 +1074 ,12 @@ AC_FUNC_MMAP
66 AC_CHECK_FUNCS([\
77 strlcpy getuid fmemopen])
88
@@ -43,7 +43,7 @@ index 838f28b5..760539fb 100644
4343+ $(LIB_SELECT) $(LIB_SETLOCALE) $(LIB_SETLOCALE_NULL) $(LTLIBICONV) $(LTLIBINTL) $(SERVENT_LIB) @INTL_MACOSX_LIBS@ $(LD_ADD_ADDL) \
4444 $(LIBS)
4545diff --git a/libwget/io.c b/libwget/io.c
46- index 8973b428..8fbda567 100644
46+ index 4d178c09..7a56672f 100644
4747--- a/libwget/io.c
4848+++ b/libwget/io.c
4949@@ -233,6 +233,10 @@ int wget_ready_2_transfer(int fd, int timeout, int mode)
@@ -58,7 +58,7 @@ index 8973b428..8fbda567 100644
5858 pollfd.fd = fd;
5959
6060diff --git a/libwget/ssl_wolfssl.c b/libwget/ssl_wolfssl.c
61- index cd7743be..87874480 100644
61+ index a057295b..d7c03f0c 100644
6262--- a/libwget/ssl_wolfssl.c
6363+++ b/libwget/ssl_wolfssl.c
6464@@ -135,6 +135,12 @@ struct session_context {
@@ -74,7 +74,31 @@ index cd7743be..87874480 100644
7474 #define error_printf_check(...) if (config.report_invalid_cert) wget_error_printf(__VA_ARGS__)
7575
7676 /**
77- @@ -870,7 +876,7 @@ static void ShowX509Chain(WOLFSSL_X509_CHAIN *chain, int count, const char *hdr)
77+ @@ -594,10 +600,9 @@ void wget_ssl_init(void)
78+
79+ debug_printf("WolfSSL init\n");
80+ wolfSSL_Init();
81+ + #ifndef NO_OLD_TLS
82+
83+ - if (!wget_strcasecmp_ascii(config.secure_protocol, "SSLv2")) {
84+ - method = SSLv2_client_method();
85+ - } else if (!wget_strcasecmp_ascii(config.secure_protocol, "SSLv3")) {
86+ + if (!wget_strcasecmp_ascii(config.secure_protocol, "SSLv3") || !wget_strcasecmp_ascii(config.secure_protocol, "SSL")) {
87+ method = wolfSSLv23_client_method();
88+ min_version = WOLFSSL_SSLV3;
89+ } else if (!wget_strcasecmp_ascii(config.secure_protocol, "TLSv1")) {
90+ @@ -606,7 +611,9 @@ void wget_ssl_init(void)
91+ } else if (!wget_strcasecmp_ascii(config.secure_protocol, "TLSv1_1")) {
92+ method = wolfSSLv23_client_method();
93+ min_version = WOLFSSL_TLSV1_1;
94+ - } else if (!wget_strcasecmp_ascii(config.secure_protocol, "TLSv1_2")) {
95+ + } else
96+ + #endif // ! NO_OLD_TLS
97+ + if (!wget_strcasecmp_ascii(config.secure_protocol, "TLSv1_2")) {
98+ method = wolfSSLv23_client_method();
99+ min_version = WOLFSSL_TLSV1_2;
100+ } else if (!wget_strcasecmp_ascii(config.secure_protocol, "TLSv1_3")) {
101+ @@ -899,7 +906,7 @@ static void ShowX509Chain(WOLFSSL_X509_CHAIN *chain, int count, const char *hdr)
78102 */
79103 int wget_ssl_open(wget_tcp *tcp)
80104 {
@@ -83,7 +107,7 @@ index cd7743be..87874480 100644
83107 wget_tls_stats_data stats = {
84108 .alpn_protocol = NULL,
85109 .version = -1,
86- @@ -896 ,14 +902 ,14 @@ int wget_ssl_open(wget_tcp *tcp)
110+ @@ -925 ,14 +932 ,14 @@ int wget_ssl_open(wget_tcp *tcp)
87111 sockfd= tcp->sockfd;
88112 connect_timeout = tcp->connect_timeout;
89113
@@ -100,7 +124,7 @@ index cd7743be..87874480 100644
100124
101125 // if (tcp->tls_false_start)
102126 // info_printf(_("WolfSSL doesn't support TLS False Start\n"));
103- @@ -915 ,7 +921 ,7 @@ int wget_ssl_open(wget_tcp *tcp)
127+ @@ -944 ,7 +951 ,7 @@ int wget_ssl_open(wget_tcp *tcp)
104128 // wolfSSL_UseALPN() destroys the ALPN string (bad design pattern !)
105129 alpn = wget_strmemcpy_a(alpnbuf, sizeof(alpnbuf), config.alpn, strlen(config.alpn));
106130
@@ -109,7 +133,7 @@ index cd7743be..87874480 100644
109133 debug_printf("ALPN offering %s\n", config.alpn);
110134 } else
111135 debug_printf("WolfSSL: Failed to set ALPN: %s\n", config.alpn);
112- @@ -927 ,17 +933 ,20 @@ int wget_ssl_open(wget_tcp *tcp)
136+ @@ -956 ,17 +963 ,20 @@ int wget_ssl_open(wget_tcp *tcp)
113137 // struct session_context *ctx = wget_calloc(1, sizeof(struct session_context));
114138 // ctx->hostname = wget_strdup(hostname);
115139
@@ -134,7 +158,7 @@ index cd7743be..87874480 100644
134158
135159 if (tls_stats_callback) {
136160 long long after_millisecs = wget_get_timemillis();
137- @@ -949 ,29 +958 ,29 @@ int wget_ssl_open(wget_tcp *tcp)
161+ @@ -978 ,29 +988 ,29 @@ int wget_ssl_open(wget_tcp *tcp)
138162 const char *name;
139163 int bits;
140164 WOLFSSL_CIPHER *cipher;
@@ -173,7 +197,7 @@ index cd7743be..87874480 100644
173197 debug_printf("WolfSSL: Failed to connect ALPN\n");
174198 else {
175199 debug_printf("WolfSSL: Server accepted ALPN protocol '%.*s'\n", (int) protocol_length, protocol);
176- @@ -986 ,16 +995 ,16 @@ int wget_ssl_open(wget_tcp *tcp)
200+ @@ -1015 ,16 +1025 ,16 @@ int wget_ssl_open(wget_tcp *tcp)
177201 }
178202
179203 if (ret == WGET_E_SUCCESS) {
@@ -193,7 +217,7 @@ index cd7743be..87874480 100644
193217 if (!strcmp(tlsver, "TLSv1.2"))
194218 stats.version = 4;
195219 else if (!strcmp(tlsver, "TLSv1.3"))
196- @@ -1029 ,11 +1038 ,11 @@ int wget_ssl_open(wget_tcp *tcp)
220+ @@ -1058 ,11 +1068 ,11 @@ int wget_ssl_open(wget_tcp *tcp)
197221 */ }
198222 }
199223
@@ -208,7 +232,7 @@ index cd7743be..87874480 100644
208232 if (res >= 13 && res <= 29)
209233 return WGET_E_CERTIFICATE;
210234 else
211- @@ -1053 ,7 +1062 ,9 @@ int wget_ssl_open(wget_tcp *tcp)
235+ @@ -1082 ,7 +1092 ,9 @@ int wget_ssl_open(wget_tcp *tcp)
212236 debug_printf("Handshake timed out\n");
213237 // xfree(ctx->hostname);
214238 // xfree(ctx);
@@ -219,7 +243,7 @@ index cd7743be..87874480 100644
219243 tcp->ssl_session = NULL;
220244 }
221245
222- @@ -1071 ,18 +1082 ,20 @@ int wget_ssl_open(wget_tcp *tcp)
246+ @@ -1100 ,18 +1112 ,20 @@ int wget_ssl_open(wget_tcp *tcp)
223247 void wget_ssl_close(void **session)
224248 {
225249 if (session && *session) {
@@ -244,7 +268,7 @@ index cd7743be..87874480 100644
244268 *session = NULL;
245269 }
246270 }
247- @@ -1110 ,14 +1123 ,16 @@ void wget_ssl_close(void **session)
271+ @@ -1139 ,14 +1153 ,16 @@ void wget_ssl_close(void **session)
248272 */
249273 ssize_t wget_ssl_read_timeout(void *session, char *buf, size_t count, int timeout)
250274 {
@@ -267,7 +291,7 @@ index cd7743be..87874480 100644
267291 break;
268292 } else
269293 break;
270- @@ -1183 ,14 +1198 ,15 @@ ssize_t wget_ssl_read_timeout(void *session, char *buf, size_t count, int timeou
294+ @@ -1212 ,14 +1228 ,15 @@ ssize_t wget_ssl_read_timeout(void *session, char *buf, size_t count, int timeou
271295 */
272296 ssize_t wget_ssl_write_timeout(void *session, const char *buf, size_t count, int timeout)
273297 {
0 commit comments