delphi - 如何在 Delphi XE 中检查连接.onion 域 Tor URL?

标签 delphi http delphi-xe indy tor

如何在 Delphi XE 中检查连接.onion 域 Tor URL?

例子:http://1234567890abcdef.onion

result: 200 'Url exists' 或 404 'Url does not exist' 等通过 HTTP 状态代码。

procedure Button1Click(Sender: TObject);
var
  http : TIdHttp;
  url : string;
  code : integer;
begin
  url := 'http://1234567890abcdef.onion';
  http := TIdHTTP.Create(nil);
  try
    try
      http.Head(url);
      code := http.ResponseCode;
    except
      on E: EIdHTTPProtocolException do
        code := http.ResponseCode; // or: code := E.ErrorCode;
    end;
    ShowMessage(IntToStr(code));
  finally
    http.Free();
  end;
end;

procedure Button1Click(Sender: TObject);
var
  http : TIdHttp;
  url : string;
  code : integer;
begin
  url := 'http://1234567890abcdef.onion';
  http := TIdHTTP.Create(nil);
  try
    try
      http.Get(url, nil);
      code := http.ResponseCode;
    except
      on E: EIdHTTPProtocolException do
        code := http.ResponseCode; // or: code := E.ErrorCode;
    end;
    ShowMessage(IntToStr(code));
  finally
    http.Free();
  end;
end;

但是

始终所有结果:每个 Tor URL 的“200”或“连接超时”。

最佳答案

来自 Wikipedia :

Such addresses are not actual DNS names, and the .onion TLD is not in the Internet DNS root, but with the appropriate proxy software installed, (...)

因此,要访问 .onion 站点,请将 Indy (TidHTTP) 配置为使用您的代理。

关于delphi - 如何在 Delphi XE 中检查连接.onion 域 Tor URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33535037/

相关文章:

delphi - Firemonkey ScrollBox 错误

php - HTTP 头文件未完全下载

delphi - VirtualTreeView:检查节点是否可见

javascript - node.js http服务器,检测客户端何时断开连接

delphi - 如何从动态生成的表单中检索数据?

delphi - 如何分析Delphi应用程序中过多的内存消耗(PageFileUsage)?

Delphi XE4 "class not found"但编译正常

Delphi - 为什么这个 Tab 键顺序不能正常工作?

delphi - Application.ActivateHint 在 Delphi XE2 上显示错误位置的提示

http - 在真实设备上调用 api 时,Ionic 4 Http 失败响应(未知 url): 0 Unknown Error.