HTTP clients constitute important class of distributed software and are represented by many applications. Web browsers are prominent representatives of this class. They use HTTP protocols to request web pages from web servers. However, today HTTP protocol is used not only in the web. Many distributed applications use this protocol to exchange custom data of any kind. Often, when designing a distributed application, choosing HTTP as a communication protocol is a much better idea than developing custom one.
In this recipe, we will consider an implementation of HTTP client using Boost.Asio that satisfies the following basic requirements:
Supports the HTTP
GET
request methodExecutes requests asynchronously
Supports request canceling
Let's move on to the implementation.