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

Commita17616a

Browse files
committed
Merge branch '0.5-devel' of git@github.com:mikhailberis/cpp-netlib into 0.5-devel
2 parents3562f27 +1379ae3 commita17616a

31 files changed

+578
-232
lines changed

‎boost/network/protocol/http/connection.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ namespace boost { namespace network { namespace http {
4545
, socket_(service_)
4646
, wrapper_(service_)
4747
{
48-
try {
49-
socket_.set_option(tcp::no_delay(true));// Don't delay writing
50-
}catch (system::system_error & e) {
51-
handler_.log(e.what());
52-
}
5348
}
5449

5550
tcp::socket &socket() {
@@ -62,6 +57,9 @@ namespace boost { namespace network { namespace http {
6257
// and then pass that request object to the
6358
// handler_ instance.
6459
//
60+
boost::system::error_code option_error;
61+
socket_.set_option(tcp::no_delay(true), option_error);
62+
if (option_error) handler_.log(system::system_error(option_error).what());
6563
socket_.async_read_some(
6664
boost::asio::buffer(buffer_),
6765
wrapper_.wrap(

‎index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3+
4+
<htmlxmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<metahttp-equiv="refresh"content="0; URL=libs/network/doc/html/index.html"/>
7+
8+
<title></title>
9+
<linkrel="stylesheet"href="libs/network/doc/boostbook.css"type="text/css"/>
10+
</head>
11+
12+
<body>
13+
Automatic redirection failed, please go to<ahref=
14+
"libs/network/doc/html/index.html">index.html</a>.
15+
16+
<divclass="copyright-footer">
17+
<p>Copyright 2010 Glyn Matthews</p>
18+
19+
<p>Distributed under the Boost Software License, Version 1.0. (See
20+
accompanying file<ahref="LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
21+
at<ahref=
22+
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
23+
</div>
24+
</body>
25+
</html>

‎libs/network/doc/appendices.qbk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[/
2+
(C) Copyright 2010 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
[section:appendices Appendices]
9+
10+
[include message_concept.qbk]
11+
[include uri_concept.qbk]
12+
[include http_uri_concept.qbk]
13+
14+
[endsect] [/ appendices]

‎libs/network/doc/architecture.qbk

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@
77

88

99
[section:architecture Architecture]
10-
__cnl__ is built upon __boost_asio__, a high-quality, portable asynchronous I/O library that provides a solid interface for C++ network programming.
10+
__cnl__ is built upon __boost_asio__, a high-quality, portable
11+
asynchronous I/O library that provides a solid interface for C++
12+
network programming.
1113

12-
The architecture is driven by the requirement to separate requests from the transport mechanism. Additionally, it's possible to utilise templates and static mechanisms to make decisions at compile-time, resulting in more efficient and stable client code.
14+
The architecture is driven by the requirement to separate requests and
15+
responses from the transport mechanism. Additionally, it utilises
16+
generic programming techniques to make decisions at compile-time,
17+
resulting in more efficient and stable client code.
1318

14-
There are two main features of the architecture which use modern C++ techniques to allow extensibility without comprimising efficiency: tags and directives. These underly the design of the message.
19+
There are two main features of the architecture which use modern C++
20+
techniques to allow extensibility without comprimising efficiency:
21+
tags and directives. It is these techniques that underpin the design
22+
of the message.
1523

1624
[include message.qbk]
1725
[include uri.qbk]
1826

19-
2027
[endsect]

‎libs/network/doc/contributors.qbk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[/
2+
(C) Copyright 2010 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
[section:contributors Contributors]
9+
[endsect] [/ contributors]

‎libs/network/doc/examples.qbk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[/
2-
(C) Copyright 2008, 2009 Glyn Matthews.
2+
(C) Copyright 2008, 2009, 2010 Glyn Matthews.
33
Distributed under the Boost Software License, Version 1.0.
44
(See accompanying file LICENSE_1_0.txt or copy at
55
http://www.boost.org/LICENSE_1_0.txt).
66
]
77

88

99
[section:examples Examples]
10+
[include examples/hello_world.qbk]
1011
[include examples/http_client.qbk]
1112
[include examples/simple_wget.qbk]
1213
[endsect]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[/
2+
(C) Copyright 2010 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
9+
[section:hello_world Hello World]
10+
11+
[import ../../example/http/hello_world_server.cpp]
12+
[hello_world_server_main]
13+
14+
[import ../../example/http/hello_world_client.cpp]
15+
[hello_world_client_main]
16+
17+
[endsect] [/hello_world]
18+

‎libs/network/doc/examples/http_client.qbk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
[section:http_client HTTP Client]
1010
[import ../../example/http_client.cpp]
1111
[http_client_main]
12-
[endsect]
12+
[endsect] [/http_client]
1313

‎libs/network/doc/examples/simple_wget.qbk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
[section:simple_wget Simple 'wget' Clone]
1111
[import ../../example/simple_wget.cpp]
1212
[simple_wget_main]
13-
[endsect]
13+
[endsect] [/simple_wget]
1414

‎libs/network/doc/http.qbk

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[/
2-
(C) Copyright 2008, 2009 Glyn Matthews.
2+
(C) Copyright 2008, 2009, 2010 Glyn Matthews.
33
Distributed under the Boost Software License, Version 1.0.
44
(See accompanying file LICENSE_1_0.txt or copy at
55
http://www.boost.org/LICENSE_1_0.txt).
66
]
77

88

99
[section:http HTTP]
10-
The __cnl__ provides direct support for HTTP. As a motivating example, here is the code again from the __quick_start__.
10+
The __cnl__ provides direct support for HTTP. As a motivating
11+
example, here is the code again from the __quick_start__.
1112

1213
#include <boost/network/protocol/http.hpp>
1314
#include <iostream>
@@ -33,7 +34,8 @@ The __cnl__ provides direct support for HTTP. As a motivating example, here is
3334
return 0;
3435
}
3536

36-
Before walking through exactly what is happening in this example, the principle components are described below:
37+
Before walking through exactly what is happening in this example, the
38+
principle components are described below:
3739

3840
[heading HTTP Request]
3941

@@ -42,7 +44,8 @@ Before walking through exactly what is happening in this example, the principle
4244
typedef basic_request<tags::default_> request;
4345
}}}
4446

45-
The [^request] encapsulates information about the request and the resource.
47+
The [^request] encapsulates information about the request and the
48+
resource. It models the Message concept.
4649

4750
[heading HTTP Client]
4851

@@ -51,7 +54,9 @@ The [^request] encapsulates information about the request and the resource.
5154
typedef basic_client<tags::default_> client;
5255
}}}
5356

54-
The [^client] encapsulates the connection-mapping logic between the domain and the underlying socket. Access to a resource is managed through the [^client] object.
57+
The [^client] encapsulates the connection-mapping logic between the
58+
domain and the underlying socket. Access to a resource is managed
59+
through the [^client] object.
5560

5661
[heading HTTP Response]
5762

@@ -60,7 +65,8 @@ The [^client] encapsulates the connection-mapping logic between the domain and t
6065
typedef basic_response<tags::default_> response;
6166
}}}
6267

63-
The [^response] encapsulates the data received from the server.
68+
The [^response] encapsulates the data received from the server. It
69+
also models the Message concept.
6470

6571
[heading Walkthrough]
6672

@@ -70,17 +76,24 @@ This line frames the request for the resource __boost_org__.
7076

7177
http::client client;
7278

73-
Then a client object is created that handles all HTTP requests and responses.
79+
Then a client object is created that handles all HTTP requests and
80+
responses.
7481

7582
http::response response = client.get(request);
7683

77-
The client simply performs the requests. The interface is trivially easy. All HTTP methods are supported (HEAD, GET, POST, PUT, DELETE).
84+
The client simply performs the requests. The interface is trivially
85+
easy. All HTTP methods are supported (HEAD, GET, POST, PUT, DELETE).
7886

7987
There are several advantages to this design:
8088

81-
# A [^client] object manages the connection, unencumbering the developer with this task;
82-
# A [^request] can be used with any instance of the [^client] without binding the [^client] to any destination;
83-
# By decoupling the method from the [^request] object it allows developers to create requests that may be re-used (e.g. perform a HEAD first; if the the headers don't fulfil a certain criteria, perform a GET using the same resource).
89+
# A [^client] object manages the connection, unencumbering the
90+
developer with this task;
91+
# A [^request] can be used with any instance of the [^client] without
92+
binding the [^client] to any destination;
93+
# By decoupling the method from the [^request] object it allows
94+
developers to create requests that may be re-used (e.g. perform a
95+
HEAD first; if the the headers don't fulfil a certain criteria,
96+
perform a GET using the same resource).
8497

8598
// print response headers
8699
headers_range<http::response>::type hdrs = headers(response);
@@ -93,8 +106,9 @@ There are several advantages to this design:
93106
// print response body
94107
std::cout << body(response) << std::endl;
95108

96-
Once the request has been made, and the [^client] returns a [^response] object, the rest is simple. This example outputs all the response headers and body, in this case just the Boost homepage.
97-
109+
Once the request has been made, and the [^client] returns a
110+
[^response] object, the rest is simple. This example outputs all the
111+
response headers and body, in this case just the Boost homepage.
98112

99113
[heading Using [^http::client]]
100114

@@ -112,9 +126,14 @@ HTTP features can be enabled by using constructor arguments:
112126
* [^http::client(http::client::follow_redirect)]
113127

114128
[h5 [^http::client::cache_resolved]]
115-
This argument enables the caching of resolved endpoints and prevents the client from resolving IP addresses of previously resolved hostnames.
129+
This argument enables the caching of resolved endpoints and prevents
130+
the client from resolving IP addresses of previously resolved
131+
hostnames.
116132

117133
[h5 [^http::client::follow_redirect(s)]]
118-
[^http::client::follow_redirects] / [^http::client::follow_redirect] follow HTTP redirect(s) (300..307) by looking at the "Location" header provided by the response(s); headers present in the original request are preserved in the subsequent request(s).
134+
[^http::client::follow_redirects] / [^http::client::follow_redirect]
135+
follow HTTP redirect(s) (300..307) by looking at the "Location" header
136+
provided by the response(s); headers present in the original request
137+
are preserved in the subsequent request(s).
119138

120-
[endsect]
139+
[endsect] [/http]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp