mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 18:34:41 +08:00
Fix #1803 - conditional for SSL_set1_host(). In unit test, disable time.windows.com, use google and apple SNTP servers
This commit is contained in:
parent
2e14d125ba
commit
17ada1c894
@ -5325,11 +5325,13 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||||
|
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||||
if (opts->srvname.len > 0) {
|
if (opts->srvname.len > 0) {
|
||||||
char *s = mg_mprintf("%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
char *s = mg_mprintf("%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||||
SSL_set1_host(tls->ssl, s);
|
SSL_set1_host(tls->ssl, s);
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
c->tls = tls;
|
c->tls = tls;
|
||||||
c->is_tls = 1;
|
c->is_tls = 1;
|
||||||
c->is_tls_hs = 1;
|
c->is_tls_hs = 1;
|
||||||
|
@ -90,11 +90,13 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||||
|
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||||
if (opts->srvname.len > 0) {
|
if (opts->srvname.len > 0) {
|
||||||
char *s = mg_mprintf("%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
char *s = mg_mprintf("%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||||
SSL_set1_host(tls->ssl, s);
|
SSL_set1_host(tls->ssl, s);
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
c->tls = tls;
|
c->tls = tls;
|
||||||
c->is_tls = 1;
|
c->is_tls = 1;
|
||||||
c->is_tls_hs = 1;
|
c->is_tls_hs = 1;
|
||||||
|
@ -331,11 +331,11 @@ static void test_sntp(void) {
|
|||||||
|
|
||||||
ASSERT(mg_sntp_parse(bad, sizeof(bad)) < 0);
|
ASSERT(mg_sntp_parse(bad, sizeof(bad)) < 0);
|
||||||
ASSERT(mg_sntp_parse(NULL, 0) == -1);
|
ASSERT(mg_sntp_parse(NULL, 0) == -1);
|
||||||
test_sntp_server("udp://time.windows.com:123");
|
// test_sntp_server("udp://time.windows.com:123");
|
||||||
// NOTE(cpq): temporarily disabled until Github Actions fix their NTP
|
// NOTE(cpq): temporarily disabled until Github Actions fix their NTP
|
||||||
// port blockage issue, https://github.com/actions/runner-images/issues/5615
|
// port blockage issue, https://github.com/actions/runner-images/issues/5615
|
||||||
// test_sntp_server("udp://time.apple.com:123");
|
test_sntp_server("udp://time.apple.com:123");
|
||||||
// test_sntp_server(NULL);
|
test_sntp_server(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mqtt_data {
|
struct mqtt_data {
|
||||||
@ -2635,8 +2635,7 @@ int main(void) {
|
|||||||
test_str();
|
test_str();
|
||||||
test_globmatch();
|
test_globmatch();
|
||||||
test_get_header_var();
|
test_get_header_var();
|
||||||
if (MG_BIG_ENDIAN || sizeof(void*) != 4)
|
if (MG_BIG_ENDIAN || sizeof(void *) != 4) test_rewrites();
|
||||||
test_rewrites();
|
|
||||||
test_check_ip_acl();
|
test_check_ip_acl();
|
||||||
test_udp();
|
test_udp();
|
||||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
||||||
@ -2666,8 +2665,7 @@ int main(void) {
|
|||||||
test_ws_fragmentation();
|
test_ws_fragmentation();
|
||||||
test_http_client();
|
test_http_client();
|
||||||
}
|
}
|
||||||
if (sizeof(void*) != 4)
|
if (sizeof(void *) != 4) test_http_server();
|
||||||
test_http_server();
|
|
||||||
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
if (MG_BIG_ENDIAN || sizeof(void *) != 4) {
|
||||||
test_http_404();
|
test_http_404();
|
||||||
test_http_no_content_length();
|
test_http_no_content_length();
|
||||||
@ -2675,8 +2673,7 @@ int main(void) {
|
|||||||
test_http_range();
|
test_http_range();
|
||||||
}
|
}
|
||||||
test_sntp();
|
test_sntp();
|
||||||
if (MG_BIG_ENDIAN || sizeof(void*) != 4)
|
if (MG_BIG_ENDIAN || sizeof(void *) != 4) test_mqtt();
|
||||||
test_mqtt();
|
|
||||||
printf("SUCCESS. Total tests: %d\n", s_num_tests);
|
printf("SUCCESS. Total tests: %d\n", s_num_tests);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user