处理无sni的ssl。

This commit is contained in:
zhengchao
2019-06-21 16:10:26 +08:00
parent 1a725d24ce
commit 8c33bd3a58
3 changed files with 20 additions and 15 deletions

View File

@@ -73,7 +73,7 @@ static size_t ssl_svc_server_st_mk_key(const struct ssl_chello* chello, const st
const char* sip=NULL, *sport=NULL, *dip=NULL, *dport=NULL;
char * addr_str= tfe_stream_addr_to_str(addr);
tfe_stream_addr_str_split(addr_str, &sip, &sport, &dip, &dport);
key_len=snprintf(key_buff, sz, "%s:%s:%s:", dip, dport, chello->sni);
key_len=snprintf(key_buff, sz, "%s:%s:%s:", dip, dport, chello->sni?chello->sni:"null");
free(addr_str);
return key_len;
}
@@ -83,10 +83,11 @@ static size_t ssl_svc_client_st_mk_key(const struct ssl_chello* chello, const st
const char* sip=NULL, *sport=NULL, *dip=NULL, *dport=NULL;
char * addr_str= tfe_stream_addr_to_str(addr);
tfe_stream_addr_str_split(addr_str, &sip, &sport, &dip, &dport);
key_len=snprintf(key_buff, sz, "%s:%d:%d:%s:%s:", sip,
key_len=snprintf(key_buff, sz, "%s:%d:%d:%s:%s", sip,
chello->min_version.ossl_format,
chello->max_version.ossl_format,
chello->sni, chello->alpn?chello->alpn:"null");
chello->sni?chello->sni: dip ,
chello->alpn?chello->alpn:"null");
if(chello->cipher_suites && sz-key_len>chello->cipher_suites_len)
{
memcpy(key_buff+key_len, chello->cipher_suites, chello->cipher_suites_len);