From fdd9f63222712028a2a4ec59bbf4a53962455d11 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Thu, 26 Nov 2026 15:39:18 +0300 Subject: [PATCH] tlspr: the SNI break split sent once the destination is connected --- src/tlspr.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/tlspr.c b/src/tlspr.c index 04b0756..8bfc882 100644 --- a/src/tlspr.c +++ b/src/tlspr.c @@ -335,6 +335,7 @@ void * tlsprchild(struct clientparam* param) { int lv=-1; char proto[PROTOLEN]="-"; int snipos = 0; + int snlen = 0; PROXYSERVICE stlsproto = param->clientstarttls? param->clientstarttls : param->srv->srvstarttls; if(!param->clientstarttls && stlsproto){ @@ -357,16 +358,7 @@ void * tlsprchild(struct clientparam* param) { } else if (parsehostname(sni, param, param->srv->targetport? ntohs(param->srv->targetport):starttlsport(stlsproto))) RETURN (100); if (!param->hostname)param->hostname = (unsigned char *)strdup(sni); - if(param->srv->s_option && snipos && res > 1){ - int len; - - len = socksend(param, param->remsock, param->clibuf+param->clioffset,snipos + (res/2), conf.timeouts[STRING_S]); - if(len != snipos + (res/2)){ - RETURN(310); - } - param->clioffset += snipos + (res/2); - - } + snlen = res; } else if (res < 0 && param->srv->requirecert) RETURN(310-res); } @@ -386,6 +378,17 @@ void * tlsprchild(struct clientparam* param) { return (void *)param->redirectfunc; } + if(param->srv->s_option && snipos && snlen > 1){ + int len; + + len = socksend(param, param->remsock, param->clibuf+param->clioffset,snipos + (snlen/2), conf.timeouts[STRING_S]); + if(len != snipos + (snlen/2)){ + RETURN(310); + } + param->clioffset += snipos + (snlen/2); + + } + if(stlsproto){ res = srvstarttls(param, stlsproto); if(res){