如何在 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/