Skip to content

Commit 1e075a1

Browse files
committed
Merge pull request cpp-netlib#369 from deanberris/0.11-devel-backport-163-patch
Backport fix for cpp-netlib#163 into 0.11.0
2 parents 8c28ccc + 2ed0ff8 commit 1e075a1

File tree

5 files changed

+415
-363
lines changed

5 files changed

+415
-363
lines changed

boost/network/uri/accessors.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ struct key_value_sequence
3434
{
3535
query = pair >> *((spirit::qi::lit(';') | '&') >> pair);
3636
pair = key >> -('=' >> value);
37-
key = spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("a-zA-Z_0-9/%");
38-
value = +spirit::qi::char_("a-zA-Z_0-9/%");
37+
key = spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("-+.~a-zA-Z_0-9/%");
38+
value = +spirit::qi::char_("-+.~a-zA-Z_0-9/%");
3939
}
4040

4141
spirit::qi::rule<uri::const_iterator, Map()> query;

boost/network/uri/decode.hpp

Lines changed: 45 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,21 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
76
#ifndef __BOOST_NETWORK_URI_DECODE_INC__
8-
# define __BOOST_NETWORK_URI_DECODE_INC__
9-
10-
11-
# include <boost/iterator/iterator_traits.hpp>
12-
# include <boost/range/begin.hpp>
13-
# include <boost/range/end.hpp>
14-
# include <cassert>
7+
#define __BOOST_NETWORK_URI_DECODE_INC__
158

9+
#include <boost/iterator/iterator_traits.hpp>
10+
#include <boost/range/begin.hpp>
11+
#include <boost/range/end.hpp>
12+
#include <cassert>
1613

1714
namespace boost {
1815
namespace network {
1916
namespace uri {
2017
namespace detail {
21-
template <
22-
typename CharT
23-
>
24-
CharT letter_to_hex(CharT in)
25-
{
26-
switch (in)
27-
{
18+
template <typename CharT>
19+
CharT letter_to_hex(CharT in) {
20+
switch (in) {
2821
case '0':
2922
case '1':
3023
case '2':
@@ -35,74 +28,65 @@ CharT letter_to_hex(CharT in)
3528
case '7':
3629
case '8':
3730
case '9':
38-
return in - '0';
31+
return in - '0';
3932
case 'a':
4033
case 'b':
4134
case 'c':
4235
case 'd':
4336
case 'e':
4437
case 'f':
45-
return in + 10 - 'a';
38+
return in + 10 - 'a';
4639
case 'A':
4740
case 'B':
4841
case 'C':
4942
case 'D':
5043
case 'E':
5144
case 'F':
52-
return in + 10 - 'A';
53-
}
54-
return CharT();
45+
return in + 10 - 'A';
46+
}
47+
return CharT();
5548
}
56-
} // namespace detail
49+
} // namespace detail
5750

58-
template <
59-
class InputIterator,
60-
class OutputIterator
61-
>
51+
template <class InputIterator, class OutputIterator>
6252
OutputIterator decode(const InputIterator &in_begin,
6353
const InputIterator &in_end,
6454
const OutputIterator &out_begin) {
65-
typedef typename boost::iterator_value<InputIterator>::type value_type;
55+
typedef typename boost::iterator_value<InputIterator>::type value_type;
6656

67-
InputIterator it = in_begin;
68-
OutputIterator out = out_begin;
69-
while (it != in_end) {
70-
if (*it == '%')
71-
{
72-
++it;
73-
value_type v0 = detail::letter_to_hex(*it);
74-
++it;
75-
value_type v1 = detail::letter_to_hex(*it);
76-
++it;
77-
*out++ = 0x10 * v0 + v1;
78-
}
79-
else
80-
{
81-
*out++ = *it++;
82-
}
57+
InputIterator it = in_begin;
58+
OutputIterator out = out_begin;
59+
while (it != in_end) {
60+
if (*it == '%') {
61+
++it;
62+
value_type v0 = detail::letter_to_hex(*it);
63+
++it;
64+
value_type v1 = detail::letter_to_hex(*it);
65+
++it;
66+
*out++ = 0x10 * v0 + v1;
67+
} else if (*it == '+') {
68+
*out++ = ' ';
69+
++it;
70+
} else {
71+
*out++ = *it++;
8372
}
84-
return out;
73+
}
74+
return out;
8575
}
8676

87-
template <
88-
class SinglePassRange,
89-
class OutputIterator
90-
>
91-
inline
92-
OutputIterator decode(const SinglePassRange &range,
93-
const OutputIterator &out) {
94-
return decode(boost::begin(range), boost::end(range), out);
77+
template <class SinglePassRange, class OutputIterator>
78+
inline OutputIterator decode(const SinglePassRange &range,
79+
const OutputIterator &out) {
80+
return decode(boost::begin(range), boost::end(range), out);
9581
}
9682

97-
inline
98-
std::string decoded(const std::string &input) {
99-
std::string decoded;
100-
decode(input, std::back_inserter(decoded));
101-
return decoded;
83+
inline std::string decoded(const std::string &input) {
84+
std::string decoded;
85+
decode(input, std::back_inserter(decoded));
86+
return decoded;
10287
}
103-
} // namespace uri
104-
} // namespace network
105-
} // namespace boost
106-
88+
} // namespace uri
89+
} // namespace network
90+
} // namespace boost
10791

108-
#endif // __BOOST_NETWORK_URI_DECODE_INC__
92+
#endif // __BOOST_NETWORK_URI_DECODE_INC__

libs/network/doc/reference/http_client.rst

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/whats_new.rst

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
----------------------

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy