Skip to content

Commit 466600d

Browse files
committed
Documentation updates on HTTP client
Fixes #116 for 0.11.1.
1 parent 25e7a38 commit 466600d

File tree

12 files changed

+88
-19
lines changed

12 files changed

+88
-19
lines changed

libs/network/doc/examples/http/hello_world_client.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ perform the request via HTTP:
8787
http::client client;
8888
http::client::request request("http://my.webservice.com/");
8989
http::client::response =
90-
client.post(request, "application/xml", some_xml_string);
90+
client.post(request, some_xml_string, "application/xml");
9191
std::data = body(response);
9292

9393
The next set of examples show some more practical applications using

libs/network/doc/html/_sources/examples/http/hello_world_client.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ perform the request via HTTP:
8787
http::client client;
8888
http::client::request request("http://my.webservice.com/");
8989
http::client::response =
90-
client.post(request, "application/xml", some_xml_string);
90+
client.post(request, some_xml_string, "application/xml");
9191
std::data = body(response);
9292

9393
The next set of examples show some more practical applications using

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

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ behave as a fully synchronous client.
7171

7272
The synchronous client implements all the operations of the client underneath
7373
the interface all block to wait for I/O to finish. All the member methods are
74-
synchronous and will block until the response object is ready or throws if erros
74+
synchronous and will block until the response object is ready or throws if errors
7575
are encountered in the performance of the HTTP requests.
7676

7777
.. warning:: The synchronous clients are **NOT** thread safe. You will need to do
@@ -137,7 +137,7 @@ In this section we assume that the following typedef is in effect:
137137
typedef boost::network::http::basic_client<
138138
boost::network::http::tags::http_default_8bit_udp_resolve
139139
, 1
140-
,1
140+
, 1
141141
>
142142
client;
143143

@@ -290,6 +290,17 @@ and that there is an appropriately constructed response object named
290290
body chunks be handled by the ``callback`` parameter. The signature of
291291
``callback`` should be the following: ``void(iterator_range<char const *> const
292292
&, boost::system::error_code const &)``.
293+
``response_ = client_.post(request_, body, content_type, callback, streaming_callback)``
294+
The body and content_type parameters are of type
295+
``boost::network::string<Tag>::type`` where ``Tag`` is the HTTP Client's
296+
``Tag``. This uses the request object's other headers. Have the response
297+
body chunks be handled by the ``callback`` parameter. The signature of
298+
``callback`` should be the following: ``void(iterator_range<char const *> const
299+
&, boost::system::error_code const &)``. The ``streaming_callback``
300+
argument should have a which has a signature of the form:
301+
``bool(string_type&)``. The provided ``string_type&`` will be streamed as
302+
soon as the function returns. A return value of ``false`` signals the
303+
client that the most recent invocation is the last chunk to be sent.
293304
``response_ = client_.post(request_, streaming_callback)``
294305
Perform and HTTP POST request, and have the request's body chunks be
295306
generated by the ``streaming_callback`` which has a signature of the form:
@@ -329,13 +340,25 @@ and that there is an appropriately constructed response object named
329340
The body and content_type parameters are of type
330341
``boost::network::string<Tag>::type`` where ``Tag`` is the HTTP Client's
331342
``Tag``. This uses the request object's other headers.
332-
``response_ = client_.put(request_, body, content_type, body_handler=callback)``
343+
``response_ = client_.put(request_, body, content_type, callback)``
333344
The body and content_type parameters are of type
334345
``boost::network::string<Tag>::type`` where ``Tag`` is the HTTP Client's
335346
``Tag``. This uses the request object's other headers. Have the response
336347
body chunks be handled by the ``callback`` parameter. The signature of
337348
``callback`` should be the following: ``void(iterator_range<char const *> const
338349
&, boost::system::error_code const &)``.
350+
``response_ = client_.put(request_, body, content_type, callback, streaming_callback)``
351+
The body and content_type parameters are of type
352+
``boost::network::string<Tag>::type`` where ``Tag`` is the HTTP Client's
353+
``Tag``. This uses the request object's other headers. Have the response
354+
body chunks be handled by the ``callback`` parameter. The signature of
355+
``callback`` should be the following: ``void(iterator_range<char const *> const
356+
&, boost::system::error_code const &)``. This form also has the request's body
357+
chunks be generated by the ``streaming_callback`` which has a signature of
358+
the form: ``bool(string_type&)``. The provided ``string_type&`` will be
359+
streamed as soon as the function returns. A return value of ``false``
360+
signals the client that the most recent invocation is the last chunk to be
361+
sent
339362
``response_ = client_.put(request_, streaming_callback)``
340363
Perform and HTTP PUT request, and have the request's body chunks be
341364
generated by the ``streaming_callback`` which has a signature of the form:

libs/network/doc/html/contents.html

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

libs/network/doc/html/examples.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h3>Navigation</h3>
129129
</div>
130130
<div class="footer">
131131
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
132-
Last updated on Aug 12, 2014.
132+
Last updated on Aug 27, 2014.
133133
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
134134
</div>
135135
</body>

libs/network/doc/html/examples/http/hello_world_client.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h2>Diving into the code<a class="headerlink" href="#diving-into-the-code" title
129129
<div class="highlight-c++"><div class="highlight"><pre><span class="n">http</span><span class="o">::</span><span class="n">client</span> <span class="n">client</span><span class="p">;</span>
130130
<span class="n">http</span><span class="o">::</span><span class="n">client</span><span class="o">::</span><span class="n">request</span> <span class="n">request</span><span class="p">(</span><span class="s">&quot;http://my.webservice.com/&quot;</span><span class="p">);</span>
131131
<span class="n">http</span><span class="o">::</span><span class="n">client</span><span class="o">::</span><span class="n">response</span> <span class="o">=</span>
132-
<span class="n">client</span><span class="p">.</span><span class="n">post</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="s">&quot;application/xml&quot;</span><span class="p">,</span> <span class="n">some_xml_string</span><span class="p">);</span>
132+
<span class="n">client</span><span class="p">.</span><span class="n">post</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">some_xml_string</span><span class="p">,</span> <span class="s">&quot;application/xml&quot;</span><span class="p">);</span>
133133
<span class="n">std</span><span class="o">::</span><span class="n">data</span> <span class="o">=</span> <span class="n">body</span><span class="p">(</span><span class="n">response</span><span class="p">);</span>
134134
</pre></div>
135135
</div>
@@ -192,7 +192,7 @@ <h3>Navigation</h3>
192192
</div>
193193
<div class="footer">
194194
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
195-
Last updated on Aug 12, 2014.
195+
Last updated on Aug 27, 2014.
196196
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
197197
</div>
198198
</body>

libs/network/doc/html/objects.inv

-3 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
@@ -134,7 +134,7 @@ <h3>Navigation</h3>
134134
</div>
135135
<div class="footer">
136136
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
137-
Last updated on Aug 12, 2014.
137+
Last updated on Aug 27, 2014.
138138
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
139139
</div>
140140
</body>

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

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ <h3>Synchronous Clients<a class="headerlink" href="#synchronous-clients" title="
174174
</div></blockquote>
175175
<p>The synchronous client implements all the operations of the client underneath
176176
the interface all block to wait for I/O to finish. All the member methods are
177-
synchronous and will block until the response object is ready or throws if erros
177+
synchronous and will block until the response object is ready or throws if errors
178178
are encountered in the performance of the HTTP requests.</p>
179179
<div class="admonition warning">
180180
<p class="first admonition-title">Warning</p>
@@ -237,7 +237,7 @@ <h2>Member Functions<a class="headerlink" href="#member-functions" title="Permal
237237
<div class="highlight-c++"><div class="highlight"><pre><span class="k">typedef</span> <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">basic_client</span><span class="o">&lt;</span>
238238
<span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">tags</span><span class="o">::</span><span class="n">http_default_8bit_udp_resolve</span>
239239
<span class="p">,</span> <span class="mi">1</span>
240-
<span class="p">,</span><span class="mi">1</span>
240+
<span class="p">,</span> <span class="mi">1</span>
241241
<span class="o">&gt;</span>
242242
<span class="n">client</span><span class="p">;</span>
243243
</pre></div>
@@ -417,6 +417,17 @@ <h3>HTTP Methods<a class="headerlink" href="#http-methods" title="Permalink to t
417417
body chunks be handled by the <tt class="docutils literal"><span class="pre">callback</span></tt> parameter. The signature of
418418
<tt class="docutils literal"><span class="pre">callback</span></tt> should be the following: <tt class="docutils literal"><span class="pre">void(iterator_range&lt;char</span> <span class="pre">const</span> <span class="pre">*&gt;</span> <span class="pre">const</span>
419419
<span class="pre">&amp;,</span> <span class="pre">boost::system::error_code</span> <span class="pre">const</span> <span class="pre">&amp;)</span></tt>.</dd>
420+
<dt><tt class="docutils literal"><span class="pre">response_</span> <span class="pre">=</span> <span class="pre">client_.post(request_,</span> <span class="pre">body,</span> <span class="pre">content_type,</span> <span class="pre">callback,</span> <span class="pre">streaming_callback)</span></tt></dt>
421+
<dd>The body and content_type parameters are of type
422+
<tt class="docutils literal"><span class="pre">boost::network::string&lt;Tag&gt;::type</span></tt> where <tt class="docutils literal"><span class="pre">Tag</span></tt> is the HTTP Client&#8217;s
423+
<tt class="docutils literal"><span class="pre">Tag</span></tt>. This uses the request object&#8217;s other headers. Have the response
424+
body chunks be handled by the <tt class="docutils literal"><span class="pre">callback</span></tt> parameter. The signature of
425+
<tt class="docutils literal"><span class="pre">callback</span></tt> should be the following: <tt class="docutils literal"><span class="pre">void(iterator_range&lt;char</span> <span class="pre">const</span> <span class="pre">*&gt;</span> <span class="pre">const</span>
426+
<span class="pre">&amp;,</span> <span class="pre">boost::system::error_code</span> <span class="pre">const</span> <span class="pre">&amp;)</span></tt>. The <tt class="docutils literal"><span class="pre">streaming_callback</span></tt>
427+
argument should have a which has a signature of the form:
428+
<tt class="docutils literal"><span class="pre">bool(string_type&amp;)</span></tt>. The provided <tt class="docutils literal"><span class="pre">string_type&amp;</span></tt> will be streamed as
429+
soon as the function returns. A return value of <tt class="docutils literal"><span class="pre">false</span></tt> signals the
430+
client that the most recent invocation is the last chunk to be sent.</dd>
420431
<dt><tt class="docutils literal"><span class="pre">response_</span> <span class="pre">=</span> <span class="pre">client_.post(request_,</span> <span class="pre">streaming_callback)</span></tt></dt>
421432
<dd>Perform and HTTP POST request, and have the request&#8217;s body chunks be
422433
generated by the <tt class="docutils literal"><span class="pre">streaming_callback</span></tt> which has a signature of the form:
@@ -456,13 +467,25 @@ <h3>HTTP Methods<a class="headerlink" href="#http-methods" title="Permalink to t
456467
<dd>The body and content_type parameters are of type
457468
<tt class="docutils literal"><span class="pre">boost::network::string&lt;Tag&gt;::type</span></tt> where <tt class="docutils literal"><span class="pre">Tag</span></tt> is the HTTP Client&#8217;s
458469
<tt class="docutils literal"><span class="pre">Tag</span></tt>. This uses the request object&#8217;s other headers.</dd>
459-
<dt><tt class="docutils literal"><span class="pre">response_</span> <span class="pre">=</span> <span class="pre">client_.put(request_,</span> <span class="pre">body,</span> <span class="pre">content_type,</span> <span class="pre">body_handler=callback)</span></tt></dt>
470+
<dt><tt class="docutils literal"><span class="pre">response_</span> <span class="pre">=</span> <span class="pre">client_.put(request_,</span> <span class="pre">body,</span> <span class="pre">content_type,</span> <span class="pre">callback)</span></tt></dt>
460471
<dd>The body and content_type parameters are of type
461472
<tt class="docutils literal"><span class="pre">boost::network::string&lt;Tag&gt;::type</span></tt> where <tt class="docutils literal"><span class="pre">Tag</span></tt> is the HTTP Client&#8217;s
462473
<tt class="docutils literal"><span class="pre">Tag</span></tt>. This uses the request object&#8217;s other headers. Have the response
463474
body chunks be handled by the <tt class="docutils literal"><span class="pre">callback</span></tt> parameter. The signature of
464475
<tt class="docutils literal"><span class="pre">callback</span></tt> should be the following: <tt class="docutils literal"><span class="pre">void(iterator_range&lt;char</span> <span class="pre">const</span> <span class="pre">*&gt;</span> <span class="pre">const</span>
465476
<span class="pre">&amp;,</span> <span class="pre">boost::system::error_code</span> <span class="pre">const</span> <span class="pre">&amp;)</span></tt>.</dd>
477+
<dt><tt class="docutils literal"><span class="pre">response_</span> <span class="pre">=</span> <span class="pre">client_.put(request_,</span> <span class="pre">body,</span> <span class="pre">content_type,</span> <span class="pre">callback,</span> <span class="pre">streaming_callback)</span></tt></dt>
478+
<dd>The body and content_type parameters are of type
479+
<tt class="docutils literal"><span class="pre">boost::network::string&lt;Tag&gt;::type</span></tt> where <tt class="docutils literal"><span class="pre">Tag</span></tt> is the HTTP Client&#8217;s
480+
<tt class="docutils literal"><span class="pre">Tag</span></tt>. This uses the request object&#8217;s other headers. Have the response
481+
body chunks be handled by the <tt class="docutils literal"><span class="pre">callback</span></tt> parameter. The signature of
482+
<tt class="docutils literal"><span class="pre">callback</span></tt> should be the following: <tt class="docutils literal"><span class="pre">void(iterator_range&lt;char</span> <span class="pre">const</span> <span class="pre">*&gt;</span> <span class="pre">const</span>
483+
<span class="pre">&amp;,</span> <span class="pre">boost::system::error_code</span> <span class="pre">const</span> <span class="pre">&amp;)</span></tt>. This form also has the request&#8217;s body
484+
chunks be generated by the <tt class="docutils literal"><span class="pre">streaming_callback</span></tt> which has a signature of
485+
the form: <tt class="docutils literal"><span class="pre">bool(string_type&amp;)</span></tt>. The provided <tt class="docutils literal"><span class="pre">string_type&amp;</span></tt> will be
486+
streamed as soon as the function returns. A return value of <tt class="docutils literal"><span class="pre">false</span></tt>
487+
signals the client that the most recent invocation is the last chunk to be
488+
sent</dd>
466489
<dt><tt class="docutils literal"><span class="pre">response_</span> <span class="pre">=</span> <span class="pre">client_.put(request_,</span> <span class="pre">streaming_callback)</span></tt></dt>
467490
<dd>Perform and HTTP PUT request, and have the request&#8217;s body chunks be
468491
generated by the <tt class="docutils literal"><span class="pre">streaming_callback</span></tt> which has a signature of the form:
@@ -609,7 +632,7 @@ <h3>Navigation</h3>
609632
</div>
610633
<div class="footer">
611634
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
612-
Last updated on Aug 12, 2014.
635+
Last updated on Aug 27, 2014.
613636
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
614637
</div>
615638
</body>

libs/network/doc/html/search.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ <h3>Navigation</h3>
9494
</div>
9595
<div class="footer">
9696
&copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
97-
Last updated on Aug 12, 2014.
97+
Last updated on Aug 27, 2014.
9898
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
9999
</div>
100100
</body>

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