NetServices: implement hostname resolution and connection for BHttpRequest

BHttpSession::Execute() moves the request into the session, and returns a future BHttpResponse
object. Currently implemented are resolving the hostname, and opening the connection.

There is some scaffolding for the actual data transfer.

Change-Id: I5a8a7a7f8680036b91cdba4beee140bbed6bfd5a
This commit is contained in:
Niels Sascha Reedijk
2022-03-24 06:13:38 +00:00
parent 3b2aa6c31b
commit 3b172a3dc6
11 changed files with 421 additions and 24 deletions
+30
View File
@@ -13,6 +13,16 @@
#if __cplusplus >= 201703L
/*!
\file HttpSession.h
\ingroup netservices
\brief Provides classes and tools to schedule and execute HTTP requests.
\since Haiku R1
*/
namespace BPrivate {
namespace Network {
@@ -153,6 +163,26 @@ namespace Network {
*/
/*!
\fn BHttpResult BHttpSession::Execute(BHttpRequest &&request,
std::unique_ptr< BDataIO > target=nullptr, BMessenger observer=BMessenger())
\brief Schedule and execute a \a request.
\param request The (valid) request to move from.
\param target An optional data buffer to write the incoming body of the request to. This can be
\c nullptr if you want to use the default internal storage. If you provide a buffer, it
must be wrapped in a \c std::unique_ptr. This means that you transfer ownership to the
session. After the request is finished, you can regain ownership.
\param observer An optional observer that will receive the progress and status messages for
this request.
\return The \ref BHttpResult object that corresponds to this request, and that can be used to
monitor the progress.
\since Haiku R1
*/
} // namespace Network
} // namespace BPrivate