首页 > 代码库 > A Cheat Sheet for HTTP Libraries in C++
A Cheat Sheet for HTTP Libraries in C++
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
WinInet
Website: http://msdn.microsoft.com/en-us/library/windows/desktop/aa385483(v=vs.85).aspx
Platform: Windows 95 and later
Example
WinHttp
Website: http://msdn.microsoft.com/en-us/library/windows/desktop/aa382925(v=vs.85).aspx
Platform: Windows 2000 and later
Example
Casablanca
Website: https://casablanca.codeplex.com
Platform: all
Example
Qt
Website: http://qt-project.org
Platform: all
Example use for Qt 4.x (already outdated)
Example use for Qt 5.x
POCO
Website: http://pocoproject.org
Platform: all
Example
wxWidgets
Website: http://www.wxwidgets.org
Platform: all
Example
Boost.Asio
Website: http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio.html
Platform: all
Example
libcurl
Website: http://curl.haxx.se/libcurl
Platform: all
Example
neon
Website: http://www.webdav.org/neon
Platform: all
Example
.NET
Website: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx
Platform: Windows XP and later
Example
IXMLHTTPRequest
Website: http://msdn.microsoft.com/en-us/library/ms759148(v=vs.85).aspx
Platform: Windows XP and later
Example
HappyHttp
Website: http://scumways.com/happyhttp/happyhttp.html
Platform: all
Example
cpp-netlib
Website: http://cpp-netlib.org
Platform: all
Example
It’s High Time to Find Out the Perfect One!
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++