-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttp.c
More file actions
34 lines (24 loc) · 850 Bytes
/
http.c
File metadata and controls
34 lines (24 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "http.h"
int http_connect(proxy_client_t *client, char **response)
{
if((*response = simple_get_request(client->fd)) == NULL) return 1;
if(parse_origin(*response) == NULL) return 1;
return 0;
}
enum anonimity_level parse_anonimity_level(char *data)
{
char *origin = parse_origin(data);
if(origin == NULL) { log_error("origin is null"); }
bool have_my_ip = strstr(origin,get_global_ip()) == 0 ? false : true;
bool isOriginMultiIPs = strstr(origin,",") == 0 ? false : true;
bool isViaHeader = strstr(data,"Via") == 0 ? false : true;
free(origin);
if(have_my_ip)
return Transparent;
else if( !isOriginMultiIPs && isViaHeader)
return Low;
else if( isOriginMultiIPs )
return Medium;
else
return High;
}