idHttp:网站为https时,错误500内部服务器 [英] idHttp : error 500 internal server when site is https
问题描述
我正在从事一个涉及登录和下载的项目,对于20多个站点,在某些情况下,这些站点非常相似,即使它们的结构相同
我最近遇到了一个问题,一些相同的结构化站点是http
,一些是Https
,Http
是可以正常工作的,但是在第一个post
处的Https
却返回错误500 internal server
当我尝试登录时,响应代码显示
I am working on a project involving login and download, for more than 20 site, in some cases, the sites are very alike, even their structure is the same
i have encountered a problem recently, some of the same structured sites are http
and some are Https
, the Http
ones are ok and work fine but the Https
ones at the very first post
return an error 500 internal server
when i try to login, the response code shows
for security reasons you can not access ...
我是否需要更改https
网站的方法?我该如何解决?
我的代码:
do i need to change my approach with https
sites ? how can i fix this ?
my code :
mIdHttp := TIdHttp.create(nil);
mIdHttp.AllowCookies := true;
mIdHttp.HandleRedirects := true;
mIdHttp.Request.Charset := 'utf-8';
requestList.add('the post info from http analyzer');
mIdHttp.post('site login url', requestList, responseCode); // error happens here
出于隐私原因,我无法共享任何网站的网址
我做了关于设置处理程序的建议
for privacy reasons i can not share the url for any of the sites
Edit :
i did what was suggested about setting handler
LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
mIdHttp.IOHandler:=LHandler;
但是没有用! (我还下载了两个dll)
but it didn't work! (i also downloaded the two dll)
新发展:
我只是注意到Windows Internet Explorer也无法打开该网站!!并返回错误:
New development :
i just noticed the windows internet explorer cant open the site either!! and it returns an error :
Turn on TLS 1.0, TLS 1.1, and TLS 1.2 in Advanced settings and try connecting to somesite.com again. If this error persists, contact your site administrator.
我认为该网站的证书是伪造的,如果我转到设置并取消选中
i think the certificate for the site is a fake, and if i go to the setting and uncheck the
check for publisher certifcate revocation
Internet Explorer中的
选项,该站点打开!,这是我收到错误消息的原因吗? 我如何对idHttp做同样的事情?
option in internet explorer, the site opens!, is this the reason i'm getting an error ? how can i do the same to idHttp ?
编辑2(新网站):
因为该站点的问题与上一个站点非常相似,所以我决定不为此创建新问题
Edit 2 (A New Site):
because the problem with this site is very similar to the previous one, i decided not to create a new question for this
我在新站点上遇到错误500
,当我尝试手动转到该站点并登录时,我在firefox中遇到了This Connection is Untrusted
错误,在其他浏览器中也遇到了类似的错误,这是Firefox的图片错误:
I'm getting an error 500
with a new site , when i try to manually go to the site and login i get an This Connection is Untrusted
error in firefox and similar error in other browsers here is a picture o the firefox error :
我已经尝试过
LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
//LHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
LHandler.OnVerifyPeer := OnVerifyPeer;
mIdHttp.IOHandler := LHandler;
function OnVerifyPeer(certificate: TIdX509; AOk: Boolean; Adepth:Integer; AError: Integer): boolean;
begin
Result := true;
end;
但我仍然遇到相同的错误
我还应该提到在这种特殊情况下,使用idHttp.Get
不会引起任何错误,当我尝试Post
进行登录时会发生该错误.
还有一件事,我同时使用httpAnalyzer
和fiddler
,但是当我运行程序时,它们都无法访问posts
或gets
网站(仅 无效)当我使用我的程序并尝试针对该特定站点的post
和get
时.)
but i still get the same error
i also should mention that in this particular case, using idHttp.Get
does not cause any error, the error happens when i trying to Post
for login.
one more thing, i use both httpAnalyzer
and fiddler
, but none of them can pick up the site posts
or gets
when i run my program (they only don't work when i use my program and i try to post
and get
for this particular site).
推荐答案
我只是注意到Windows Internet Explorer无法打开该站点!!并返回错误:
i just noticed the windows internet explorer cant open the site either!! and it returns an error :
在高级"设置中打开TLS 1.0,TLS 1.1和TLS 1.2,然后尝试再次连接到somesite.com.如果此错误仍然存在,请与您的站点管理员联系.
Turn on TLS 1.0, TLS 1.1, and TLS 1.2 in Advanced settings and try connecting to somesite.com again. If this error persists, contact your site administrator.
在TIdSSLIOHandlerSocketOpenSSL.SSLOptions.SSLVersions
属性中启用sslvTLSv1
,sslvTLSv1_1
和sslvTLSv1_2
标志.
Enable the sslvTLSv1
, sslvTLSv1_1
, and sslvTLSv1_2
flags in the TIdSSLIOHandlerSocketOpenSSL.SSLOptions.SSLVersions
property.
我认为该网站的证书是伪造的,如果我转到设置并取消选中
i think the certificate for the site is a fake, and if i go to the setting and uncheck the
检查发布者证书撤销
Internet Explorer中的选项,该站点将打开!
option in internet explorer, the site opens!
将处理程序分配给TIdSSLIOHandlerSocketOpenSSL.OnVerifyPeer
事件,并使其对要接受的任何证书返回True.
Assign a handler to the TIdSSLIOHandlerSocketOpenSSL.OnVerifyPeer
event and have it return True for any certificate you want to accept.
这篇关于idHttp:网站为https时,错误500内部服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!