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.
  1. #!/bin/bash
  2. # HTTP Proxy Server's IP Address (or URL)
  3. proxy_server=$1
  4.  
  5. # HTTP Proxy Server's Port Number
  6. port=$2
  7.  
  8. # We're trying to reach this url via the given HTTP Proxy Server
  9. # (http://www.google.com by default)
  10. url="http://www.google.com"
  11.  
  12. # Timeout time (in seconds)
  13. timeout=20
  14.  
  15. # We're fetching the return code and assigning it to the $result variable
  16. result=`HEAD -d -p http://$proxy_server:$port -t $timeout $url`
  17.  
  18. # If the return code is 200, we've reached to $url successfully
  19. if [ "$result" = "200 OK" ]; then
  20. echo "1 (proxy works)"
  21. # Otherwise, we've got a problem (either the HTTP Proxy Server does not work
  22. # or the request timed out)
  23. else
  24. echo "0 (proxy does not work or request timed out)"
  25. fi

以上是关于HTTP代理检查器的主要内容,如果未能解决你的问题,请参考以下文章

损坏的顶点和片段着色器

Yarn: 一个新的JavaScript模块管理器

如何从该片段中的 onItemSelectedListener 中获取微调器单击的项目?

如何使泛型代理类型与静态类型检查器一起使用

使用GCP调试代理的实验检查器功能

为啥这个检查代理有效性的代码会崩溃?