Skip to content

Commit c8908c1

Browse files
committed
Add documentation for SSL support
1 parent a9e23a8 commit c8908c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+278
-125
lines changed

libs/network/doc/html/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: ae3dc7fdd27083cd0960e8fba1dd2084
3+
config: 247e8c3d216dc851efe8ee3a759ed678
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

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

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -168,40 +168,50 @@ initialization.
168168
Constructor taking a ``client_options<Tag>`` object. The following table
169169
shows the options you can set on a ``client_options<Tag>`` instance.
170170

171-
+---------------------+----------------------------+--------------------------+
172-
| Parameter Name | Type | Description |
173-
+=====================+============================+==========================+
174-
| follow_redirects | ``bool`` | Boolean to specify |
175-
| | | whether the client |
176-
| | | should follow HTTP |
177-
| | | redirects. Default is |
178-
| | | ``false``. |
179-
+---------------------+----------------------------+--------------------------+
180-
| cache_resolved | ``bool`` | Boolean to specify |
181-
| | | whether the client |
182-
| | | should cache resolved |
183-
| | | endpoints. The default |
184-
| | | is ``false``. |
185-
+---------------------+----------------------------+--------------------------+
186-
| io_service | ``shared_ptr<io_service>`` | Shared pointer to a |
187-
| | | Boost.Asio |
188-
| | | ``io_service``. |
189-
+---------------------+----------------------------+--------------------------+
190-
| openssl_certificate | ``string`` | The filename of the |
191-
| | | certificate to load for |
192-
| | | the SSL connection for |
193-
| | | verification. |
194-
+---------------------+----------------------------+--------------------------+
195-
| openssl_verify_path | ``string`` | The directory from |
196-
| | | which the certificate |
197-
| | | authority files are |
198-
| | | located. |
199-
+---------------------+----------------------------+--------------------------+
200-
| always_verify_peer | ``bool`` | Boolean to specify |
201-
| | | whether the client |
202-
| | | should always verify |
203-
| | | peers in SSL connections |
204-
+---------------------+----------------------------+--------------------------+
171+
+--------------------------+----------------------------+--------------------------+
172+
| Parameter Name | Type | Description |
173+
+==========================+============================+==========================+
174+
| follow_redirects | ``bool`` | Boolean to specify |
175+
| | | whether the client |
176+
| | | should follow HTTP |
177+
| | | redirects. Default is |
178+
| | | ``false``. |
179+
+--------------------------+----------------------------+--------------------------+
180+
| cache_resolved | ``bool`` | Boolean to specify |
181+
| | | whether the client |
182+
| | | should cache resolved |
183+
| | | endpoints. The default |
184+
| | | is ``false``. |
185+
+--------------------------+----------------------------+--------------------------+
186+
| io_service | ``shared_ptr<io_service>`` | Shared pointer to a |
187+
| | | Boost.Asio |
188+
| | | ``io_service``. |
189+
+--------------------------+----------------------------+--------------------------+
190+
| openssl_certificate | ``string`` | The filename of the |
191+
| | | certificate to load for |
192+
| | | the SSL connection for |
193+
| | | verification. |
194+
+--------------------------+----------------------------+--------------------------+
195+
| openssl_verify_path | ``string`` | The directory from |
196+
| | | which the certificate |
197+
| | | authority files are |
198+
| | | located. |
199+
+--------------------------+----------------------------+--------------------------+
200+
| always_verify_peer | ``bool`` | Boolean to specify |
201+
| | | whether the client |
202+
| | | should always verify |
203+
| | | peers in SSL connections |
204+
+--------------------------+----------------------------+--------------------------+
205+
| openssl_certificate_file | ``string`` | Filename of the |
206+
| | | certificate to use for |
207+
| | | client-side SSL session |
208+
| | | establishment. |
209+
+--------------------------+----------------------------+--------------------------+
210+
| openssl_private_key_file | ``string`` | Filename of the |
211+
| | | private key to use for |
212+
| | | client-side SSL session |
213+
| | | establishment. |
214+
+--------------------------+----------------------------+--------------------------+
205215

206216

207217
To use the above supported named parameters, you'll have code that looks like

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ Constructor
217217
| linger_timeout | ``int`` | An optional int to define the timeout to wait for socket closes before it is set to linger. |
218218
| | | The default is ``0``. |
219219
+-----------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
220+
| context | ``shared_ptr<context>`` | An optional shared pointer to an instance of ``boost::asio::ssl::context`` -- this contains the |
221+
| | | settings needed to support SSL. This parameter is only applicable for ``async_server`` instances.|
222+
+-----------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
220223

221224
To use the above supported named parameters, you'll have code that looks like the following:
222225

@@ -524,6 +527,39 @@ primary means for reading from and writing to the connection.
524527
The function throws an instance of ``std::logic_error`` if you try to set
525528
the headers for a connection more than once.
526529

530+
Adding SSL support to Asynchronous Server
531+
-----------------------------------------
532+
533+
In order to setup SSL support for an Asynchronous Server, it is best to start from
534+
a regular Asynchronous Server (see above). Once this server is setup, SSL can be
535+
enabled by adding a Boost.Asio.Ssl.Context_ to the options. The settings that can be
536+
used are defined in the link.
537+
538+
.. code-block:: c++
539+
540+
boost::shared_ptr<boost::asio::ssl::context> ctx = boost::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::sslv23);
541+
ctx->set_options(
542+
boost::asio::ssl::context::default_workarounds
543+
| boost::asio::ssl::context::no_sslv2
544+
| boost::asio::ssl::context::single_dh_use);
545+
context_.set_password_callback(boost::bind(&server::get_password, this));
546+
context_.use_certificate_chain_file("server.pem");
547+
context_.use_private_key_file("server.pem", boost::asio::ssl::context::pem);
548+
context_.use_tmp_dh_file("dh512.pem");
549+
550+
handler_type handler;
551+
http_server::options options(handler);
552+
options.thread_pool(boost::make_shared<boost::network::utils::thread_pool>(2));
553+
http_server server(options.address("127.0.0.1").port("8000").context(ctx));
554+
555+
556+
.. code-block:: c++
527557

558+
std::string get_password() const
559+
{
560+
return "test";
561+
}
562+
528563
.. _Boost.Range: http://www.boost.org/libs/range
529564
.. _Boost.Function: http://www.boost.org/libs/function
565+
.. _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/_sources/whats_new.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ v0.11.0
2727
``cpp-netlib-utils_base64_test`` still fails in this platform. (`#287`_)
2828
* Provide a client option to always validate peers for HTTPS requests made by
2929
the client. (`#349`_)
30+
* Back-port fix for `#163`_ for improved URI parsing.
31+
* Added support for client-side certificates and private keys (`#361`_).
3032

3133
.. _`#129`: https://github.com/cpp-netlib/cpp-netlib/issues/129
34+
.. _`#163`: https://github.com/cpp-netlib/cpp-netlib/issues/163
3235
.. _`#245`: https://github.com/cpp-netlib/cpp-netlib/issues/245
3336
.. _`#277`: https://github.com/cpp-netlib/cpp-netlib/issues/277
3437
.. _`#279`: https://github.com/cpp-netlib/cpp-netlib/issues/279
@@ -40,6 +43,7 @@ v0.11.0
4043
.. _`#349`: https://github.com/cpp-netlib/cpp-netlib/issues/349
4144
.. _`#69`: https://github.com/cpp-netlib/cpp-netlib/issues/69
4245
.. _`#86`: https://github.com/cpp-netlib/cpp-netlib/issues/86
46+
.. _`#361`: https://github.com/cpp-netlib/cpp-netlib/pull/361
4347

4448
:mod:`cpp-netlib` 0.10
4549
----------------------

libs/network/doc/html/_static/basic.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx stylesheet -- basic theme.
66
*
7-
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/
@@ -89,6 +89,7 @@ div.sphinxsidebar #searchbox input[type="submit"] {
8989

9090
img {
9191
border: 0;
92+
max-width: 100%;
9293
}
9394

9495
/* -- search page ----------------------------------------------------------- */

libs/network/doc/html/_static/doctools.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx JavaScript utilities for all documentation.
66
*
7-
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/
@@ -168,6 +168,9 @@ var Documentation = {
168168
var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
169169
if (terms.length) {
170170
var body = $('div.body');
171+
if (!body.length) {
172+
body = $('body');
173+
}
171174
window.setTimeout(function() {
172175
$.each(terms, function() {
173176
body.highlightText(this.toLowerCase(), 'highlighted');

libs/network/doc/html/_static/epub.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx stylesheet -- default theme.
66
*
7-
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/

libs/network/doc/html/_static/pyramid.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx stylesheet -- pylons theme.
66
*
7-
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/

libs/network/doc/html/_static/searchtools.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx JavaScript utilties for the full-text search.
66
*
7-
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/
@@ -330,13 +330,13 @@ var Search = {
330330
objectterms.push(tmp[i].toLowerCase());
331331
}
332332

333-
if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
333+
if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
334334
tmp[i] === "") {
335335
// skip this "word"
336336
continue;
337337
}
338338
// stem the word
339-
var word = stemmer.stemWord(tmp[i]).toLowerCase();
339+
var word = stemmer.stemWord(tmp[i].toLowerCase());
340340
var toAppend;
341341
// select the correct list
342342
if (word[0] == '-') {

libs/network/doc/html/_static/websupport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* sphinx.websupport utilties for all documentation.
66
*
7-
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/

0 commit comments

Comments
 (0)