2

当我使用完成构建 POCO 库时

Win32OpenSSL-1_0_1c.exe
poco-1.4.3p1-all

我首先感到高兴,因为我可以使用 HTTPS 来编写我的程序。但是,我遇到了异常

msg = "error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

当我使用 HTTPSClientSession 发送请求时。我的代码如下:

try{

Context::Ptr pContext = new Context(Context::CLIENT_USE, "", "", "", Context::VERIFY_RELAXED, 9, true, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
HTTPSClientSession session(pContext);
Poco::URI uri("...");//private server with https
session.setHost(uri.getHost());
session.setKeepAlive(true);
HTTPRequest request(HTTPRequest::HTTP_POST);
session.sendRequest(request) << ...;
char m_arrayRet[1024];
HTTPResponse response;
std::istream& res = session.receiveResponse(response);
while(!res.eof())
res.read(m_arrayRet,1024);
m_arrayRet[res.gcount()] = '\0';
}
catch{
std::cerr << exc.displayText() << std::endl;
}

恩,我的代码对吗??这是我第一次使用这个库。希望大家帮助我,谢谢!!!

4

1 回答 1

0

我自己已经解决了这个问题。谢谢大家。原因443是没有设置端口,poco语法中的地址不正确

于 2012-06-08T03:31:12.790 回答