Many commonly-used internet protocols are line-based, which means that
they have protocol elements that are delimited by the character sequence
"\r\n". Examples
include HTTP, SMTP and FTP. To more easily permit the implementation of
line-based protocols, as well as other protocols that use delimiters, Boost.Asio
includes the functions read_until() and async_read_until().

The following example illustrates the use of async_read_until() in an HTTP server, to receive the first
line of an HTTP request from a client:

The streambuf data member
serves as a place to store the data that has been read from the socket
before it is searched for the delimiter. It is important to remember that
there may be additional data after the delimiter.
This surplus data should be left in the streambuf
so that it may be inspected by a subsequent call to read_until() or async_read_until().

The delimiters may be specified as a single char,
a std::string or a boost::regex.
The read_until()
and async_read_until()
functions also include overloads that accept a user-defined function object
called a match condition. For example, to read data into a streambuf until
whitespace is encountered:

The is_match_condition<> type trait automatically evaluates
to true for functions, and for function objects with a nested result_type typedef. For other types
the trait must be explicitly specialised, as shown above.