HTTP代理检查器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTTP代理检查器相关的知识,希望对你有一定的参考价值。
This script tries to detect whether an HTTP Proxy works or not. It uses the HEAD command (high-level version of the lwp-request command) to connect to a given URL (http://www.google.com by default) via the given HTTP Proxy.It takes 2 arguments; the first one is the IP Address or URL of the HTTP Proxy and the second one is its port number.
If you have a simpler or faster method, please let me know.
#!/bin/bash # HTTP Proxy Server's IP Address (or URL) proxy_server=$1 # HTTP Proxy Server's Port Number port=$2 # We're trying to reach this url via the given HTTP Proxy Server # (http://www.google.com by default) url="http://www.google.com" # Timeout time (in seconds) timeout=20 # We're fetching the return code and assigning it to the $result variable result=`HEAD -d -p http://$proxy_server:$port -t $timeout $url` # If the return code is 200, we've reached to $url successfully if [ "$result" = "200 OK" ]; then echo "1 (proxy works)" # Otherwise, we've got a problem (either the HTTP Proxy Server does not work # or the request timed out) else echo "0 (proxy does not work or request timed out)" fi
以上是关于HTTP代理检查器的主要内容,如果未能解决你的问题,请参考以下文章