@@ -325,6 +325,7 @@ free_http_check(checker_t *checker)
325325
326326 free_url_list (& http_get_chk -> url );
327327 free_http_request (http_get_chk -> req );
328+ FREE_CONST_PTR (http_get_chk -> sni_name );
328329 FREE_CONST_PTR (http_get_chk -> virtualhost );
329330 FREE_PTR (http_get_chk );
330331 FREE (checker -> co );
@@ -344,6 +345,8 @@ dump_http_check(FILE *fp, const checker_t *checker)
344345 conf_write (fp , " Virtualhost = %s" , http_get_chk -> virtualhost );
345346#ifdef _HAVE_SSL_SET_TLSEXT_HOST_NAME_
346347 conf_write (fp , " Enable SNI %sset" , http_get_chk -> enable_sni ? "" : "un" );
348+ if (http_get_chk -> sni_name )
349+ conf_write (fp , " SNI name = %s" , http_get_chk -> sni_name );
347350#endif
348351 conf_write (fp , " Fast recovery %sset" , http_get_chk -> fast_recovery ? "" : "un" );
349352 if (http_get_chk -> proto == PROTO_SSL )
@@ -361,7 +364,6 @@ alloc_http_get(const char *proto)
361364 INIT_LIST_HEAD (& new -> url );
362365 new -> proto = (!strcmp (proto , "HTTP_GET" )) ? PROTO_HTTP : PROTO_SSL ;
363366 new -> http_protocol = HTTP_PROTOCOL_1_0 ;
364- new -> virtualhost = NULL ;
365367
366368 if (new -> proto == PROTO_SSL )
367369 check_data -> ssl_required = true;
@@ -396,6 +398,10 @@ compare_http_check(const checker_t *old_c, checker_t *new_c)
396398 return false;
397399 if (old -> virtualhost && strcmp (old -> virtualhost , new -> virtualhost ))
398400 return false;
401+ if (!old -> sni_name != !new -> sni_name )
402+ return false;
403+ if (old -> sni_name && strcmp (old -> sni_name , new -> sni_name ))
404+ return false;
399405
400406 list_for_each_entry (u1 , & old -> url , e_list ) {
401407 u2 = (!u2 ) ? list_first_entry (& new -> url , url_t , e_list ) :
@@ -851,6 +857,21 @@ enable_sni_handler(const vector_t *strvec)
851857 }
852858 http_get_chk -> enable_sni = res ;
853859}
860+
861+ static void
862+ sni_name_handler (const vector_t * strvec )
863+ {
864+ http_checker_t * http_get_chk = current_checker -> data ;
865+
866+ if (vector_size (strvec ) >= 2 )
867+ set_string (& http_get_chk -> sni_name , strvec , "sni_name" );
868+ else if (http_get_chk -> sni_name ) {
869+ report_config_error (CONFIG_GENERAL_ERROR , "sni_name already specified as %s - ignoring setting to default" , http_get_chk -> sni_name );
870+ return ;
871+ }
872+
873+ http_get_chk -> enable_sni = true;
874+ }
854875#endif
855876
856877static void
@@ -954,6 +975,7 @@ install_http_ssl_check_keyword(const char *keyword)
954975 install_keyword ("http_protocol" , & http_protocol_handler );
955976#ifdef _HAVE_SSL_SET_TLSEXT_HOST_NAME_
956977 install_keyword ("enable_sni" , & enable_sni_handler );
978+ install_keyword ("sni_name" , & sni_name_handler );
957979#endif
958980 install_keyword ("fast_recovery" , & fast_recovery_handler );
959981 if (!strcmp (keyword , "SSL_GET" ))
0 commit comments