Skip to content

Commit 431b31f

Browse files
committed
HTTPS Client Feature Documentation
These are the source-level changes to document the HTTPS support in the client. This is useful in explicitly spelling out how to build the client libraries to support HTTPS URIs in the client.
1 parent bd0cf0b commit 431b31f

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

libs/network/doc/getting_started.rst

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ the ``~/cpp-netlib`` directory exists, and is the top-level directory of the
114114
Building with CMake
115115
===================
116116

117-
To build the tests that come with cpp-netlib, we first need to configure the
117+
To build the tests that come with :mod:`cpp-netlib`, we first need to configure the
118118
build system to use our compiler of choice. This is done by running the
119119
``cmake`` command at the top-level directory of :mod:`cpp-netlib` with
120120
additional parameters::
@@ -131,6 +131,31 @@ additional parameters::
131131
For the purposes of documentation, we'll assume that all
132132
builds are done in ``~/cpp-netlib-build``.
133133

134+
If you intend to use the SSL support when using the HTTP client libraries in
135+
:mod:`cpp-netlib`, you may need to build it with OpenSSL_ installed or at least
136+
available to CMake. One example for building the library with OpenSSL_ support
137+
is by doing the following::
138+
139+
$ cmake -DCMAKE_BUILD_TYPE=Debug \
140+
> -DCMAKE_C_COMPILER=clang \
141+
> -DCMAKE_CXX_COMPILER=clang++ \
142+
> -DOPENSSL_ROOT_DIR=/Users/dberris/homebrew/Cellar/openssl/1.0.1f
143+
> ../cpp-netlib
144+
145+
.. _OpenSSL: http://www.openssl.org/
146+
147+
You can also use a different root directory for the Boost_ project by using the
148+
``-DBOOST_ROOT`` configuration option to CMake. This is useful if you intend to
149+
build the library with a specific version of Boost that you've built in a
150+
separate directory::
151+
152+
$ cmake -DCMAKE_BUILD_TYPE=Debug \
153+
> -DCMAKE_C_COMPILER=clang \
154+
> -DCMAKE_CXX_COMPILER=clang++ \
155+
> -DOPENSSL_ROOT_DIR=/Users/dberris/homebrew/Cellar/openssl/1.0.1f \
156+
> -DBOOST_ROOT=/Users/dberris/Source/boost_1_55_0
157+
> ../cpp-netlib
158+
134159
Building on Linux
135160
~~~~~~~~~~~~~~~~~
136161

@@ -178,8 +203,8 @@ Building On Windows
178203
~~~~~~~~~~~~~~~~~~~
179204

180205
If you're using the Microsoft Visual C++ compiler or the Microsoft Visual Studio
181-
IDE and you would like to build cpp-netlib from within Visual Studio, you can
182-
look for the solution and project files as the artifacts of the call to
206+
IDE and you would like to build :mod:`cpp-netlib` from within Visual Studio, you
207+
can look for the solution and project files as the artifacts of the call to
183208
``cmake`` -- the file should be named ``CPP-NETLIB.sln`` (the solution) along
184209
with a number of project files for Visual Studio.
185210

libs/network/doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
.. :Authors: Glyn Matthews <glyn.matthews@gmail.com>
55
.. Dean Michael Berris <dberris@google.com>
6-
.. :Date: 2013-12-21
6+
.. :Date: 2014-10-01
77
.. :Version: 0.11.0
88
.. :Description: Complete user documentation, with examples, for the :mod:`cpp-netlib`.
99
.. :Copyright: Copyright Glyn Matthews, Dean Michael Berris 2008-2013.

libs/network/doc/reference/http_client.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ asynchronous.
2525
As of 0.11 the `Synchronous Clients`_ are now *DEPRECATED* and will be removed
2626
in subsequent releases.
2727

28+
Features
29+
--------
30+
31+
The HTTP client implementation supports requesting secure HTTP (HTTPS) content
32+
only in the following situations:
33+
34+
* **Client libraries are built with ``BOOST_NETWORK_ENABLE_HTTPS``.** This
35+
tells the implementation to use HTTPS-specific code to handle HTTPS-based
36+
content when making connections associated with HTTPS URI's. This requires
37+
a dependency on OpenSSL_.
38+
* **The ``BOOST_NETWORK_ENABLE_HTTPS`` macro is set when compiling user
39+
code.** It is best to define this either at compile-time of all code using
40+
the library, or before including any of the client headers.
41+
42+
.. _OpenSSL: http://www.openssl.org/
43+
44+
2845
Implementations
2946
---------------
3047

@@ -126,6 +143,9 @@ operations on responses. In code, usage should look like the following:
126143

127144
A common mistake is to declare the client inside the try block which invokes
128145
undefined behavior when errors arise from the handling of response objects.
146+
Previous examples cited by the documentation showed the short version of the
147+
code which didn't bother moving the ``http::client`` object outside of the same
148+
``try`` block where the request/response objects are being used.
129149

130150
Member Functions
131151
----------------

0 commit comments

Comments
 (0)