简体   繁体   中英

Can I use boost asio for HTTPS requests

Can I use boost asio for HTTPS requests? I can make GET and POST HTTP requests, but what about HTTPS? How can I handle it? Can somebody provide me a code snippet?

Yes you can. http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/ssl/client.cpp Simply integrate it to your HTTP request.

Asio offers basic SSL support through OpenSSL. A code example is available as part of the documentation

In general, HTTPS is quite similar to HTTP, except for the fact that you have to perform an SSL handshake to initialize the connection. Asio offers an implementation for this.

The actual communication is quite easy, as you simply encrypt your HTTP stream, the actual communication patterns are the same.

Therefore, if the functionality offered by Asio is not flexible enough, you can also write your own encryption layer on top of Asio using OpenSSL (although I would not recommend this unless you already have a fair deal of experience with encryption).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM