Let's take Net/samples/httpget as an example, let's copy httpget/ as a new httpsget directory:
- open Makefile, add "PocoNetSSL" to target_libs
- replace 'HTTPClientSession' with 'HTTPSClientSession'
- you need to create Poco::Net::Context for SSL use
- replace 'HTTPClientSession session(uri.getHost(), uri.getPort());' with following two lines:
const Context::Ptr context = new Context(Context::CLIENT_USE, "", "", "", Context::VERIFY_NONE, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
HTTPSClientSession session(uri.getHost(), uri.getPort(), context);
Summary:
- add PocoNetSSL as a lib_depends
- use Poco::Net::Context with HTTPSClientSession
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…