Skip to content

Commit 94f20b9

Browse files
committed
Merge pull request cpp-netlib#434 from deanberris/0.11-devel-docfix-https-refinement
0.11 devel docfix https refinement
2 parents 01743e2 + 0746859 commit 94f20b9

File tree

14 files changed

+97
-67
lines changed

14 files changed

+97
-67
lines changed

libs/network/doc/getting_started.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ additional parameters::
133133

134134
If you intend to use the SSL support when using the HTTP client libraries in
135135
: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::
136+
available to CMake. If you have the development headers for OpenSSL_ installed
137+
on your system when you build :mod:`cpp-netlib`, CMake will be able to detect it
138+
and set the ``BOOST_NETWORK_ENABLE_HTTPS`` macro when building the library to
139+
support HTTPS URIs.
140+
141+
One example for building the library with OpenSSL_ support with a custom
142+
(non-installed) version of OpenSSL_ is by doing the following::
138143

139144
$ cmake -DCMAKE_BUILD_TYPE=Debug \
140145
> -DCMAKE_C_COMPILER=clang \

libs/network/doc/html/_sources/getting_started.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ additional parameters::
133133

134134
If you intend to use the SSL support when using the HTTP client libraries in
135135
: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::
136+
available to CMake. If you have the development headers for OpenSSL_ installed
137+
on your system when you build :mod:`cpp-netlib`, CMake will be able to detect it
138+
and set the ``BOOST_NETWORK_ENABLE_HTTPS`` macro when building the library to
139+
support HTTPS URIs.
140+
141+
One example for building the library with OpenSSL_ support with a custom
142+
(non-installed) version of OpenSSL_ is by doing the following::
138143

139144
$ cmake -DCMAKE_BUILD_TYPE=Debug \
140145
> -DCMAKE_C_COMPILER=clang \

libs/network/doc/html/_sources/reference/http_client.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,19 @@ only in the following situations:
3939
code.** It is best to define this either at compile-time of all code using
4040
the library, or before including any of the client headers.
4141

42-
.. _OpenSSL: http://www.openssl.org/
42+
To use the client implementations that support HTTPS URIs, you may explicitly
43+
do the following:
44+
45+
.. code-block:: c++
4346

47+
#define BOOST_NETWORK_ENABLE_HTTPS
48+
#include <boost/network/include/http/client.hpp>
49+
50+
This forces HTTPS support to be enabled and forces a dependency on OpenSSL_.
51+
This dependency is imposed by `Boost.Asio`_
52+
53+
.. _OpenSSL: http://www.openssl.org/
54+
.. _`Boost.Asio`: http://www.boost.org/libs/asio
4455

4556
Implementations
4657
---------------

libs/network/doc/html/_sources/reference/http_server.txt

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,8 @@ And that the following typedef's have been put in place:
156156
typedef boost::network::http::server<handler_type> http_server;
157157

158158
struct handler_type {
159-
void operator()(
160-
http_server::request const & request,
161-
http_server::response & response
162-
) {
159+
void operator()(http_server::request const & request,
160+
http_server::response & response) {
163161
// do something here
164162
}
165163
};
@@ -227,13 +225,12 @@ To use the above supported named parameters, you'll have code that looks like th
227225

228226
using namespace boost::network::http; // parameters are in this namespace
229227
handler handler_instance;
230-
async_server<handler>::options options(handler_instance);
228+
sync_server<handler>::options options(handler_instance);
231229
options.address("0.0.0.0")
232230
.port("80")
233231
.io_service(boost::make_shared<boost::asio::io_service>())
234-
.thread_pool(boost::make_shared<boost::network::utils::thread_pool>(2))
235232
.reuse_address(true);
236-
async_server<handler> instance(options);
233+
sync_server<handler> instance(options);
237234
instance.run();
238235

239236
Public Members
@@ -391,10 +388,8 @@ And that the following typedef's have been put in place:
391388
typedef boost::network::http::server<handler_type> http_server;
392389

393390
struct handler_type {
394-
void operator()(
395-
http_server::request const & request,
396-
http_server::connection_ptr connection
397-
) {
391+
void operator()(http_server::request const & request,
392+
http_server::connection_ptr connection) {
398393
// do something here
399394
}
400395
};
@@ -537,31 +532,28 @@ used are defined in the link.
537532

538533
.. code-block:: c++
539534

540-
// Initialize SSL context
541-
boost::shared_ptr<boost::asio::ssl::context> ctx = boost::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::sslv23);
542-
ctx->set_options(
535+
// Initialize SSL context
536+
boost::shared_ptr<boost::asio::ssl::context> ctx = boost::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::sslv23);
537+
ctx->set_options(
543538
boost::asio::ssl::context::default_workarounds
544539
| boost::asio::ssl::context::no_sslv2
545540
| boost::asio::ssl::context::single_dh_use);
546-
547-
// Set keys
548-
ctx->set_password_callback(password_callback);
549-
ctx->use_certificate_chain_file("server.pem");
550-
ctx->use_private_key_file("server.pem", boost::asio::ssl::context::pem);
551-
ctx->use_tmp_dh_file("dh512.pem");
552-
541+
542+
// Set keys
543+
ctx->set_password_callback(password_callback);
544+
ctx->use_certificate_chain_file("server.pem");
545+
ctx->use_private_key_file("server.pem", boost::asio::ssl::context::pem);
546+
ctx->use_tmp_dh_file("dh512.pem");
547+
553548
handler_type handler;
554549
http_server::options options(handler);
555550
options.thread_pool(boost::make_shared<boost::network::utils::thread_pool>(2));
556551
http_server server(options.address("127.0.0.1").port("8442").context(ctx));
557552

558-
559-
.. code-block:: c++
560-
561-
std::string password_callback(std::size_t max_length, boost::asio::ssl::context_base::password_purpose purpose) {
562-
return std::string("test");
563-
}
564-
553+
std::string password_callback(std::size_t max_length, boost::asio::ssl::context_base::password_purpose purpose) {
554+
return std::string("test");
555+
}
556+
565557
.. _Boost.Range: http://www.boost.org/libs/range
566558
.. _Boost.Function: http://www.boost.org/libs/function
567559
.. _Boost.Asio.SSL.Context: http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/ssl__context.html

libs/network/doc/html/contents.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ <h3>Navigation</h3>
282282
</div>
283283
<div class="footer">
284284
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
285-
Last updated on Sep 01, 2014.
285+
Last updated on Sep 02, 2014.
286286
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
287287
</div>
288288
</body>

libs/network/doc/html/getting_started.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,12 @@ <h2>Building with CMake<a class="headerlink" href="#building-with-cmake" title="
159159
</div>
160160
<p>If you intend to use the SSL support when using the HTTP client libraries in
161161
<tt class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></tt>, you may need to build it with <a class="reference external" href="http://www.openssl.org/">OpenSSL</a> installed or at least
162-
available to CMake. One example for building the library with <a class="reference external" href="http://www.openssl.org/">OpenSSL</a> support
163-
is by doing the following:</p>
162+
available to CMake. If you have the development headers for <a class="reference external" href="http://www.openssl.org/">OpenSSL</a> installed
163+
on your system when you build <tt class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></tt>, CMake will be able to detect it
164+
and set the <tt class="docutils literal"><span class="pre">BOOST_NETWORK_ENABLE_HTTPS</span></tt> macro when building the library to
165+
support HTTPS URIs.</p>
166+
<p>One example for building the library with <a class="reference external" href="http://www.openssl.org/">OpenSSL</a> support with a custom
167+
(non-installed) version of <a class="reference external" href="http://www.openssl.org/">OpenSSL</a> is by doing the following:</p>
164168
<div class="highlight-python"><div class="highlight"><pre>$ cmake -DCMAKE_BUILD_TYPE=Debug \
165169
&gt; -DCMAKE_C_COMPILER=clang \
166170
&gt; -DCMAKE_CXX_COMPILER=clang++ \
@@ -346,7 +350,7 @@ <h3>Navigation</h3>
346350
</div>
347351
<div class="footer">
348352
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
349-
Last updated on Sep 01, 2014.
353+
Last updated on Sep 02, 2014.
350354
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
351355
</div>
352356
</body>

libs/network/doc/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ <h3>Navigation</h3>
203203
</div>
204204
<div class="footer">
205205
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
206-
Last updated on Sep 01, 2014.
206+
Last updated on Sep 02, 2014.
207207
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
208208
</div>
209209
</body>

libs/network/doc/html/objects.inv

-4 Bytes
Binary file not shown.

libs/network/doc/html/reference.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ <h3>Navigation</h3>
135135
</div>
136136
<div class="footer">
137137
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
138-
Last updated on Sep 01, 2014.
138+
Last updated on Sep 02, 2014.
139139
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
140140
</div>
141141
</body>

libs/network/doc/html/reference/http_client.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ <h2>Features<a class="headerlink" href="#features" title="Permalink to this head
9494
the library, or before including any of the client headers.</li>
9595
</ul>
9696
</div></blockquote>
97+
<p>To use the client implementations that support HTTPS URIs, you may explicitly
98+
do the following:</p>
99+
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#define BOOST_NETWORK_ENABLE_HTTPS</span>
100+
<span class="cp">#include &lt;boost/network/include/http/client.hpp&gt;</span>
101+
</pre></div>
102+
</div>
103+
<p>This forces HTTPS support to be enabled and forces a dependency on <a class="reference external" href="http://www.openssl.org/">OpenSSL</a>.
104+
This dependency is imposed by <a class="reference external" href="http://www.boost.org/libs/asio">Boost.Asio</a></p>
97105
</div>
98106
<div class="section" id="implementations">
99107
<h2>Implementations<a class="headerlink" href="#implementations" title="Permalink to this headline"></a></h2>
@@ -652,7 +660,7 @@ <h3>Navigation</h3>
652660
</div>
653661
<div class="footer">
654662
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
655-
Last updated on Sep 01, 2014.
663+
Last updated on Sep 02, 2014.
656664
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
657665
</div>
658666
</body>

0 commit comments

Comments
 (0)