mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-13 22:03:09 +00:00
AI fixes
This commit is contained in:
@@ -632,7 +632,7 @@ function tls_mod_shim(desync, blob, modlist, payload)
|
|||||||
if not val then
|
if not val then
|
||||||
error("tls_mod_shim: non-existent var '"..var.."'")
|
error("tls_mod_shim: non-existent var '"..var.."'")
|
||||||
end
|
end
|
||||||
modlist = string.sub(modlist,1,p1+3)..val..string.sub(modlist,p2+1)
|
modlist = string.sub(modlist,1,p1+3)..tostring(val)..string.sub(modlist,p2+1)
|
||||||
end
|
end
|
||||||
return tls_mod(blob,modlist,payload)
|
return tls_mod(blob,modlist,payload)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1868,7 +1868,7 @@ static bool lua_reconstruct_ip6exthdr(lua_State *L, int idx, struct ip6_hdr *ip6
|
|||||||
{
|
{
|
||||||
LUA_STACK_GUARD_ENTER(L)
|
LUA_STACK_GUARD_ENTER(L)
|
||||||
// proto = last header type
|
// proto = last header type
|
||||||
if (*len<sizeof(struct tcphdr)) return false;
|
if (*len<sizeof(struct ip6_hdr)) return false;
|
||||||
|
|
||||||
uint8_t *last_proto = &ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt;
|
uint8_t *last_proto = &ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt;
|
||||||
size_t filled = sizeof(struct ip6_hdr);
|
size_t filled = sizeof(struct ip6_hdr);
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ bool IsHttpReply(const uint8_t *data, size_t len)
|
|||||||
data[10]>='0' && data[10]<='9' &&
|
data[10]>='0' && data[10]<='9' &&
|
||||||
data[11]>='0' && data[11]<='9';
|
data[11]>='0' && data[11]<='9';
|
||||||
}
|
}
|
||||||
int HttpReplyCode(const uint8_t *data, size_t len)
|
int HttpReplyCode(const uint8_t *data)
|
||||||
{
|
{
|
||||||
return (data[9]-'0')*100 + (data[10]-'0')*10 + (data[11]-'0');
|
return (data[9]-'0')*100 + (data[10]-'0')*10 + (data[11]-'0');
|
||||||
}
|
}
|
||||||
@@ -370,7 +370,7 @@ bool HttpReplyLooksLikeDPIRedirect(const uint8_t *data, size_t len, const char *
|
|||||||
|
|
||||||
if (!host || !*host || !IsHttpReply(data, len)) return false;
|
if (!host || !*host || !IsHttpReply(data, len)) return false;
|
||||||
|
|
||||||
code = HttpReplyCode(data,len);
|
code = HttpReplyCode(data);
|
||||||
|
|
||||||
if ((code!=302 && code!=307) || !HttpExtractHeader(data,len,"\nLocation:",loc,sizeof(loc))) return false;
|
if ((code!=302 && code!=307) || !HttpExtractHeader(data,len,"\nLocation:",loc,sizeof(loc))) return false;
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ bool HttpExtractHeader(const uint8_t *data, size_t len, const char *header, char
|
|||||||
bool HttpExtractHost(const uint8_t *data, size_t len, char *host, size_t len_host);
|
bool HttpExtractHost(const uint8_t *data, size_t len, char *host, size_t len_host);
|
||||||
bool IsHttpReply(const uint8_t *data, size_t len);
|
bool IsHttpReply(const uint8_t *data, size_t len);
|
||||||
// must be pre-checked by IsHttpReply
|
// must be pre-checked by IsHttpReply
|
||||||
int HttpReplyCode(const uint8_t *data, size_t len);
|
int HttpReplyCode(const uint8_t *data);
|
||||||
// must be pre-checked by IsHttpReply
|
// must be pre-checked by IsHttpReply
|
||||||
bool HttpReplyLooksLikeDPIRedirect(const uint8_t *data, size_t len, const char *host);
|
bool HttpReplyLooksLikeDPIRedirect(const uint8_t *data, size_t len, const char *host);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user