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

Release documentation#612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionslibs/network/doc/html/.buildinfo
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config:ae0de19b7b7891744d7373f4a9b6c125
tags:fbb0d17656682115ca4d033fb2f83ba1
config:adbe6ea7ac2e69d5b593dfb1e312603d
tags:645f666f9bcd5a90fca523b33c5a78b7
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
Binary file removedlibs/network/doc/html/.doctrees/examples.doctree
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
Binary file removedlibs/network/doc/html/.doctrees/history.doctree
View file
Open in desktop
Binary file not shown.
Binary file removedlibs/network/doc/html/.doctrees/in_depth.doctree
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
Binary file removedlibs/network/doc/html/.doctrees/index.doctree
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
Binary file removedlibs/network/doc/html/_images/boost.png
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,6 @@ simple response to any HTTP request.
.. code-block:: c++

#include <boost/network/protocol/http/server.hpp>
#include <string>
#include <iostream>

namespace http = boost::network::http;
Expand All@@ -28,16 +27,19 @@ simple response to any HTTP request.
typedef http::server<hello_world> server;

struct hello_world {
void operator() (server::request const &request,
server::response &response) {
std::string ip = source(request);
response = server::response::stock_reply(
server::response::ok, std::string("Hello, ") + ip + "!");
void operator()(server::request const &request, server::response &response) {
server::string_type ip = source(request);
unsigned int port = request.source_port;
std::ostringstream data;
data << "Hello, " << ip << ':' << port << '!';
response = server::response::stock_reply(server::response::ok, data.str());
}
void log(const server::string_type& message) {
std::cerr << "ERROR: " << message << std::endl;
}
};

int
main(int argc, char * argv[]) {
int main(int argc, char *argv[]) {

if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " address port" << std::endl;
Expand All@@ -46,7 +48,8 @@ simple response to any HTTP request.

try {
hello_world handler;
server server_(argv[1], argv[2], handler);
server::options options(handler);
server server_(options.address(argv[1]).port(argv[2]));
server_.run();
}
catch (std::exception &e) {
Expand DownExpand Up@@ -100,34 +103,39 @@ This header contains all the code needed to develop an HTTP server with
typedef http::server<hello_world> server;

struct hello_world {
void operator () (server::request const &request,
server::response &response) {
std::string ip = source(request);
response = server::response::stock_reply(
server::response::ok, std::string("Hello, ") + ip + "!");
void operator()(server::request const &request, server::response &response) {
server::string_type ip = source(request);
unsigned int port = request.source_port;
std::ostringstream data;
data << "Hello, " << ip << ':' << port << '!';
response = server::response::stock_reply(server::response::ok, data.str());
}
void log(const server::string_type& message) {
std::cerr << "ERROR: " << message << std::endl;
}
};

``hello_world`` is a functor class which handles HTTP requests. All
the operator does here is return an HTTP response with HTTP code 200
and the body ``"Hello, <ip>!"``. The ``<ip>`` in this case would be
the IP address of the client that made the request.
``hello_world`` is a functor class which handles HTTP requests.
Allthe operator does here is return an HTTP response with HTTP code 200
and the body ``"Hello, <ip>:<port>!"``. The ``<ip>`` in this case would be
the IP address of the client that made the request and ``<port>`` the clients port.

There are a number of pre-defined stock replies differentiated by
status code with configurable bodies.

All the supported enumeration values for the response status codes can be found
in ``boost/network/protocol/http/impl/response.ipp``.

.. code-block:: c++

hello_world handler;
server server_(argv[1], argv[2], handler);
server::options options(handler);
server server_(options.address(argv[1]).port(argv[2]));
server_.run();

The first two arguments to the ``server`` constructor are the host and
the port on which the server will listen. The third argument is the
the handler object defined previously.
The ``server`` constructor requires an object of the ``options`` class,
this object stores all needed options, especially the host and
the port on which the server will listen.
The ``options`` constructor's single argument is the handler object defined previously.

.. note:: In this example, the server is specifically made to be single-threaded.
In a multi-threaded server, you would invoke the ``hello_world::run`` member
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -64,7 +64,7 @@ The code
`rapidjson`_, a header-only library that is released under
the `MIT License`_.

.. _`rapidjson`:http://code.google.com/p/rapidjson/
.. _`rapidjson`:https://github.com/miloyip/rapidjson
.. _`MIT License`: http://www.opensource.org/licenses/mit-license.php

Building and running ``twitter_search``
Expand Down
18 changes: 18 additions & 0 deletionslibs/network/doc/html/_sources/reference/http_client.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,8 @@ asynchronous.
As of 0.11 the `Synchronous Clients`_ are now *DEPRECATED* and will be removed
in subsequent releases.

In 0.12.x the `Synchronous Clients`_ have been removed.

Features
--------

Expand DownExpand Up@@ -473,3 +475,19 @@ to create a function object.

The ``BOOST_NETWORK_HTTP_BODY_CALLBACK`` macro is defined in
``boost/network/protocol/http/client/macros.hpp``.

Generated Documentation
-----------------------

.. doxygenclass:: boost::network::http::client_options
:project: cppnetlib
:members:
:undoc-members:

.. doxygenclass:: boost::network::http::basic_client
:project: cppnetlib
:members:
:undoc-members:

.. doxygentypedef:: boost::network::http::client
:project: cppnetlib
21 changes: 21 additions & 0 deletionslibs/network/doc/html/_sources/whats_new.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,27 @@
What's New
************

:mod:`cpp-netlib` 0.12
----------------------

* Added a code of conduct.
* Add TLS SNI hostname support in the HTTP Client options.
* Changes based on Coverity reports.
* Replace std::bind with lambdas.
* Use std::shared_ptr instead of boost::shared_ptr.
* Use standalone Asio instead of Boost.Asio.
* No Boost library (shared or static) dependencies.
* Use doxygen for documentation, integrated with Breathe to Sphinx.
* Require C++11 for builds, removes support for non-C++11 compilers.
* Update documentation for hello_world_server
* Use googletest for tests
* Fix XCode-generated debug binaries caused by URI parser complexity
* Remove synchronous client implementation.
* Remove support for connection keepalive (only supported in synchronous client).
* Disable SSLv3 by default.
* Use sanitisers in continuous integration (address and thread sanitiser).
* Update minimum Boost to 1.57. Always use shared libs from Boost.

:mod:`cpp-netlib` 0.11
----------------------

Expand Down
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Binary file not shown.
74 changes: 68 additions & 6 deletionslibs/network/doc/html/_static/basic.css
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand DownExpand Up@@ -197,7 +197,10 @@ h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink {
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}

Expand DownExpand Up@@ -314,6 +317,13 @@ table.docutils {
border-collapse: collapse;
}

table caption span.caption-number {
font-style: italic;
}

table caption span.caption-text {
}

table.docutils td, table.docutils th {
padding: 1px 8px 1px 5px;
border-top: 0;
Expand DownExpand Up@@ -344,6 +354,25 @@ table.citation td {
border-bottom: none;
}

/* -- figures --------------------------------------------------------------- */

div.figure {
margin: 0.5em;
padding: 0.5em;
}

div.figure p.caption {
padding: 0.3em;
}

div.figure p.caption span.caption-number {
font-style: italic;
}

div.figure p.caption span.caption-text {
}


/* -- other body styles ----------------------------------------------------- */

ol.arabic {
Expand DownExpand Up@@ -406,6 +435,10 @@ dl.glossary dt {
font-size: 1.3em;
}

.sig-paren {
font-size: larger;
}

.versionmodified {
font-style: italic;
}
Expand DownExpand Up@@ -471,22 +504,51 @@ table.highlighttable td {
padding: 0 0.5em 0 0.5em;
}

tt.descname {
div.code-block-caption {
padding: 2px 5px;
font-size: small;
}

div.code-block-caption code {
background-color: transparent;
}

div.code-block-caption + div > div.highlight > pre {
margin-top: 0;
}

div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
}

div.code-block-caption span.caption-text {
}

div.literal-block-wrapper {
padding: 1em 1em 0;
}

div.literal-block-wrapper div.highlight {
margin: 0;
}

code.descname {
background-color: transparent;
font-weight: bold;
font-size: 1.2em;
}

tt.descclassname {
code.descclassname {
background-color: transparent;
}

tt.xref, att {
code.xref, acode {
background-color: transparent;
font-weight: bold;
}

h1tt, h2tt, h3tt, h4tt, h5tt, h6tt {
h1code, h2code, h3code, h4code, h5code, h6code {
background-color: transparent;
}

Expand Down
Binary file removedlibs/network/doc/html/_static/boost.png
View file
Open in desktop
Binary file not shown.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp