标签:
Unfortunately, standard C++ library provides no tools for working with HTTP protocol. Therefore, when we want to run some REST service, parse a webpage or write a simple bot or web crawler, we always wonder which library is better and faster in use. Sometimes a project already uses some framework (or even several). But how do we create an HTTP request using available facilities? Not to get confused each time performing such tasks, I decided to make a cheat sheet with examples of HTTP requests in C++ using different libraries. I guess Kukuruku is the best place for keeping such cheat sheets.
We’re going to take a look at the following libraries:
WinInet
WinHttp
Casablanca
Qt
POCO
wxWidgets
Boost.Asio
libcurl
neon
.NET (С++/CLI)
IXMLHTTPRequest
HappyHttp
cpp-netlib
Website: http://msdn.microsoft.com/en-us/library/windows/desktop/aa385483(v=vs.85).aspx
Platform: Windows 95 and later
Example
Website: http://msdn.microsoft.com/en-us/library/windows/desktop/aa382925(v=vs.85).aspx
Platform: Windows 2000 and later
Example
Website: https://casablanca.codeplex.com
Platform: all
Example
Website: http://qt-project.org
Platform: all
Example use for Qt 4.x (already outdated)
Example use for Qt 5.x
Website: http://pocoproject.org
Platform: all
Example
Website: http://www.wxwidgets.org
Platform: all
Example
Website: http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio.html
Platform: all
Example
Website: http://curl.haxx.se/libcurl
Platform: all
Example
Website: http://www.webdav.org/neon
Platform: all
Example
Website: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx
Platform: Windows XP and later
Example
Website: http://msdn.microsoft.com/en-us/library/ms759148(v=vs.85).aspx
Platform: Windows XP and later
Example
Website: http://scumways.com/happyhttp/happyhttp.html
Platform: all
Example
Website: http://cpp-netlib.org
Platform: all
Example
If you want to use the trusted classics – use libcurl. If you’re writing an application with a visual interface – use Qt. For those writing in С++11, Casablanca is the best choice. If you’re writing under .NET, then you should use standard platform facilities. But if you’re writing something with no interface and besides an HTTP client you want to have various handy tools as well, use Boost or POCO.
A Cheat Sheet for HTTP Libraries in C++
标签:
原文地址:http://my.oschina.net/wxfvm/blog/374158