winInet 访问https总是出错,求解

blackkey 2015-07-15 09:25:48
向https://vpn3.foton.com.cn/prx/000/http/localhost/login发包总是错误,代码如下

uri := TIdURI.Create(url);
host := uri.Host;
ShowMessage('host为'+host);
path := uri.Path + uri.Document;

proto := uri.Protocol;
uri.Free;
if UpperCase(proto) = 'HTTPS' then
begin
port := INTERNET_DEFAULT_HTTPS_PORT;
dwFlags := INTERNET_FLAG_SECURE or SECURITY_INTERNET_MASK or INTERNET_FLAG_RELOAD;
end
else
begin
port := INTERNET_INVALID_PORT_NUMBER;
dwFlags := INTERNET_FLAG_RELOAD;
end;
hInt := InternetOpen('Project1',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);

hConn := InternetConnect(hInt,PChar(host),port,nil,nil,INTERNET_SERVICE_HTTP,0,0);



hreq := HttpOpenRequest(hConn,'GET',PChar(Path),'HTTP/1.1',nil,Pointer(AcceptTypes),dwFlags,0);


GetMem(buffer, 65536);
if HttpSendRequest(hReq,nil,0,PChar(data),Length(data)) then
begin
dwRead:=0;
repeat
InternetReadFile(hreq,buffer,65536,dwRead);
if dwRead<>0 then
res.Write(buffer^, dwRead);
until dwRead=0;
end
error:=GetLastError;
ShowMessage(IntToStr(error));


总是不成功,提示120错误
...全文
310 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
缘中人 2015-07-16
  • 打赏
  • 举报
回复
这个页面就打不开啊
blackkey 2015-07-16
  • 打赏
  • 举报
回复
只是证书有问题,忽略就可以打开页面了,我是参考了 http://bbs.csdn.net/topics/320010618

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧