Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit84dd2cc

Browse files
committed
Updated documentation.
1 parentdedf276 commit84dd2cc

18 files changed

+232
-151
lines changed

‎README.rst‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ you will need. These are:
105105
* A build tool (CMake [#]_ recommended, Boost.Build also an option)
106106
* OpenSSL headers (optional)
107107

108-
..note::This assumes that you have the cpp-netlib distribution package
109-
unpacked somwhere in your home directory. This specifically assumes that you
110-
have cpp-netlib at the toplevel of your home directory.
111-
.. [#]http://www.cmake.org/
108+
..note::This assumes that you have cpp-netlib at the top-level of
109+
your home directory.
110+
[#] http://www.cmake.org/
112111

113112
Hacking on cpp-netlib
114113
---------------------

‎libs/network/doc/atom_reader.rst‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,44 @@
44
Atom reader
55
*************
66

7-
TheCode
7+
Thecode
88
========
99

10+
..code-block::c++
1011

11-
Building and Running The Code
12-
=============================
12+
#include "atom.hpp"
13+
#include <boost/network/protocol/http/client.hpp>
14+
#include <boost/foreach.hpp>
15+
#include <iostream>
1316

14-
Diving into the Code
17+
int main(int argc, char * argv[]) {
18+
using namespace boost::network;
19+
20+
if (argc != 2) {
21+
std::cout << "Usage: " << argv[0] << " <url>" << std::endl;
22+
return 1;
23+
}
24+
25+
try {
26+
http::client client;
27+
http::client::request request(argv[1]);
28+
request << header("Connection", "close");
29+
http::client::response response = client.get(request);
30+
atom::feed feed(response);
31+
32+
std::cout << "Feed: " << feed.title()
33+
<< " (" << feed.subtitle() << ")" << std::endl;
34+
BOOST_FOREACH(const atom::entry &entry, feed) {
35+
std::cout << entry.title()
36+
<< " (" << entry.published() << ")" << std::endl;
37+
}
38+
}
39+
catch (std::exception &e) {
40+
std::cerr << e.what() << std::endl;
41+
}
42+
43+
return 0;
44+
}
45+
46+
Diving into the code
1547
====================

‎libs/network/doc/examples_http.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ embedded into larger applications.
88
..toctree::
99
:maxdepth:2
1010

11-
http_client.rst
11+
simple_wget.rst
1212
hello_world_server.rst
1313
hello_world_client.rst
14-
simple_wget.rst
14+
fileserver.rst
1515
atom_reader.rst
1616
rss_reader.rst
1717
twitter_search.rst

‎libs/network/doc/fileserver.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. _fileserver_http:
2+
3+
*******************
4+
Fileserver (HTTP)
5+
*******************
6+
7+
The code
8+
========
9+
10+
Diving into the code
11+
====================

‎libs/network/doc/getting_started.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Building On Windows
158158
If you're using the Microsoft Visual C++ compiler or the Microsoft Visual Studio
159159
IDE and you would like to build cpp-netlib from within Visual Studio, you can
160160
look for the solution and project files as the artifacts of the call to
161-
``cmake`` -- the file should be named ``cpp-netlib.sln`` (the solution) along
161+
``cmake`` -- the file should be named ``CPP-NETLIB.sln`` (the solution) along
162162
with a number of project files for Visual Studio.
163163

164164
Reporting Issues, Getting Support
@@ -173,5 +173,5 @@ for the project at http://github.com/cpp-netlib/cpp-netlib/issues.
173173

174174
You can also opt to join the developers mailing list for a more personal
175175
interaction with the developers of the project. You can join the mailing list
176-
throughhttps://groups.google.com/group/cpp-netlib.
176+
throughhttp://groups.google.com/forum/#!forum/cpp-netlib.
177177

‎libs/network/doc/hello_world_client.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Just like with the HTTP Server and HTTP client example before, we can build this
5151
example by doing the following on the shell:
5252

5353
..code-block::bash
54-
54+
5555
$cd~/cpp-netlib
5656
$ g++ -o hello_world_client \
5757
> libs/network/example/http/hello_world_client.cpp \
@@ -70,7 +70,7 @@ This example can be run from the command line as follows:
7070
..note::This assumes that you have the ``hello_world_server`` running on
7171
localhost port 8000.
7272

73-
Diving into theCode
73+
Diving into thecode
7474
====================
7575

7676
All this example shows is how easy it is to write an HTTP client that connects
@@ -92,7 +92,7 @@ perform the request via HTTP:
9292

9393
http::client client;
9494
http::client::request request("http://my.webservice.com/");
95-
http::client::response =
95+
http::client::response =
9696
client.post(request, "application/xml", some_xml_string);
9797
std::data = body(response);
9898

‎libs/network/doc/hello_world_server.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ simple response to any HTTP request.
5959

6060
This is about a straightforward as server programming will get in C++.
6161

62-
Building theServer
62+
Building theserver
6363
===================
6464

6565
Just like with the HTTP client, we can build this example by doing the following
@@ -86,7 +86,7 @@ a command line as follows:
8686
..note::If you're going to run the server on port 80, you may have to run it
8787
as an administrator.
8888

89-
Diving into theCode
89+
Diving into thecode
9090
====================
9191

9292
Let's take a look at the code listing above in greater detail.

‎libs/network/doc/index.rst‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ Contents
123123
in_depth.rst
124124
techniques.rst
125125
history.rst
126-
install.rst
127126
reference.rst
128127
references.rst
129128

‎libs/network/doc/install.rst‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎libs/network/doc/reference_http_server.rst‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Handler function object.
3535
There are two different Handler concepts, one concept for `Synchronous Servers`_
3636
and another for `Asynchronous Servers`.
3737

38-
TheSynchronusHandler concept for `Synchronous Servers`_ is described by the
38+
TheSynchronousHandler concept for `Synchronous Servers`_ is described by the
3939
following table:
4040

4141
---------------
@@ -145,7 +145,7 @@ API Documentation
145145
The following sections assume that the following file has been included:
146146

147147
..code-block::c++
148-
148+
149149
#include <boost/network/include/http/server.hpp>
150150

151151
And that the following typedef's have been put in place:
@@ -226,14 +226,14 @@ Constructor
226226
To use the above supported named parameters, you'll have code that looks like the following:
227227

228228
..code-block::c++
229-
229+
230230
using namespace boost::network::http; // parameters are in this namespace
231231
boost::asio::io_service my_io_service;
232232
boost::network::utils::thread_pool pool(2);
233233
handler handler_instance;
234234
async_server<handler> instance(_address="0.0.0.0", _port="80", _handler=handler_instance,
235235
_io_service=my_io_service, _thread_pool=pool,
236-
_reuse_address=true);
236+
_reuse_address=true);
237237
instance.run();
238238

239239
Public Members
@@ -270,8 +270,8 @@ helpful in certain simple situations.
270270

271271
``response = http_server::response::stock_reply(status, body)``
272272
Code like the above should go inside the handler's ``operator()`` overload.
273-
The body parameter is an ``std::string``. The status parameter is any of
274-
the following values from the ``http_server::response`` enum
273+
The body parameter is an ``std::string``. The status parameter is any of
274+
the following values from the ``http_server::response`` enum
275275
``status_type``:
276276

277277
..code-block::c++
@@ -313,7 +313,7 @@ which can be directly manipulated by the handler.
313313
.. [#]A header is a struct of type
314314
``response_header<http::tags::http_server>``. An instance always has the
315315
members ``name`` and ``value`` both of which are of type ``string_type``.
316-
.. [#]``string_type`` is
316+
.. [#]``string_type`` is
317317
``boost::network::string<http::tags::http_server>::type``.
318318
319319
Asynchronous Servers
@@ -358,7 +358,7 @@ synchronous server implementation.
358358
The general pattern for using the ``async_server`` template is shown below:
359359

360360
..code-block::c++
361-
361+
362362
struct handler;
363363
typedef boost::network::http::async_server<handler> http_server;
364364

@@ -367,7 +367,7 @@ The general pattern for using the ``async_server`` template is shown below:
367367
http_server::request const & req,
368368
http_server::connection_ptr connection
369369
) {
370-
// handle the request here, and use the connection to
370+
// handle the request here, and use the connection to
371371
// either read more data or write data out to the client
372372
}
373373
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp