Compare commits

..

7 Commits

Author SHA1 Message Date
bol-van
080cbe9c53 nfqws: remove unneeded code 2024-09-19 20:07:38 +03:00
bol-van
1961833348 nfqws: display correct profiles numbers on SIGUSR2 2024-09-19 20:06:30 +03:00
bol-van
265120fbce more quic fakes 2024-09-19 19:02:21 +03:00
bol-van
8fccf29e4a nfqws: fix uninitialized host value 2024-09-19 18:27:35 +03:00
bol-van
ebc2324edf nfqws: search Host: case insensitive 2024-09-19 18:17:33 +03:00
bol-van
b6fe438017 nfqws: search Host: case insensitive 2024-09-19 18:16:32 +03:00
bol-van
29fb5f19f2 nfqws: search Host: case insensitive 2024-09-19 18:13:03 +03:00
4 changed files with 37 additions and 8 deletions

Binary file not shown.

View File

@ -82,12 +82,10 @@ static void onusr2(int sig)
printf("\nHOSTFAIL POOL DUMP\n");
struct desync_profile_list *dpl;
int n=0;
LIST_FOREACH(dpl, &params.desync_profiles, next)
{
printf("\nDESYNC PROFILE %d\n",n);
printf("\nDESYNC PROFILE %d\n",dpl->dp.n);
HostFailPoolDump(dpl->dp.hostlist_auto_fail_counters);
n++;
}
printf("\n");
@ -1773,7 +1771,6 @@ int main(int argc, char **argv)
DLOG_CONDUP("we have %d user defined desync profile(s) and default low priority profile 0\n",desync_profile_count);
v=0;
LIST_FOREACH(dpl, &params.desync_profiles, next)
{
dp = &dpl->dp;
@ -1786,7 +1783,6 @@ int main(int argc, char **argv)
DLOG("[profile %d] autottl ipv6 %u:%u-%u\n",v,dp->desync_autottl6.delta,dp->desync_autottl6.min,dp->desync_autottl6.max);
if (dp->desync_split_tls==tlspos_none && dp->desync_split_pos) dp->desync_split_tls=tlspos_pos;
if (dp->desync_split_http_req==httpreqpos_none && dp->desync_split_pos) dp->desync_split_http_req=httpreqpos_pos;
v++;
}
if (!LoadIncludeHostLists())

View File

@ -24,12 +24,45 @@ bool IsHttp(const uint8_t *data, size_t len)
{
return !!HttpMethod(data,len);
}
static bool IsHostAt(const uint8_t *p)
{
return \
p[0]=='\n' &&
(p[1]=='H' || p[1]=='h') &&
(p[2]=='o' || p[2]=='O') &&
(p[3]=='s' || p[3]=='S') &&
(p[4]=='t' || p[4]=='T') &&
p[5]==':';
}
static uint8_t *FindHostIn(uint8_t *buf, size_t bs)
{
size_t pos;
if (bs<6) return NULL;
bs-=6;
for(pos=0;pos<=bs;pos++)
if (IsHostAt(buf+pos))
return buf+pos;
return NULL;
}
static const uint8_t *FindHostInConst(const uint8_t *buf, size_t bs)
{
size_t pos;
if (bs<6) return NULL;
bs-=6;
for(pos=0;pos<=bs;pos++)
if (IsHostAt(buf+pos))
return buf+pos;
return NULL;
}
// pHost points to "Host: ..."
bool HttpFindHost(uint8_t **pHost,uint8_t *buf,size_t bs)
{
if (!*pHost)
{
*pHost = memmem(buf, bs, "\nHost:", 6);
*pHost = FindHostIn(buf, bs);
if (*pHost) (*pHost)++;
}
return !!*pHost;
@ -38,7 +71,7 @@ bool HttpFindHostConst(const uint8_t **pHost,const uint8_t *buf,size_t bs)
{
if (!*pHost)
{
*pHost = memmem(buf, bs, "\nHost:", 6);
*pHost = FindHostInConst(buf, bs);
if (*pHost) (*pHost)++;
}
return !!*pHost;
@ -132,7 +165,7 @@ bool HttpReplyLooksLikeDPIRedirect(const uint8_t *data, size_t len, const char *
}
size_t HttpPos(enum httpreqpos tpos_type, size_t hpos_pos, const uint8_t *http, size_t sz)
{
const uint8_t *method, *host;
const uint8_t *method, *host=NULL;
int i;
switch(tpos_type)