标签: idhttp

IdHTTP基本身份验证访问冲突

我正在尝试使用Indy HTTP类进行HTTP身份验证.但由于某些未知原因,我在此行中收到了访问冲突错误: IdHTTP1.Request.Authentication.Username:= Username;

代码延伸是:

  IdHTTP1:= TIdHttp.Create(Application);
  IdHTTP1.ConnectTimeout:= 10000;
  IdHTTP1.Request.Clear;
  IdHTTP1.Request.BasicAuthentication:= true;
  IdHTTP1.Request.Authentication.Username := Username;
  IdHTTP1.Request.Authentication.Password := Password;
      try
        IdHTTP1.Get(PbxURL);
        HttpCode := IdHTTP1.ResponseCode;
      except
        on E: EIdHTTPProtocolException do
          HttpCode := IdHTTP1.ResponseCode;
Run Code Online (Sandbox Code Playgroud)

我正在使用Delphi 2010,并且已经尝试过如下操作: IdHTTP1.Request.Authentication.Username:='admin'; 但没有解决问题......

delphi indy delphi-2010 idhttp

6
推荐指数
1
解决办法
1万
查看次数

indy GET下载速度

欢迎,

我必须使用indy http get compontent在我的应用程序中创建有关下载速度的信息的标题.

在我看来,我找到了简单的解决方案

在onwork活动中,我将获得下载(大小)的实际进度,并将其与之前的阅读进行比较.(例如每5秒钟).curent size减去之前的(5秒钟,存储在全局变量中)除以5秒*8,我将获得速度.如果实际尺寸等于之前,则速度始终为0.

所以我想开始编码,但我发现了一个叫做odwork的简单功能问题.

procedure TForm1.HttpWork(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Int64);
  begin
    showmessage('hello im herre');
end;  

问题是,该功能不被称为......我不知道为什么.

我正在下载100 MB的文件,我看不到任何showmessage ...

有什么想法吗?问候

delphi lazarus indy10 idhttp

5
推荐指数
1
解决办法
1660
查看次数

断开连接时出现IdHTTP访问冲突

Indy 10:

两个线程,线程1在TIdHTTP上调用Get并阻止读取数据.线程2将在同一TIdHTTP上调用disconnect以中断Get.

我在TIdHTTP上使用摘要式身份验证,我偶尔会得到一个AV.

线程1的callstack:

40491D [system.pas][System][@ClassDestroy][8989]
69EF2B [..\..\common\IdAuthenticationDigest.pas][IdAuthenticationDigest][TIdDigestAuthentication.Destroy][109]
404567 [system.pas][System][TObject.Free][8313]
6A2B69 [..\..\Common\IdHTTP.pas][IdHTTP][TIdCustomHTTP.DoOnDisconnected][1587]
534574 [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][532]
534B3B [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][767]
6A3FB3 [..\..\Common\IdHTTP.pas][IdHTTP][TIdCustomHTTP.DoRequest][2101]
Run Code Online (Sandbox Code Playgroud)

线程2的callstack:

402BA3 [system.pas][System][@FreeMem][2477]
404521 [system.pas][System][TObject.FreeInstance][8294]
40491D [system.pas][System][@ClassDestroy][8989]
69EF2B [..\..\common\IdAuthenticationDigest.pas][IdAuthenticationDigest]        [TIdDigestAuthentication.Destroy][109]
404567 [system.pas][System][TObject.Free][8313]
6A2B69 [..\..\Common\IdHTTP.pas][IdHTTP][TIdCustomHTTP.DoOnDisconnected][1587]
534574 [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][532]
534B3B [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][767]
Run Code Online (Sandbox Code Playgroud)

基本上在DoRequest结束时它会断开连接.似乎在尝试释放Request.Authentication的断开连接上存在竞争条件.

下载了Indy 10的最新代码并查看代码,我相信行为应该是相同的.

我相信从另一个线程断开调用是推荐的使用模式,我错了吗?这是Indy的一个错误吗?似乎有必要锁定断开连接,但很难看到可能造成的死锁.还有其他人遇到过这个吗?

delphi authentication indy disconnect idhttp

5
推荐指数
1
解决办法
1388
查看次数

Http将json变成字符串

我试图通过HTTP GET方法将json响应转换为字符串,但我得到的是: 在此输入图像描述

我正在使用这样的代码:

memo1.Text:= idhttp1.Get('http://blabla.com/bla.php');
Run Code Online (Sandbox Code Playgroud)

它返回json数据.我需要得到对memo1的json响应.

我怎样才能做到这一点?

delphi json indy delphi-7 idhttp

5
推荐指数
1
解决办法
6841
查看次数

TIdHTTP 和 TLS SNI 不起作用

在我的尝试中,TLS SNI 扩展丢失了。我不知道为什么。有人能指出我正确的方向吗?

\n\n

Embarcadero\xc2\xae RAD Studio 10 西雅图版本 23.0.21418.4207

\n\n

印地版本:10.6.2.5311

\n\n

OpenSSL:https://indy.fulgan.com/SSL/openssl-1.0.2h-i386-win32.zip

\n\n

使用和不使用解决方法的 (WireShark) 结果是相同的。

\n\n

示例/演示代码:

\n\n
unit CMTelekomTest;\n...\nvar\n  IdHTTP1: TIdHTTP;\n  IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;\n  xml: ixmldocument;\n  root, node, sibling: ixmlnode;\n  httpreturn, xmlfile: string;\n  xmlstream: TStringStream;\nbegin\n  // xml stuff\n  xml := newxmldocument;\n  //xml.Encoding := \'utf-8\';\n  xml.Options := [doNodeAutoIndent]; // just for xml-formatting\n  root := xml.AddChild(\'MESSAGES\');\n  node := root.AddChild(\'AUTHENTICATION\');\n  node := node.AddChild(\'PRODUCTTOKEN\');\n  node.Text := \'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\';\n  node := root.AddChild(\'MSG\');\n  sibling := node;\n  sibling := node.AddChild(\'FROM\');\n  sibling.Text := \'Sender\';\n  sibling …
Run Code Online (Sandbox Code Playgroud)

delphi ssl indy idhttp sni

5
推荐指数
1
解决办法
2563
查看次数

Delphi Berlin TIdHTTPServer(Indy 10)[https/ssl/tls]:过时的密钥交换(RSA)和漏洞客户端发起的重新协商

我有一个IdHTTPServer,我想实现对处理HTTP和HTTPS请求的支持.这是我的代码:

FSSLHandler := TIdServerIOHandlerSSLOpenSSL.Create(nil);
FSSLHandler.SSLOptions.CertFile     := 'certificate.pem';
FSSLHandler.SSLOptions.KeyFile      := 'key.pem';
FSSLHandler.SSLOptions.RootCertFile := 'chain.pem';

FIdHTTPServer.Bindings.Add.Port := 443;
FIdHTTPServer.IOHandler := FSSLHandler;

FIdHTTPServer.Activate := true;
Run Code Online (Sandbox Code Playgroud)

在我的服务器目录ssleay32.dllssleay32.dllhttp://indy.fulgan.com/SSL/下载的v1.0.2l(Win32)

当我向Chrome发出请求时,在开发者工具的安全性标签中,我看到:

在此输入图像描述

此外,使用sslyze分析服务器我还有其他一些安全问题(请参阅VULNERABLE标签):

> sslyze --regular local.XXXXXXXXXXXXXX.com:4343

SCAN RESULTS FOR LOCAL.XXXXXXXXXXXXXX.COM:4343 - 127.0.0.1
 --------------------------------------------------------

 * SSLV2 Cipher Suites:
      Server rejected all cipher suites.

 * TLSV1_1 Cipher Suites:
     Preferred:
        None - Server followed client cipher suite preference.                                                            
     Accepted:
        TLS_RSA_WITH_AES_256_CBC_SHA                      -              256 bits                                                                  
        TLS_RSA_WITH_CAMELLIA_256_CBC_SHA                 -              256 bits                                                                  
        TLS_RSA_WITH_CAMELLIA_128_CBC_SHA                 -              128 …
Run Code Online (Sandbox Code Playgroud)

delphi ssl indy idhttp tls1.2

5
推荐指数
0
解决办法
1124
查看次数

TidHTTP错误处理

我正在编写一个程序来对网站进行检查以测试它们当前的状态,例如200 OK.我正在使用Delphi 2010附带的Indy HTTP执行此任务并拥有当前代码.

procedure TCheckSiteIndividual.Execute;
var
http : TIdhttp;

begin
  try
    try
      http := Tidhttp.create(nil);  //Create indy
      http.Get(CSiteURL,nil);  //Send Request To Check Site
    except
      on E: EIdHTTPProtocolException do
       status := http.ResponseText; // or: code := E.ErrorCode;
    end;

    status := http.ResponseText;   //Return Status of Site
    synchronize(updateform);   //Update data to form
  finally
   http.Free;
  end;
end;
Run Code Online (Sandbox Code Playgroud)

CSiteURL变量在Thread Constructor中设置,status变量是整个线程的变量.

尝试,除了这段代码的部分来自Remy Lebeau - TeamB ,这是我在最初摆弄这个想法时提出的一个问题.我遇到的问题是,此代码仅在站点返回200 OK代码时才有效.任何其他原因导致异常,包括我禁用互联网.这也会导致重定向的网站上的例外情况,例如www.google.com在调试期间导致异常我认为导致它重定向到www.google.co.uk,但是如果我继续通过异常,那么它会返回301 FOUND代码没问题.

最终的结果我正在寻找它,根据网站是否在线或有错误(例如HTML返回代码)给我一个返回,当网站不存在时另外提供反馈(例如,未注册的URL)或者只是无法联系.

我正在寻找的其他建议是如何从请求中获取更多信息.特别是目前我还希望得到被检查网站的IP.

让它工作而不需要在任何URL之前有http://也是很好的,所以例如www.google.com将会工作,因为它不是因为未知的协议.

基本上如果有人链接到IndyHTTP的一些很好的文档会很好,因为它看起来很稀疏,

delphi indy idhttp

4
推荐指数
1
解决办法
8737
查看次数

IdHTTP.get返回HTTP1.1/403禁止

我正在尝试使用DelphiXE编译程序和IdHTTP组件访问我网站上的update.txt文件.

我正在使用的代码如下:

procedure TFormAbout.SpeedButtonUpdateClick(Sender: TObject);

function CheckUpdates: String;
var lIdHttp: TIdHTTP;
begin
  lIdHttp := TIdHTTP.Create(nil);
  result := lIdHttp.Get('http://www.test.com/test_down_load/update.txt');
end;

var
sWebVersion: String;
sVersionList: TStringList;

begin
try
  sWebVersion := Checkupdates;
except
  on E: Exception do
  begin 
    ShowMEssage(E.ErrorMessage);
    MessageDlg('An Error occured checking for an update.',mtError,[mbOK],0);
  end;
end;
if sWebVersion <> '' then
  begin
    sVersionList.CommaText := sWebVersion;
    ShowMessage('Version: ' + sVersionList[0] + ' - ' + 'Date: ' + sVersionList[1]);
  end;
end;
Run Code Online (Sandbox Code Playgroud)

但是会导致错误:HTTP1.1/403禁止

已使用以下属性设置IdHTTP组件.

HandleRedirects := true;
HTTPOptions [hoForceEncodeParams];
ProtocolVersion := pv1_1;
Request.UserAgent …
Run Code Online (Sandbox Code Playgroud)

delphi indy10 idhttp

4
推荐指数
2
解决办法
1万
查看次数

即使连接在IdHttp中出错,如何获取响应内容?

当像这样使用TIdHttp时:

Memo1.Text := IdHTTP1.post(url,data);
Run Code Online (Sandbox Code Playgroud)

如果它没有给出http错误,我可以获得memo1的响应内容.但是当它提出http错误请求时,Indy并没有给我内容.我也在使用try..except,但它只是防止错误框,但仍然没有给我内容.

即使它返回http错误,我怎样才能获得内容?

delphi indy delphi-7 idhttp

4
推荐指数
2
解决办法
5445
查看次数

Delphi发送HTTP GET请求而无需等待服务器响应

我想发送HTTP请求(GET)而不等待服务器响应.

IdHTTP通过忽略响应尝试了,例如:

aIdHTTP := TIdHTTP.create;
try
  aIdHTTP.Get('https://stackoverflow.com/');
finally
  aIdHTTP.free;
free
Run Code Online (Sandbox Code Playgroud)

但它总是等待服务器响应......

一个小窍门是附近在引发异常的连接TIdHTTP.OnWork时的事件AWorkModewmRead,这种紧密的连接越快......但等待"第一个字节"的回应.

有一种方法可以在不等待响应的情况下发送数据吗?

delphi indy idhttp

3
推荐指数
1
解决办法
970
查看次数

标签 统计

delphi ×10

idhttp ×10

indy ×8

delphi-7 ×2

indy10 ×2

ssl ×2

authentication ×1

delphi-2010 ×1

disconnect ×1

json ×1

lazarus ×1

sni ×1

tls1.2 ×1