Browse Source

Add files via upload

pull/319/head
SashaXser 2 years ago
committed by GitHub
parent
commit
d7cc055037
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      src/goodbyedpi.c

26
src/goodbyedpi.c

@ -136,8 +136,8 @@ static int running_from_service = 0;
static int exiting = 0; static int exiting = 0;
static HANDLE filters[MAX_FILTERS]; static HANDLE filters[MAX_FILTERS];
static int filter_num = 0; static int filter_num = 0;
static const char *http10_redirect_302 = "HTTP/1.0 302 "; static const char http10_redirect_302[] = "HTTP/1.0 302 ";
static const char *http11_redirect_302 = "HTTP/1.1 302 "; static const char http11_redirect_302[] = "HTTP/1.1 302 ";
static const char http_host_find[] = "\r\nHost: "; static const char http_host_find[] = "\r\nHost: ";
static const char http_host_replace[] = "\r\nhoSt: "; static const char http_host_replace[] = "\r\nhoSt: ";
static const char http_useragent_find[] = "\r\nUser-Agent: "; static const char http_useragent_find[] = "\r\nUser-Agent: ";
@ -316,27 +316,19 @@ static void mix_case(char *pktdata, unsigned int pktlen) {
static int is_passivedpi_redirect(const char *pktdata, unsigned int pktlen) { static int is_passivedpi_redirect(const char *pktdata, unsigned int pktlen) {
/* First check if this is HTTP 302 redirect */
/* Check HTTP status code using hash table lookup */ if (memcmp(pktdata, http11_redirect_302, sizeof(http11_redirect_302)-1) == 0 ||
if (http_status_code_hash(pktdata) == 302) { memcmp(pktdata, http10_redirect_302, sizeof(http10_redirect_302)-1) == 0)
{
/* Search for location header using Boyer-Moore */ /* Then check if this is a redirect to new http site with Connection: close */
if (boyer_moore_search(pktdata, pktlen, location_http, sizeof(location_http)-1)) { if (dumb_memmem(pktdata, pktlen, location_http, sizeof(location_http)-1) &&
dumb_memmem(pktdata, pktlen, connection_close, sizeof(connection_close)-1)) {
/* Search for connection header using Boyer-Moore */
if (boyer_moore_search(pktdata, pktlen, connection_close, sizeof(connection_close)-1)) {
return TRUE; return TRUE;
} }
}
} }
return FALSE; return FALSE;
} }
static int find_header_and_get_info(const char *pktdata, unsigned int pktlen, static int find_header_and_get_info(const char *pktdata, unsigned int pktlen,
const char *hdrname, const char *hdrname,
char **hdrnameaddr, char **hdrnameaddr,

Loading…
Cancel
Save