2012-06-08 34 views
1

當我完成使用SSL異常

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

我覺得很開心第一次,因爲我可以使用HTTPS寫我program.However建設POCO庫,我遇到了一個例外

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

當我使用HTTPSClientSession發送request.My代碼類似以下內容:

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; 
} 

恩,是我的代碼嗎? ?這是我第一次使用這個庫。希望大家幫助我,謝謝!

回答

0

我自己已經解決了這個問題。謝謝大家。 原因是443端口未被設置,並且poco語法中的地址不正確

相關問題