- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在使用 IdHTTP
客户端组件时遇到一般 Indy 错误结合 SOCKS5
代理服务器并使用 SSL
。
IdHTTP
组件与我的 SOCKS5
代理(和非 https URL)一起使用,一切正常。IdHTTP
组件(没有 SOCKS5
代理),一切正常。IdHTTP
组件与 SSL URL 和 SOCKS5
代理一起使用,我会收到以下错误:405行
idSocks.pas
(引发 EIdSocksServerGeneralError.Create(RSSocksServerGeneralError);
这是我的代码
var
HTTP : TIdHTTP;
Cookie : TIdCookieManager;
SSL : TIdSSLIOHandlerSocketOpenSSL;
Params : TStringList;
HTMLSource : String;
CurrentProxy : String;
ProxyPort : Integer;
ProxyHost : String;
ProxyUsername : String;
ProxyPW : String;
begin
Synchronize(AddItem);
HTTP := TIdHTTP.Create(NIL);
Cookie := TIdCookieManager.Create(HTTP);
SSL := TIdSSLIOHandlerSocketOpenSSL.Create(HTTP);
HTTP.CookieManager := Cookie;
HTTP.IOHandler := SSL;
HTTP.HandleRedirects := True;
Params := TStringList.Create;
HTTP.Request.UserAgent := Task^.Useragent;
try
while True do begin
if terminated then Exit;
Params.Clear;
Cookie.CookieCollection.Clear;
if Task^.Proxytype >= 0 then begin // if proxy enabled
CurrentProxy := Task^.Form.GetProxyFromPool;
ProxyHost := ParsingW(':', CurrentProxy, 1);
ProxyPort := strtoint(ParsingW(':', CurrentProxy, 2));
HTTP.ConnectTimeout := (Task^.Proxytimeout * 1000);
if Task^.ProxyAuth then begin
ProxyUsername := ParsingW(':', CurrentProxy, 3);
ProxyPW := ParsingW(':', CurrentProxy, 4);
end;
end;
if Task^.Proxytype = 0 then begin //HTTP(s)
HTTP.ProxyParams.ProxyServer := ProxyHost;
HTTP.ProxyParams.ProxyPort := ProxyPort;
if Task^.ProxyAuth then begin
HTTP.ProxyParams.ProxyUsername := ProxyUsername;
HTTP.ProxyParams.ProxyPassword := ProxyPW;
end;
end;
if (Task^.Proxytype = 1) or (Task^.Proxytype = 2) then begin // Socks 4 or 5
SSL.TransparentProxy := TIdSocksInfo.Create(HTTP);
(SSL.TransparentProxy as TIdSocksInfo).Port := ProxyPort;
(SSL.TransparentProxy as TIdSocksInfo).Host := ProxyHost;
if Task^.ProxyAuth then begin
(SSL.TransparentProxy as TIdSocksInfo).Username := ProxyUsername;
(SSL.TransparentProxy as TIdSocksInfo).Password := ProxyPW;
(SSL.TransparentProxy as TIdSocksInfo).Authentication := saUsernamePassword;
end else begin
(SSL.TransparentProxy as TIdSocksInfo).Authentication := saNoAuthentication;
end;
if (Task^.Proxytype = 1) then (SSL.TransparentProxy as TIdSocksInfo).Version := svSocks4;
if (Task^.Proxytype = 2) then (SSL.TransparentProxy as TIdSocksInfo).Version := svSocks5;
end;
我是否遗漏了什么或者无法使用 Socks5 代理连接到 SSL 站点?
最佳答案
您收到 EIdSocksServerGeneralError
引发的事实意味着 TIdHTTP
已成功与 SOCKS 代理通信,并且它正在验证您的请求以在无需身份验证的情况下访问它,但是然后无法与您在 HTTPS 网址中指定的目标服务器建立连接。代理正在回复错误代码 1(一般故障)。确保网址准确无误。代理无法将主机名解析为 IP(尝试在 url 中指定 IP 而不是主机名,看看是否有所不同),或者代理没有到达该 IP 的有效路由,或者是其他一些错误发生在代理端。如果您有权访问代理,请尝试查看其日志以了解实际出了什么问题。
关于delphi - IdHTTP + socks + socks 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19001591/
我正在准备申请。 IDHTTP:使用Get方法。但是有一些问题。我要创建一个代理列表,然后单击添加IDHTTP的列表框项(代理地址)。对不起,我不太会英语。 我的密码; procedure TForm
我正在尝试使用 Indy HTTP 类进行 HTTP 身份验证。但由于某种未知的原因,我在这一行中收到了访问冲突错误:IdHTTP1.Request.Authentication.Username :
我正在使用 idhttp (Indy) 进行一些网站检查。我想要它做的就是在发送请求后检查服务器的响应代码,我不想实际上必须从服务器接收 HTML 输出,因为我只监视 200 OK 代码,任何其他代码
请向我解释如何使用 SSL (https://) 从服务器下载文件。我在互联网上没有找到合适的答案。 每个人都在谈论 TIdSSLIOHandlerSocket,但我只有 TIdSSLIOHandle
请向我解释如何使用 SSL (https://) 从服务器下载文件。我在互联网上没有找到合适的答案。 每个人都在谈论 TIdSSLIOHandlerSocket,但我只有 TIdSSLIOHandle
我如何使用 IdHTTP 将消息作为 PostMan 发送如下: 我的第一次尝试如下: function TIdFoo.SendIM(const AID, AMessage: string): Boo
印地 10: 两个线程,线程 1 正在调用 TIdHTTP 上的 Get 并阻止读取数据。线程2将在同一个TIdHTTP上调用disconnect以中断Get。 我在 TIdHTTP 上使用摘要式身份
使用:Delphi 2010,最新版本的 Indy 我正在尝试从 Google Adsense 网页上抓取数据,目的是获取报告。然而到目前为止我还没有成功。它在第一个请求后停止并且不再继续。 使用 F
我使用 TIdHttp 来获取网页内容。响应头指示内容编码为utf8。我想在控制台中打印内容为CP936(简体中文),但实际内容不可读。 Result := TEncoding.Utf8.GetStr
一家公司要求我记录我们的客户端仅在软件级别通过 TCP 协议(protocol)与我们的服务器进行通信。我一直假设 IdHTTP 使用 TCP,但我不确定如何证明它。我在文档中找不到它。 最佳答案 T
我已指定 OnStatus 处理程序使用 AStatusText 参数更新标签。 在处理程序中设置断点时,它只会在我执行 Get("google.com") 时在 hsConnected 状态下中断。
像这样使用 TIdHttp 时: Memo1.Text := IdHTTP1.post(url,data); 如果 memo1 没有给出 http 错误,我可以获得响应内容。但是当它给出 http 错
好的,我已经动态创建了 Idhttp,如下所示 procedure TForm1.Button1Click(Sender: TObject); Var Resp : String; begin
我发现,当为 TIdHTTP 组件设置 ConnectTimeoout 属性时,它会使请求(GET 和 POST)变慢约 120 毫秒? 这是为什么,我可以以某种方式避免/绕过它吗? Env:D201
如何检查特定响应代码(例如 200 OK)的目标 URL,而 Indy 不会抛出各种异常。连接超时、连接正常关闭等... 例如,如果 URL 不正确或者找不到或无法访问其主机。即使我试图忽略它们,In
我目前有这个 TThread 将一些图像下载到桌面,这是线程代码: type TDownloadUpdateAnimateEvent = procedure(Sender: TObject; AA
我正在尝试运行此代码: var objHttp: TIdHTTP; ... objHttp.HandleRedirects := True; objHttp.AllowCookies :=
我正在尝试使用 TIdHTTP 上传文件。问题是当请求发送到服务器时访问 token 会发生更改。 我使用的访问 token 是fJNhDM6TlcpeVmD8h3jFuPJS71sxwZB8bZBX
主要目标是将所有数据发送到远程 mysql 数据库。我使用 TidHTTP 作为 POST 方法。拥有近 10.000 条记录,约 2MB 数据。当我运行delphi代码时,上传json数据。但有些记
我使用 IdHTTP.get 来获取 url 的 HTMl,但是在这个 url 中是一个用 ajax 加载的表,我必须等待几秒钟才能加载它,然后才能获取页面的 HTML。 我可以等一下吗? 最佳答案
我是一名优秀的程序员,十分优秀!