Proxy checking
That is how sockslist.net and proxyhttp.net checker works.
At first you need to understand HTTP protocol (described in RFC2616).
HTTP proxy receives the same request as web server. After request proxy determines a requested web server by Host request-header field and a uri by Request-URI.
So, to check a proxy we need to send a simple HTTP request to a proxy. Also we need to determine a type of a proxy. For this purpose we need a script which returns all headers sent to a server.
Here is a classic perl CGI script:
#!/usr/bin/env perl print "Content-type: text/plain; charset=utf-8\n\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; }
This script returns all headers sent by a client and some environment variables set by a web server in "key=value" form.
Now checker analyzes returned variables to determine a type of a proxy.
Types of a proxy:
Transparent (usual) proxy server — it doesn't hide an information about your address. It sends the following headers:
HTTP_VIA - IP address of a proxy,
HTTP_X_FORWARDED_FOR - IP address of a proxy user.Anonymous — doesn't hide a fact of a proxy using, but hides an user IP address.
Headers:
HTTP_VIA - IP address of a proxy,
HTTP_X_FORWARDED_FOR - IP address of a proxy or nothing.High anonymous (elite) proxy — hides a fact that a proxy is using. High anonymous proxy doesn't set HTTP_X_FORWARDED_FOR neither HTTP_VIA.
Next step is to detect possibility of HTTPS request. To check it checker uses CONNECT request.
After successful checking and classification a proxy will be added to the database.
Author: Sergey Zasenko