summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ssl/ssl_lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 10a76940dd..15380e1b72 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -2618,8 +2618,11 @@ const char *SSL_get_servername(const SSL *s, const int type)
* peer send" and "what was actually negotiated"; we should have
* a clear distinction amongst those three.
*/
- if (SSL_in_init(s))
+ if (SSL_in_init(s)) {
+ if (s->hit)
+ return s->session->ext.hostname;
return s->ext.hostname;
+ }
return (s->session != NULL && s->ext.hostname == NULL) ?
s->session->ext.hostname : s->ext.hostname;
}