├── .clang-format ├── .gitignore ├── .gitmodules ├── .travis.yml ├── .ycm_extra_conf.py ├── CMakeLists.txt ├── Doxyfile ├── LICENSE_1_0.txt ├── RATIONALE.txt ├── README.rst ├── boost ├── mime.hpp ├── network.hpp └── network │ ├── constants.hpp │ ├── detail │ ├── debug.hpp │ ├── directive_base.hpp │ └── wrapper_base.hpp │ ├── include │ ├── http │ │ ├── client.hpp │ │ └── server.hpp │ └── message.hpp │ ├── message.hpp │ ├── message │ ├── directives.hpp │ ├── directives │ │ ├── detail │ │ │ ├── string_directive.hpp │ │ │ └── string_value.hpp │ │ ├── header.hpp │ │ └── remove_header.hpp │ ├── modifiers │ │ ├── add_header.hpp │ │ ├── body.hpp │ │ ├── clear_headers.hpp │ │ ├── destination.hpp │ │ ├── remove_header.hpp │ │ └── source.hpp │ ├── traits │ │ ├── body.hpp │ │ ├── destination.hpp │ │ ├── headers.hpp │ │ └── source.hpp │ ├── transformers.hpp │ ├── transformers │ │ ├── selectors.hpp │ │ ├── to_lower.hpp │ │ └── to_upper.hpp │ ├── wrappers.hpp │ └── wrappers │ │ ├── body.hpp │ │ ├── destination.hpp │ │ ├── headers.hpp │ │ └── source.hpp │ ├── message_fwd.hpp │ ├── protocol.hpp │ ├── protocol │ ├── http.hpp │ ├── http │ │ ├── algorithms │ │ │ └── linearize.hpp │ │ ├── client.hpp │ │ ├── client │ │ │ ├── async_impl.hpp │ │ │ ├── connection │ │ │ │ ├── async_base.hpp │ │ │ │ ├── async_normal.hpp │ │ │ │ ├── async_protocol_handler.hpp │ │ │ │ ├── connection_delegate.hpp │ │ │ │ ├── connection_delegate_factory.hpp │ │ │ │ ├── normal_delegate.hpp │ │ │ │ ├── normal_delegate.ipp │ │ │ │ ├── ssl_delegate.hpp │ │ │ │ ├── ssl_delegate.ipp │ │ │ │ ├── sync_base.hpp │ │ │ │ ├── sync_normal.hpp │ │ │ │ └── sync_ssl.hpp │ │ │ ├── facade.hpp │ │ │ ├── macros.hpp │ │ │ ├── options.hpp │ │ │ ├── pimpl.hpp │ │ │ └── sync_impl.hpp │ │ ├── errors.hpp │ │ ├── impl │ │ │ ├── message.ipp │ │ │ ├── parser.ipp │ │ │ ├── request.hpp │ │ │ ├── request_parser.ipp │ │ │ └── response.ipp │ │ ├── message.hpp │ │ ├── message │ │ │ ├── async_message.hpp │ │ │ ├── directives │ │ │ │ ├── major_version.hpp │ │ │ │ ├── method.hpp │ │ │ │ ├── minor_version.hpp │ │ │ │ ├── status.hpp │ │ │ │ ├── status_message.hpp │ │ │ │ ├── uri.hpp │ │ │ │ └── version.hpp │ │ │ ├── header.hpp │ │ │ ├── header │ │ │ │ ├── name.hpp │ │ │ │ └── value.hpp │ │ │ ├── message_base.hpp │ │ │ ├── modifiers │ │ │ │ ├── body.hpp │ │ │ │ ├── clear_headers.hpp │ │ │ │ ├── destination.hpp │ │ │ │ ├── headers.hpp │ │ │ │ ├── major_version.hpp │ │ │ │ ├── method.hpp │ │ │ │ ├── minor_version.hpp │ │ │ │ ├── source.hpp │ │ │ │ ├── status.hpp │ │ │ │ ├── status_message.hpp │ │ │ │ ├── uri.hpp │ │ │ │ └── version.hpp │ │ │ ├── traits │ │ │ │ ├── status.hpp │ │ │ │ ├── status_message.hpp │ │ │ │ └── version.hpp │ │ │ └── wrappers │ │ │ │ ├── anchor.hpp │ │ │ │ ├── body.hpp │ │ │ │ ├── destination.hpp │ │ │ │ ├── headers.hpp │ │ │ │ ├── helper.hpp │ │ │ │ ├── host.hpp │ │ │ │ ├── major_version.hpp │ │ │ │ ├── method.hpp │ │ │ │ ├── minor_version.hpp │ │ │ │ ├── path.hpp │ │ │ │ ├── port.hpp │ │ │ │ ├── protocol.hpp │ │ │ │ ├── query.hpp │ │ │ │ ├── ready.hpp │ │ │ │ ├── source.hpp │ │ │ │ ├── status.hpp │ │ │ │ ├── status_message.hpp │ │ │ │ ├── uri.hpp │ │ │ │ └── version.hpp │ │ ├── parser.hpp │ │ ├── parser │ │ │ └── incremental.hpp │ │ ├── policies │ │ │ ├── async_connection.hpp │ │ │ ├── async_resolver.hpp │ │ │ ├── pooled_connection.hpp │ │ │ ├── simple_connection.hpp │ │ │ └── sync_resolver.hpp │ │ ├── request.hpp │ │ ├── request_parser.hpp │ │ ├── response.hpp │ │ ├── server.hpp │ │ ├── server │ │ │ ├── async_connection.hpp │ │ │ ├── async_server.hpp │ │ │ ├── impl │ │ │ │ └── parsers.ipp │ │ │ ├── options.hpp │ │ │ ├── request.hpp │ │ │ ├── request_parser.hpp │ │ │ ├── socket_options_base.hpp │ │ │ └── storage_base.hpp │ │ ├── support │ │ │ ├── client_or_server.hpp │ │ │ ├── is_client.hpp │ │ │ ├── is_http.hpp │ │ │ ├── is_keepalive.hpp │ │ │ ├── is_server.hpp │ │ │ └── is_simple.hpp │ │ ├── tags.hpp │ │ ├── traits.hpp │ │ └── traits │ │ │ ├── connection_keepalive.hpp │ │ │ ├── connection_policy.hpp │ │ │ ├── delegate_factory.hpp │ │ │ ├── impl │ │ │ ├── chunk_cache.ipp │ │ │ ├── content.ipp │ │ │ ├── cookie_name.ipp │ │ │ ├── cookie_value.ipp │ │ │ ├── cookies_container.ipp │ │ │ ├── delimiters.ipp │ │ │ ├── header_name.ipp │ │ │ ├── header_value.ipp │ │ │ ├── headers.ipp │ │ │ ├── headers_container.ipp │ │ │ ├── method.ipp │ │ │ ├── post_content.ipp │ │ │ ├── query_container.ipp │ │ │ ├── query_name.ipp │ │ │ ├── query_string.ipp │ │ │ ├── query_value.ipp │ │ │ ├── request_methods.ipp │ │ │ ├── resource.ipp │ │ │ ├── response_code.ipp │ │ │ ├── response_message.ipp │ │ │ └── status_message.ipp │ │ │ ├── message_traits.hpp │ │ │ ├── parser_traits.hpp │ │ │ ├── resolver.hpp │ │ │ └── resolver_policy.hpp │ └── stream_handler.hpp │ ├── support │ ├── is_async.hpp │ ├── is_default_string.hpp │ ├── is_default_wstring.hpp │ ├── is_http.hpp │ ├── is_keepalive.hpp │ ├── is_pod.hpp │ ├── is_simple.hpp │ ├── is_sync.hpp │ ├── is_tcp.hpp │ ├── is_udp.hpp │ └── pod_or_normal.hpp │ ├── tags.hpp │ ├── traits │ ├── char.hpp │ ├── headers_container.hpp │ ├── istream.hpp │ ├── istringstream.hpp │ ├── ostream_iterator.hpp │ ├── ostringstream.hpp │ ├── string.hpp │ └── vector.hpp │ ├── uri.hpp │ ├── uri │ ├── accessors.hpp │ ├── builder.hpp │ ├── config.hpp │ ├── decode.hpp │ ├── detail │ │ └── uri_parts.hpp │ ├── directives.hpp │ ├── directives │ │ ├── authority.hpp │ │ ├── fragment.hpp │ │ ├── host.hpp │ │ ├── path.hpp │ │ ├── port.hpp │ │ ├── query.hpp │ │ ├── scheme.hpp │ │ └── user_info.hpp │ ├── encode.hpp │ ├── schemes.hpp │ ├── uri.hpp │ ├── uri.ipp │ └── uri_io.hpp │ ├── utils │ ├── base64 │ │ ├── encode-io.hpp │ │ └── encode.hpp │ ├── thread_group.hpp │ └── thread_pool.hpp │ └── version.hpp ├── build.sh ├── code_of_conduct.md ├── cppnetlibConfig.cmake.in ├── cppnetlibConfigVersion.cmake.in ├── index.html ├── install-boost.sh ├── libs ├── mime │ ├── To-Do.txt │ ├── doc │ │ ├── mime.qbk │ │ └── quick_start.qbk │ ├── example │ │ ├── basic_parsing.cpp │ │ └── basic_usage.cpp │ └── test │ │ ├── CMakeLists.txt │ │ ├── TestMessages │ │ ├── .gitattributes │ │ ├── 00000001 │ │ ├── 00000019 │ │ ├── 00000431 │ │ ├── 00000975 │ │ └── 0019-NoBoundary │ │ ├── mime-roundtrip.cpp │ │ ├── mime-structure.cpp │ │ └── mimeParse.py └── network │ ├── benchmarks │ └── README.rst │ ├── build │ └── CMakeLists.txt │ ├── doc │ ├── .gitignore │ ├── Makefile │ ├── _ext │ │ └── adjusts.py │ ├── _static │ │ ├── Button-Info-icon.png │ │ ├── Button-Warning-icon.png │ │ ├── cpp-netlib.css │ │ ├── ftp_uri.png │ │ ├── http_uri.png │ │ ├── mailto_uri.png │ │ ├── orange-background.jpg │ │ ├── pygments.css │ │ ├── reset-fonts-grids.css │ │ └── uri.svg │ ├── conf.py │ ├── contents.rst │ ├── examples.rst │ ├── examples │ │ └── http │ │ │ ├── atom_reader.rst │ │ │ ├── hello_world_client.rst │ │ │ ├── hello_world_server.rst │ │ │ ├── http_client.rst │ │ │ ├── simple_wget.rst │ │ │ └── twitter_search.rst │ ├── getting_started.rst │ ├── html │ │ ├── .buildinfo │ │ ├── _sources │ │ │ ├── contents.txt │ │ │ ├── examples.txt │ │ │ ├── examples │ │ │ │ └── http │ │ │ │ │ ├── atom_reader.txt │ │ │ │ │ ├── hello_world_client.txt │ │ │ │ │ ├── hello_world_server.txt │ │ │ │ │ ├── http_client.txt │ │ │ │ │ ├── simple_wget.txt │ │ │ │ │ └── twitter_search.txt │ │ │ ├── getting_started.txt │ │ │ ├── index.txt │ │ │ ├── reference.txt │ │ │ ├── reference │ │ │ │ ├── http_client.txt │ │ │ │ ├── http_request.txt │ │ │ │ ├── http_response.txt │ │ │ │ └── http_server.txt │ │ │ ├── references.txt │ │ │ └── whats_new.txt │ │ ├── _static │ │ │ ├── ajax-loader.gif │ │ │ ├── basic.css │ │ │ ├── comment-bright.png │ │ │ ├── comment-close.png │ │ │ ├── comment.png │ │ │ ├── dialog-note.png │ │ │ ├── dialog-seealso.png │ │ │ ├── dialog-todo.png │ │ │ ├── dialog-topic.png │ │ │ ├── dialog-warning.png │ │ │ ├── doctools.js │ │ │ ├── down-pressed.png │ │ │ ├── down.png │ │ │ ├── epub.css │ │ │ ├── file.png │ │ │ ├── footerbg.png │ │ │ ├── headerbg.png │ │ │ ├── ie6.css │ │ │ ├── jquery-1.11.1.js │ │ │ ├── jquery.js │ │ │ ├── middlebg.png │ │ │ ├── minus.png │ │ │ ├── plus.png │ │ │ ├── pygments.css │ │ │ ├── pyramid.css │ │ │ ├── searchtools.js │ │ │ ├── transparent.gif │ │ │ ├── underscore-1.3.1.js │ │ │ ├── underscore.js │ │ │ ├── up-pressed.png │ │ │ ├── up.png │ │ │ └── websupport.js │ │ ├── contents.html │ │ ├── examples.html │ │ ├── examples │ │ │ └── http │ │ │ │ ├── atom_reader.html │ │ │ │ ├── hello_world_client.html │ │ │ │ ├── hello_world_server.html │ │ │ │ ├── http_client.html │ │ │ │ ├── simple_wget.html │ │ │ │ └── twitter_search.html │ │ ├── getting_started.html │ │ ├── index.html │ │ ├── objects.inv │ │ ├── reference.html │ │ ├── reference │ │ │ ├── http_client.html │ │ │ ├── http_request.html │ │ │ ├── http_response.html │ │ │ └── http_server.html │ │ ├── references.html │ │ ├── search.html │ │ ├── searchindex.js │ │ └── whats_new.html │ ├── index.rst │ ├── make.bat │ ├── reference.rst │ ├── reference │ │ ├── http_client.rst │ │ ├── http_request.rst │ │ ├── http_response.rst │ │ └── http_server.rst │ ├── references.rst │ └── whats_new.rst │ ├── example │ ├── CMakeLists.txt │ ├── atom │ │ ├── atom.cpp │ │ ├── atom.hpp │ │ └── main.cpp │ ├── http │ │ ├── fileserver.cpp │ │ ├── hello_world_async_server_with_work_queue.cpp │ │ ├── hello_world_client.cpp │ │ ├── hello_world_server.cpp │ │ ├── one_liner.cpp │ │ └── ssl │ │ │ ├── dh2048.pem │ │ │ ├── server.pem │ │ │ └── ssl_server.cpp │ ├── http_client.cpp │ ├── http_client1.cpp │ ├── rapidxml │ │ ├── license.txt │ │ ├── manual.html │ │ ├── rapidxml.hpp │ │ ├── rapidxml_iterators.hpp │ │ ├── rapidxml_print.hpp │ │ └── rapidxml_utils.hpp │ ├── rss │ │ ├── main.cpp │ │ ├── rss.cpp │ │ └── rss.hpp │ ├── simple_wget.cpp │ ├── trivial_google.cpp │ └── uri_builder.cpp │ ├── experiment │ ├── CMakeLists.txt │ ├── utils │ │ ├── base64-standalone.hpp │ │ ├── base64-stateful_buffer.hpp │ │ ├── base64-stateful_iterator.hpp │ │ ├── base64-stateful_transform.hpp │ │ ├── base64-stateless.hpp │ │ └── iterators │ │ │ ├── iterator_with_state.hpp │ │ │ ├── stateful_base64_from_binary.hpp │ │ │ ├── stateful_transform_width.hpp │ │ │ └── transform_width_with_state.hpp │ ├── utils_base64_experiment.cpp │ ├── utils_base64_experiment.ipp │ └── utils_base64_experiment.txt │ ├── src │ ├── CMakeLists.txt │ ├── client.cpp │ ├── server_request_parsers_impl.cpp │ └── uri │ │ ├── schemes.cpp │ │ └── uri.cpp │ └── test │ ├── CMakeLists.txt │ ├── client_server_include_failure.cpp │ ├── http │ ├── CMakeLists.txt │ ├── client_constructor_test.cpp │ ├── client_get_different_port_test.cpp │ ├── client_get_streaming_test.cpp │ ├── client_get_test.cpp │ ├── client_get_timeout_test.cpp │ ├── client_localhost_normal_test.cpp │ ├── client_localhost_ssl_test.cpp │ ├── client_types.hpp │ ├── http_test_server.hpp │ ├── message_async_ready_test.cpp │ ├── message_test.cpp │ ├── request_incremental_parser_test.cpp │ ├── request_linearize_test.cpp │ ├── response_incremental_parser_test.cpp │ ├── server_async_run_stop_concurrency.cpp │ ├── server_constructor_test.cpp │ ├── server_header_parser_test.cpp │ └── tag_types.hpp │ ├── http_server_async_less_copy.cpp │ ├── httplib_acceptance.py │ ├── message_test.cpp │ ├── message_transform_test.cpp │ ├── server │ ├── boost.jpg │ ├── certificate.pem │ ├── cgi-bin │ │ ├── cgisupport.py │ │ ├── echo_body.py │ │ ├── echo_headers.py │ │ ├── multiline-header.py │ │ ├── requestinfo.py │ │ └── sleep.py │ ├── cgi_server.py │ ├── http_test_server.py │ ├── https_test_server.py │ ├── key.pem │ └── test.xml │ ├── uri │ ├── CMakeLists.txt │ ├── relative_uri_test.cpp │ ├── uri_builder_stream_test.cpp │ ├── uri_builder_test.cpp │ ├── uri_encoding_test.cpp │ └── uri_test.cpp │ ├── utils_base64_test.cpp │ └── utils_thread_pool.cpp └── package.sh /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AccessModifierOffset: -1 3 | ConstructorInitializerIndentWidth: 4 4 | AlignEscapedNewlinesLeft: true 5 | AlignTrailingComments: true 6 | AllowAllParametersOfDeclarationOnNextLine: true 7 | AllowShortIfStatementsOnASingleLine: true 8 | AllowShortLoopsOnASingleLine: true 9 | AlwaysBreakTemplateDeclarations: true 10 | AlwaysBreakBeforeMultilineStrings: true 11 | BreakBeforeBinaryOperators: false 12 | BreakConstructorInitializersBeforeComma: false 13 | BinPackParameters: true 14 | ColumnLimit: 80 15 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 16 | DerivePointerBinding: true 17 | ExperimentalAutoDetectBinPacking: false 18 | IndentCaseLabels: true 19 | MaxEmptyLinesToKeep: 1 20 | ObjCSpaceBeforeProtocolList: false 21 | PenaltyBreakComment: 60 22 | PenaltyBreakString: 1000 23 | PenaltyBreakFirstLessLess: 120 24 | PenaltyExcessCharacter: 1000000 25 | PenaltyReturnTypeOnItsOwnLine: 200 26 | PointerBindsToType: true 27 | SpacesBeforeTrailingComments: 2 28 | Cpp11BracedListStyle: true 29 | Standard: Auto 30 | IndentWidth: 2 31 | TabWidth: 4 32 | UseTab: false 33 | BreakBeforeBraces: Attach 34 | IndentFunctionDeclarationAfterType: true 35 | SpacesInParentheses: false 36 | SpaceInEmptyParentheses: false 37 | SpacesInCStyleCastParentheses: false 38 | SpaceAfterControlStatementKeyword: true 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.cmake 2 | *.swp 3 | *.pyc 4 | CMakeCache.txt 5 | CMakeFiles 6 | Makefile 7 | Testing 8 | *.gch 9 | libs/mime/test/mime-roundtrip 10 | *.a 11 | _build 12 | /.project 13 | build/ 14 | libs/network/doc/doxygen/ 15 | .DS_Store 16 | *.swo 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/googletest"] 2 | path = deps/googletest 3 | url = https://github.com/google/googletest.git 4 | [submodule "deps/googlemock"] 5 | path = deps/googlemock 6 | url = https://github.com/google/googlemock.git 7 | [submodule "libs/network/doc/_ext/breathe"] 8 | path = libs/network/doc/_ext/breathe 9 | url = https://github.com/michaeljones/breathe.git 10 | [submodule "deps/cxxopts"] 11 | path = deps/cxxopts 12 | url = https://github.com/jarro2783/cxxopts.git 13 | [submodule "deps/asio"] 14 | path = deps/asio 15 | url = https://github.com/chriskohlhoff/asio.git 16 | -------------------------------------------------------------------------------- /LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /boost/network.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef BOOST_NETWORK_HPP__ 8 | #define BOOST_NETWORK_HPP__ 9 | 10 | // Include all headers in network/ 11 | // Author: Dean Michael Berris 12 | // Date: May 20, 2007 13 | 14 | #include // message type implementation 15 | #include // protocols implementation 16 | 17 | #endif // BOOST_NETWORK_HPP__ 18 | -------------------------------------------------------------------------------- /boost/network/detail/debug.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_DEBUG_HPP_20110410 2 | #define BOOST_NETWORK_DEBUG_HPP_20110410 3 | 4 | // (c) Copyright 2011 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | /** BOOST_NETWORK_MESSAGE is a debugging macro used by cpp-netlib to 10 | print out network-related errors through standard error. This is 11 | only useful when BOOST_NETWORK_DEBUG is turned on. Otherwise 12 | the macro amounts to a no-op. 13 | */ 14 | #ifdef BOOST_NETWORK_DEBUG 15 | #include 16 | #ifndef BOOST_NETWORK_MESSAGE 17 | #define BOOST_NETWORK_MESSAGE(msg) \ 18 | std::cerr << "[DEBUG " << __FILE__ << ':' << __LINE__ << "]: " << msg \ 19 | << std::endl; 20 | #endif 21 | #else 22 | #ifndef BOOST_NETWORK_MESSAGE 23 | #define BOOST_NETWORK_MESSAGE(msg) 24 | #endif 25 | #endif 26 | 27 | #endif /* end of include guard: BOOST_NETWORK_DEBUG_HPP_20110410 */ 28 | -------------------------------------------------------------------------------- /boost/network/detail/directive_base.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__ 8 | #define __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__ 9 | 10 | #include 11 | 12 | /** Defines the base type from which all directives inherit 13 | * to allow friend access to message and other types' internals. 14 | */ 15 | namespace boost { 16 | namespace network { 17 | namespace detail { 18 | 19 | template 20 | struct directive_base { 21 | typedef Tag tag; 22 | explicit directive_base(basic_message & message) 23 | : message_(message) {} 24 | 25 | protected: 26 | ~directive_base() = default; // can only be extended 27 | 28 | basic_message & message_; 29 | }; 30 | 31 | } // namespace detail 32 | 33 | } // namespace network 34 | 35 | } // namespace boost 36 | 37 | #endif // __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__ 38 | -------------------------------------------------------------------------------- /boost/network/detail/wrapper_base.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef __NETWORK_DETAIL_WRAPPER_BASE_HPP__ 8 | #define __NETWORK_DETAIL_WRAPPER_BASE_HPP__ 9 | 10 | namespace boost { 11 | namespace network { 12 | 13 | namespace detail { 14 | 15 | template 16 | struct wrapper_base { 17 | explicit wrapper_base(Message& message_) : _message(message_) {}; 18 | 19 | protected: 20 | ~wrapper_base() = default; // for extending only 21 | Message& _message; 22 | }; 23 | 24 | template 25 | struct wrapper_base_const { 26 | explicit wrapper_base_const(Message const& message_) : _message(message_) {} 27 | 28 | protected: 29 | ~wrapper_base_const() = default; // for extending only 30 | Message const& _message; 31 | }; 32 | 33 | } // namespace detail 34 | 35 | } // namespace network 36 | 37 | } // namespace boost 38 | 39 | #endif // __NETWORK_DETAIL_WRAPPER_BASE_HPP__ 40 | -------------------------------------------------------------------------------- /boost/network/include/http/client.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_INCLUDE_HTTP_CLIENT_HPP_ 2 | #define BOOST_NETWORK_INCLUDE_HTTP_CLIENT_HPP_ 3 | 4 | // Copyright 2009 Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | // 9 | // This is the modular include file for using the HTTP Client 10 | 11 | #include 12 | 13 | #endif // BOOST_NETWORK_INCLUDE_HTTP_CLIENT_HPP_ 14 | -------------------------------------------------------------------------------- /boost/network/include/http/server.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_INCLUDE_HTTP_SERVER_HPP_ 2 | #define BOOST_NETWORK_INCLUDE_HTTP_SERVER_HPP_ 3 | 4 | // Copyright 2010 Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | // 9 | // This is the modular include file for using the HTTP Client 10 | 11 | #include 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /boost/network/include/message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_INCLUDE_MESSAGE_HPP_ 2 | #define BOOST_NETWORK_INCLUDE_MESSAGE_HPP_ 3 | 4 | // Copyright 2009 Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | // 9 | // This is the modular include file for using the basic message type 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #endif // BOOST_NETWORK_INCLUDE_MESSAGE_HPP_ 18 | -------------------------------------------------------------------------------- /boost/network/message/directives.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 3 | // Copyright Google, Inc. 2015 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #ifndef BOOST_NETWORK_MESSAGE_DIRECTIVES_HPP__ 9 | #define BOOST_NETWORK_MESSAGE_DIRECTIVES_HPP__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace boost { 17 | namespace network { 18 | 19 | template 20 | inline basic_message& operator<<(basic_message& message_, 21 | Directive const& directive) { 22 | directive(message_); 23 | return message_; 24 | } 25 | 26 | BOOST_NETWORK_STRING_DIRECTIVE(source, source_, message.source(source_), 27 | message.source = source_); 28 | BOOST_NETWORK_STRING_DIRECTIVE(destination, destination_, 29 | message.destination(destination_), 30 | message.destination = destination_); 31 | BOOST_NETWORK_STRING_DIRECTIVE(body, body_, message.body(body_), 32 | message.body = body_); 33 | 34 | } // namespace network 35 | 36 | } // namespace boost 37 | 38 | #endif // BOOST_NETWORK_MESSAGE_DIRECTIVES_HPP__ 39 | -------------------------------------------------------------------------------- /boost/network/message/directives/detail/string_value.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_VALUE_HPP_20100915 2 | #define BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_VALUE_HPP_20100915 3 | 4 | // Copyright Dean Michael Berris 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace boost { 18 | namespace network { 19 | namespace detail { 20 | 21 | template 22 | struct string_value 23 | : mpl::if_, std::shared_future::type>, 24 | typename mpl::if_< 25 | mpl::or_, is_same, 26 | is_same >, 27 | typename string::type, unsupported_tag >::type> {}; 28 | 29 | } /* detail */ 30 | } /* network */ 31 | } /* boost */ 32 | 33 | #endif /* BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_VALUE_HPP_20100915 */ 34 | -------------------------------------------------------------------------------- /boost/network/message/directives/remove_header.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef NETWORK_MESSAGE_DIRECTIVES_REMOVE_HEADER_HPP 8 | #define NETWORK_MESSAGE_DIRECTIVES_REMOVE_HEADER_HPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | 16 | template 17 | struct basic_message; 18 | 19 | namespace impl { 20 | template 21 | struct remove_header_directive { 22 | 23 | explicit remove_header_directive(T header_name) 24 | : header_name_(std::move(header_name)) {}; 25 | 26 | template 27 | void operator()(basic_message& msg) const { 28 | msg.headers().erase(header_name_); 29 | } 30 | 31 | private: 32 | mutable T header_name_; 33 | }; 34 | 35 | } // namespace impl 36 | 37 | inline impl::remove_header_directive remove_header( 38 | const std::string& header_name) { 39 | return impl::remove_header_directive(header_name); 40 | } 41 | 42 | inline impl::remove_header_directive remove_header( 43 | const std::wstring& header_name) { 44 | return impl::remove_header_directive(header_name); 45 | } 46 | 47 | } // namespace network 48 | } // namespace boost 49 | 50 | #endif // NETWORK_MESSAGE_DIRECTIVES_REMOVE_HEADER_HPP 51 | -------------------------------------------------------------------------------- /boost/network/message/modifiers/body.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_MODIFIERS_BODY_HPP_20100824 2 | #define BOOST_NETWORK_MODIFIERS_BODY_HPP_20100824 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | 14 | template class Message, class ValueType> 15 | inline void body_impl(Message& message, ValueType const& body, tags::pod /*unused*/ /*unused*/) { 16 | message.body = body; 17 | } 18 | 19 | template class Message, class ValueType> 20 | inline void body_impl(Message& message, ValueType const& body, 21 | tags::normal /*unused*/ /*unused*/) { 22 | message.body(body); 23 | } 24 | 25 | template class Message, class ValueType> 26 | inline void body(Message& message, ValueType const& body_) { 27 | body_impl(message, body_, typename pod_or_normal::type()); 28 | } 29 | 30 | } // namespace network 31 | 32 | } // namespace boost 33 | 34 | #endif // BOOST_NETWORK_MODIFIERS_BODY_HPP_20100824 35 | -------------------------------------------------------------------------------- /boost/network/message/modifiers/destination.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BOOST_NETWORK_MESSAGE_MODIFIER_DESTINATION_HPP_20100824 3 | #define BOOST_NETWORK_MESSAGE_MODIFIER_DESTINATION_HPP_20100824 4 | 5 | // Copyright 2010 (c) Dean Michael Berris 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | namespace impl { 16 | 17 | template 18 | inline void destination(Message const &message, ValueType const &destination_, 19 | Tag const & /*unused*/ /*unused*/, mpl::false_ const & /*unused*/ /*unused*/) { 20 | message.destination(destination_); 21 | } 22 | 23 | template 24 | inline void destination(Message const &message, ValueType const &destination_, 25 | Tag const & /*unused*/ /*unused*/, mpl::true_ const & /*unused*/ /*unused*/) { 26 | message.destination(destination_); 27 | } 28 | } // namespace impl // namespace impl 29 | 30 | template class Message, class ValueType> 31 | inline void destination(Message const &message, 32 | ValueType const &destination_) { 33 | impl::destination(message, destination_, Tag(), is_async()); 34 | } 35 | 36 | } // namespace network 37 | 38 | } // namespace boost 39 | 40 | #endif // BOOST_NETWORK_MESSAGE_MODIFIER_DESTINATION_HPP_20100824 41 | -------------------------------------------------------------------------------- /boost/network/message/modifiers/source.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BOOST_NETWORK_MESSAGE_MODIFIER_SOURCE_HPP_20100824 3 | #define BOOST_NETWORK_MESSAGE_MODIFIER_SOURCE_HPP_20100824 4 | 5 | // Copyright 2010 (c) Dean Michael Berris 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | namespace impl { 16 | 17 | template 18 | inline void source(Message const &message, ValueType const &source_, 19 | Tag const & /*unused*/ /*unused*/, mpl::false_ const & /*unused*/ /*unused*/) { 20 | message.source(source_); 21 | } 22 | 23 | template 24 | inline void source(Message const &message, ValueType const &source_, 25 | Tag const & /*unused*/ /*unused*/, mpl::true_ const & /*unused*/ /*unused*/) { 26 | message.source(source_); 27 | } 28 | 29 | } // namespace impl 30 | 31 | template class Message, class ValueType> 32 | inline void source(Message const &message, ValueType const &source_) { 33 | impl::source(message, source_, Tag(), is_async()); 34 | } 35 | 36 | } // namespace network 37 | 38 | } // namespace boost 39 | 40 | #endif // BOOST_NETWORK_MESSAGE_MODIFIER_SOURCE_HPP_20100824 41 | -------------------------------------------------------------------------------- /boost/network/message/traits/body.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BOOST_NETWORK_MESSAGE_TRAITS_BODY_HPP_20100903 3 | #define BOOST_NETWORK_MESSAGE_TRAITS_BODY_HPP_20100903 4 | 5 | // Copyright Dean Michael Berris 2010. 6 | // Copyright Google, Inc. 2015 7 | // Distributed under the Boost Software License, Version 1.0. 8 | // (See accompanying file LICENSE_1_0.txt or copy at 9 | // http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace boost { 20 | namespace network { 21 | namespace traits { 22 | 23 | template 24 | struct unsupported_tag; 25 | 26 | template 27 | struct body 28 | : mpl::if_< 29 | is_async, 30 | std::shared_future::type>, 31 | typename mpl::if_< 32 | mpl::or_, 33 | is_same, 35 | is_same >, 37 | typename string::type, 38 | unsupported_tag >::type> {}; 39 | 40 | } // namespace traits 41 | } // namespace network 42 | } // namespace boost 43 | 44 | #endif // BOOST_NETWORK_MESSAGE_TRAITS_BODY_HPP_20100903 45 | -------------------------------------------------------------------------------- /boost/network/message/traits/destination.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BOOST_NETWORK_MESSAGE_TRAITS_DESTINATION_HPP_20100903 3 | #define BOOST_NETWORK_MESSAGE_TRAITS_DESTINATION_HPP_20100903 4 | 5 | // Copyright Dean Michael Berris 2010. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace boost { 19 | namespace network { 20 | 21 | namespace traits { 22 | 23 | template 24 | struct unsupported_tag; 25 | 26 | template 27 | struct destination 28 | : mpl::if_, 29 | std::shared_future::type>, 30 | typename mpl::if_< 31 | mpl::or_, 32 | is_same, 34 | is_same >, 36 | typename string::type, 37 | unsupported_tag >::type> {}; 38 | 39 | } // namespace traits 40 | } // namespace network 41 | } // namespace boost 42 | 43 | #endif // BOOST_NETWORK_MESSAGE_TRAITS_DESTINATION_HPP_20100903 44 | -------------------------------------------------------------------------------- /boost/network/message/traits/source.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_MESSAGE_TRAITS_SOURCE_HPP_20100903 2 | #define BOOST_NETWORK_MESSAGE_TRAITS_SOURCE_HPP_20100903 3 | 4 | // Copyright Dean Michael Berris 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace boost { 18 | namespace network { 19 | namespace traits { 20 | 21 | template 22 | struct unsupported_tag; 23 | 24 | template 25 | struct source 26 | : mpl::if_, 27 | std::shared_future::type>, 28 | typename mpl::if_< 29 | mpl::or_, 30 | is_same, 32 | is_same >, 34 | typename string::type, 35 | unsupported_tag >::type> {}; 36 | 37 | } // namespace traits 38 | } // namespace network 39 | } // namespace boost 40 | 41 | #endif // BOOST_NETWORK_MESSAGE_TRAITS_SOURCE_HPP_20100903 42 | -------------------------------------------------------------------------------- /boost/network/message/wrappers.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef __NETWORK_MESSAGE_WRAPPERS_HPP__ 8 | #define __NETWORK_MESSAGE_WRAPPERS_HPP__ 9 | 10 | /** wrappers.hpp 11 | * 12 | * Pulls in all the wrapper header files. 13 | */ 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #endif // __NETWORK_MESSAGE_WRAPPERS_HPP__ 20 | -------------------------------------------------------------------------------- /boost/network/message/wrappers/destination.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef __NETWORK_MESSAGE_WRAPPERS_DESTINATION_HPP__ 8 | #define __NETWORK_MESSAGE_WRAPPERS_DESTINATION_HPP__ 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | namespace impl { 16 | template 17 | struct destination_wrapper 18 | : public detail::wrapper_base > { 19 | typedef Tag tag; 20 | typedef basic_message message_type; 21 | typedef typename string::type string_type; 22 | typedef detail::wrapper_base > wrapper_base; 23 | 24 | explicit destination_wrapper(message_type& message_) 25 | : wrapper_base(message_) {}; 26 | 27 | operator string_type() const { 28 | return string_type(wrapper_base::_message.destination()); 29 | }; 30 | }; 31 | } // namespace impl 32 | 33 | template 34 | inline typename string::type destination(basic_message& message_) { 35 | return impl::destination_wrapper(message_); 36 | } 37 | 38 | } // namespace network 39 | 40 | } // namespace boost 41 | 42 | #endif // __NETWORK_MESSAGE_WRAPPERS_DESTINATION_HPP__ 43 | -------------------------------------------------------------------------------- /boost/network/message/wrappers/source.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef __NETWORK_MESSAGE_WRAPPERS_SOURCE_HPP__ 8 | #define __NETWORK_MESSAGE_WRAPPERS_SOURCE_HPP__ 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | namespace impl { 16 | template 17 | struct source_wrapper : public detail::wrapper_base > { 18 | typedef Tag tag; 19 | typedef basic_message message_type; 20 | typedef typename string::type string_type; 21 | typedef detail::wrapper_base > wrapper_base; 22 | 23 | explicit source_wrapper(basic_message& message_) 24 | : wrapper_base(message_) {}; 25 | 26 | operator string_type() const { 27 | return string_type(wrapper_base::_message.source()); 28 | }; 29 | }; 30 | } // namespace impl 31 | 32 | template 33 | inline typename string::type source(basic_message& message_) { 34 | return impl::source_wrapper(message_); 35 | } 36 | 37 | } // namespace network 38 | 39 | } // namespace boost 40 | 41 | #endif // __NETWORK_MESSAGE_WRAPPERS_SOURCE_HPP__ 42 | -------------------------------------------------------------------------------- /boost/network/message_fwd.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2008. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOST_NETWORK_MESSAGE_FWD_HPP 7 | #define BOST_NETWORK_MESSAGE_FWD_HPP 8 | 9 | namespace boost { 10 | namespace network { 11 | 12 | template 13 | struct basic_message; 14 | 15 | } // namespace networkk 16 | } // namespace boost 17 | 18 | #endif // BOST_NETWORK_MESSAGE_FWD_HPP 19 | -------------------------------------------------------------------------------- /boost/network/protocol.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef __NETWORK_PROTOCOLS_20070908_1_HPP__ 8 | #define __NETWORK_PROTOCOLS_20070908_1_HPP__ 9 | 10 | // Include all protocol implementation headers in protocol/* 11 | // Author: Dean Michael Berris 12 | // Date Created: Oct. 08, 2007 13 | 14 | #include // include HTTP implementation 15 | 16 | #endif // __NETWORK_PROTOCOLS_20070908-1_HPP__ 17 | -------------------------------------------------------------------------------- /boost/network/protocol/http.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007, 2008. 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 | #ifndef __NETWORK_PROTOCOL_HTTP_20070908_1_HPP__ 8 | #define __NETWORK_PROTOCOL_HTTP_20070908_1_HPP__ 9 | 10 | // Include HTTP implementation headers 11 | // Author: Dean Michael Berris 12 | // Date Created: Oct. 08, 2007 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #endif // __NETWORK_PROTOCOL_HTTP_20070908-1_HPP__ 20 | -------------------------------------------------------------------------------- /boost/network/protocol/http/client/connection/connection_delegate.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_CONNECTION_DELEGATE_HPP_ 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_CONNECTION_DELEGATE_HPP_ 3 | 4 | // Copyright 2011 Dean Michael Berris (dberris@google.com). 5 | // Copyright 2011 Google, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace network { 17 | namespace http { 18 | namespace impl { 19 | 20 | struct connection_delegate { 21 | virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host, 22 | std::uint16_t source_port, 23 | std::function handler) = 0; 24 | virtual void write( 25 | asio::streambuf &command_streambuf, 26 | std::function handler) = 0; 27 | virtual void read_some( 28 | asio::mutable_buffers_1 const &read_buffer, 29 | std::function handler) = 0; 30 | virtual void disconnect() = 0; 31 | virtual ~connection_delegate() = default; 32 | }; 33 | 34 | } // namespace impl 35 | } // namespace http 36 | } // namespace network 37 | } // namespace boost 38 | 39 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_CONNECTION_DELEGATE_HPP_ \ 40 | */ 41 | -------------------------------------------------------------------------------- /boost/network/protocol/http/client/macros.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_MACROS_HPP_20110430 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_MACROS_HPP_20110430 3 | 4 | // Copyright 2011 Dean Michael Berris . 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | #ifndef BOOST_NETWORK_HTTP_BODY_CALLBACK 13 | #define BOOST_NETWORK_HTTP_BODY_CALLBACK(function_name, range_name, \ 14 | error_name) \ 15 | void function_name(boost::iterator_range const& (range_name), \ 16 | std::error_code const& (error_name)) 17 | #endif 18 | 19 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_MACROS_HPP_20110430 */ 20 | -------------------------------------------------------------------------------- /boost/network/protocol/http/errors.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007, 2008. 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 | #ifndef __NETWORK_PROTOCOL_HTTP_ERRORS_20080516_HPP__ 8 | #define __NETWORK_PROTOCOL_HTTP_ERRORS_20080516_HPP__ 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | namespace errors { 17 | 18 | template 19 | struct connection_timeout_exception : std::runtime_error {}; 20 | 21 | typedef connection_timeout_exception<> connection_timeout; 22 | 23 | } // namespace errors 24 | 25 | } // namespace http 26 | 27 | } // namespace network 28 | 29 | } // namespace boost 30 | 31 | #endif // __NETWORK_PROTOCOL_HTTP_20080516_HPP__ 32 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/directives/major_version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MAJOR_VERSION_HPP_20101120 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MAJOR_VERSION_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct basic_request; 19 | 20 | struct major_version_directive { 21 | std::uint8_t major_version; 22 | explicit major_version_directive(std::uint8_t major_version) 23 | : major_version(major_version) {} 24 | template 25 | void operator()(basic_request& request) const { 26 | request.http_version_major = major_version; 27 | } 28 | }; 29 | 30 | inline major_version_directive major_version(std::uint8_t major_version_) { 31 | return major_version_directive(major_version_); 32 | } 33 | 34 | } // namespace http 35 | /* http */ 36 | 37 | } // namespace network 38 | /* network */ 39 | 40 | } // namespace boost 41 | /* boost */ 42 | 43 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MAJOR_VERSION_HPP_20101120 \ 44 | */ 45 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/directives/method.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_METHOD_HPP_20101120 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_METHOD_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost { 10 | namespace network { 11 | namespace http { 12 | 13 | BOOST_NETWORK_STRING_DIRECTIVE(method, method_, message.method(method_), 14 | message.method = method_); 15 | 16 | } // namespace http 17 | /* http */ 18 | 19 | } // namespace network 20 | /* network */ 21 | 22 | } // namespace boost 23 | /* booet */ 24 | 25 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_METHOD_HPP_20101120 \ 26 | */ 27 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/directives/minor_version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MINOR_VERSION_HPP_20101120 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MINOR_VERSION_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct basic_request; 19 | 20 | struct minor_version_directive { 21 | std::uint8_t minor_version; 22 | explicit minor_version_directive(std::uint8_t minor_version) 23 | : minor_version(minor_version) {} 24 | template 25 | void operator()(basic_request& request) const { 26 | request.http_version_minor = minor_version; 27 | } 28 | }; 29 | 30 | inline minor_version_directive minor_version(std::uint8_t minor_version_) { 31 | return minor_version_directive(minor_version_); 32 | } 33 | 34 | } // namespace http 35 | /* http */ 36 | 37 | } // namespace network 38 | /* network */ 39 | 40 | } // namespace boost 41 | /* boost */ 42 | 43 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MINOR_VERSION_HPP_20101120 \ 44 | */ 45 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/directives/status_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_STATUS_MESSAGE_HPP_20100603 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_STATUS_MESSAGE_HPP_20100603 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | BOOST_NETWORK_STRING_DIRECTIVE(status_message, status_message_, 18 | message.status_message(status_message_), 19 | message.status_message = status_message_); 20 | 21 | } // namespace http 22 | 23 | } // namespace network 24 | 25 | } // namespace boost 26 | 27 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_STATUS_MESSAGE_HPP_20100603 28 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/directives/uri.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_URI_HPP_20100620 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_URI_HPP_20100620 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | BOOST_NETWORK_STRING_DIRECTIVE(uri, uri_, message.uri(uri_), 18 | message.uri = uri_); 19 | 20 | } // namespace http 21 | 22 | } // namespace network 23 | 24 | } // namespace boost 25 | 26 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_URI_HPP_20100620 27 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/directives/version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_VERSION_HPP_20100603 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_VERSION_HPP_20100603 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | BOOST_NETWORK_STRING_DIRECTIVE(version, version_, message.version(version_), 18 | message.version = version_); 19 | 20 | } // namespace http 21 | 22 | } // namespace network 23 | 24 | } // namespace boost 25 | 26 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_VERSION_HPP_20100603 27 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/header/name.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_NAME_HPP_20101028 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_NAME_HPP_20101028 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | T1 &name(std::pair const &p) { 18 | return p.first; 19 | } 20 | 21 | inline std::string const &name(request_header_narrow const &h) { 22 | return h.name; 23 | } 24 | 25 | inline std::wstring const &name(request_header_wide const &h) { return h.name; } 26 | 27 | inline std::string const &name(response_header_narrow const &h) { 28 | return h.name; 29 | } 30 | 31 | inline std::wstring const &name(response_header_wide const &h) { 32 | return h.name; 33 | } 34 | 35 | } // namespace http 36 | /* http */ 37 | 38 | } // namespace network 39 | /* network */ 40 | 41 | } // namespace boost 42 | /* boost */ 43 | 44 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_NAME_HPP_20101028 */ 45 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/header/value.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_VALUE_HPP_20101028 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_VALUE_HPP_20101028 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | namespace http { 14 | 15 | struct request_header_narrow; 16 | struct request_header_wide; 17 | struct response_header_narrow; 18 | struct response_header_wide; 19 | 20 | template 21 | T1& value(std::pair const& p) { 22 | return p.second; 23 | } 24 | 25 | inline request_header_narrow::string_type const& value( 26 | request_header_narrow const& h) { 27 | return h.value; 28 | } 29 | 30 | inline request_header_wide::string_type const& value( 31 | request_header_wide const& h) { 32 | return h.value; 33 | } 34 | 35 | inline response_header_narrow::string_type const& value( 36 | response_header_narrow const& h) { 37 | return h.value; 38 | } 39 | 40 | inline response_header_wide::string_type const& value( 41 | response_header_wide const& h) { 42 | return h.value; 43 | } 44 | 45 | } // namespace http 46 | /* http */ 47 | 48 | } // namespace network 49 | /* network */ 50 | 51 | } // namespace boost 52 | /* boost */ 53 | 54 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_VALUE_HPP_20101028 */ 55 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/message_base.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_BASE_HPP_20100603 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_BASE_HPP_20100603 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct async_message; 19 | 20 | template 21 | struct message_impl; 22 | 23 | template 24 | struct message_base 25 | : mpl::if_, async_message, message_impl > {}; 26 | 27 | } // namespace http 28 | 29 | } // namespace network 30 | 31 | } // namespace boost 32 | 33 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_BASE_HPP_20100603 34 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/headers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIER_HEADERS_HPP_20100624 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIER_HEADERS_HPP_20100624 3 | 4 | // Copyright 2010 (C) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_response; 18 | 19 | template 20 | struct basic_request; 21 | 22 | namespace impl { 23 | 24 | template 25 | void headers(basic_response &response, T const &value, 26 | mpl::false_ const & /*unused*/) { 27 | response << headers(value); 28 | } 29 | 30 | template 31 | void headers(basic_response &response, T const &future, 32 | mpl::true_ const & /*unused*/) { 33 | response.headers(future); 34 | } 35 | 36 | template 37 | void headers(basic_request &request, T const &value, 38 | tags::server const & /*unused*/) { 39 | request.headers = value; 40 | } 41 | } // namespace impl 42 | 43 | template 44 | inline void headers(basic_response &response, T const &value) { 45 | impl::headers(response, value, is_async()); 46 | } 47 | 48 | template 49 | inline void headers(basic_request &request, T const &value) { 50 | impl::headers(request, value, Tag()); 51 | } 52 | 53 | } // namespace http 54 | 55 | } // namespace network 56 | 57 | } // namespace boost 58 | 59 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIER_HEADERS_HPP_20100624 60 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/major_version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MAJOR_VERSION_HPP_20101120 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MAJOR_VERSION_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct basic_request; 19 | 20 | template 21 | inline typename enable_if, void>::type major_version( 22 | basic_request& request, std::uint8_t major_version_) { 23 | request.http_version_major = major_version_; 24 | } 25 | 26 | } // namespace http 27 | /* http */ 28 | 29 | } // namespace network 30 | /* network */ 31 | 32 | } // namespace boost 33 | /* boost */ 34 | 35 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MAJOR_VERSION_HPP_20101120 \ 36 | */ 37 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/method.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_METHOD_HPP_20101118 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_METHOD_HPP_20101118 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_request; 18 | 19 | template 20 | inline typename enable_if, void>::type method( 21 | basic_request& request, typename string::type const& method_) { 22 | request.method = method_; 23 | } 24 | 25 | } // namespace http 26 | /* http */ 27 | 28 | } // namespace network 29 | /* network */ 30 | 31 | } // namespace boost 32 | /* boost */ 33 | 34 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_METHOD_HPP_20101118 */ 35 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/minor_version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MINOR_VERSION_HPP_20101120 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MINOR_VERSION_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct basic_request; 19 | 20 | template 21 | inline typename enable_if, void>::type minor_version( 22 | basic_request& request, std::uint8_t minor_version_) { 23 | request.http_version_minor = minor_version_; 24 | } 25 | 26 | } // namespace http 27 | /* http */ 28 | 29 | } // namespace network 30 | /* network */ 31 | 32 | } // namespace boost 33 | /* boost */ 34 | 35 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MINOR_VERSION_HPP_20101120 \ 36 | */ 37 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/status.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_HPP_20100608 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_HPP_20100608 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_response; 18 | 19 | namespace impl { 20 | 21 | template 22 | void status(basic_response &response, T const &value, 23 | mpl::false_ const & /*unused*/) { 24 | response << boost::network::http::status(value); 25 | } 26 | 27 | template 28 | void status(basic_response &response, T const &future, 29 | mpl::true_ const & /*unused*/) { 30 | response.status(future); 31 | } 32 | 33 | } // namespace impl 34 | 35 | template 36 | void status(basic_response &response, T const &value) { 37 | impl::status(response, value, is_async()); 38 | } 39 | 40 | } // namespace http 41 | 42 | } // namespace network 43 | 44 | } // namespace boost 45 | 46 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_HPP_20100608 47 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/status_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_MESSAGE_HPP_20100608 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_MESSAGE_HPP_20100608 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_response; 18 | 19 | namespace impl { 20 | 21 | template 22 | void status_message(basic_response &response, T const &value, 23 | mpl::false_ const & /*unused*/) { 24 | response << boost::network::http::status_message(value); 25 | } 26 | 27 | template 28 | void status_message(basic_response &response, T const &future, 29 | mpl::true_ const & /*unused*/) { 30 | response.status_message(future); 31 | } 32 | 33 | } // namespace impl 34 | 35 | template 36 | void status_message(basic_response &response, T const &value) { 37 | impl::status_message(response, value, is_async()); 38 | } 39 | 40 | } // namespace http 41 | 42 | } // namespace network 43 | 44 | } // namespace boost 45 | 46 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_MESSAGE_HPP_20100608 47 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/uri.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_URI_HPP_20100621 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_URI_HPP_20100621 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_request; 18 | 19 | template 20 | void uri(basic_request& request, T const& value) { 21 | request.uri(value); 22 | } 23 | 24 | } // namespace http 25 | 26 | } // namespace network 27 | 28 | } // namespace boost 29 | 30 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_URI_HPP_20100621 31 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/modifiers/version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_VERSION_HPP_20100608 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_VERSION_HPP_20100608 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | namespace http { 17 | 18 | template 19 | struct basic_response; 20 | 21 | namespace impl { 22 | 23 | template 24 | void version(basic_response &response, T const &value, 25 | mpl::false_ const & /*unused*/) { 26 | response << boost::network::http::version(value); 27 | } 28 | 29 | template 30 | void version(basic_response &response, T const &future, 31 | mpl::true_ const & /*unused*/) { 32 | response.version(future); 33 | } 34 | 35 | } // namespace impl 36 | 37 | template 38 | void version(basic_response &response, T const &value) { 39 | impl::version(response, value, is_async()); 40 | } 41 | 42 | } // namespace http 43 | 44 | } // namespace network 45 | 46 | } // namespace boost 47 | 48 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_VERSION_HPP_20100608 49 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/traits/status.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_STATUS_HPP_20100903 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_STATUS_HPP_20100903 3 | 4 | // Copyright Dean Michael Berris 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | namespace traits { 18 | 19 | template 20 | struct unsupported_tag; 21 | 22 | template 23 | struct status 24 | : mpl::if_< 25 | is_async, 26 | std::shared_future, 27 | typename mpl::if_, std::uint16_t, 28 | unsupported_tag >::type> {}; 29 | 30 | } // namespace traits 31 | /* traits */ 32 | 33 | } // namespace http 34 | /* http */ 35 | } // namespace network 36 | /* network */ 37 | } // namespace boost 38 | /* boost */ 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/traits/status_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_STATUS_MESSAGE_HPP_20100903 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_STATUS_MESSAGE_HPP_20100903 3 | 4 | // Copyright Dean Michael Berris 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace network { 17 | namespace http { 18 | 19 | namespace traits { 20 | 21 | template 22 | struct unsupported_tag; 23 | 24 | template 25 | struct status_message 26 | : mpl::if_< 27 | is_async, 28 | std::shared_future::type>, 29 | typename mpl::if_< 30 | mpl::or_, 31 | is_same, 32 | is_same >, 33 | typename string::type, 34 | unsupported_tag >::type> {}; 35 | 36 | } // namespace traits 37 | /* traits */ 38 | 39 | } // namespace http 40 | /* http */ 41 | } // namespace network 42 | /* network */ 43 | } // namespace boost 44 | /* boost */ 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/traits/version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_VERSION_HPP_20100903 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_VERSION_HPP_20100903 3 | 4 | // Copyright Dean Michael Berris 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace boost { 17 | namespace network { 18 | namespace http { 19 | 20 | namespace traits { 21 | 22 | template 23 | struct unsupported_tag; 24 | 25 | template 26 | struct version { 27 | typedef unsupported_tag type; 28 | }; 29 | 30 | template 31 | struct version >::type> { 33 | typedef std::shared_future::type> 34 | type; 35 | }; 36 | 37 | template 38 | struct version< 39 | Message, typename enable_if< 40 | mpl::or_, 41 | is_default_string, 42 | is_default_wstring > >::type> { 43 | typedef typename string::type type; 44 | }; 45 | 46 | } // namespace traits 47 | /* traits */ 48 | 49 | } // namespace http 50 | /* http */ 51 | } // namespace network 52 | /* network */ 53 | } // namespace boost 54 | /* boost */ 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/anchor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_ANCHOR_HPP_20100618 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_ANCHOR_HPP_20100618 3 | 4 | // Copyright 2010 (c) Dean Michael Berris. 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | namespace boost { 11 | namespace network { 12 | namespace http { 13 | 14 | template 15 | struct basic_request; 16 | 17 | namespace impl { 18 | template 19 | struct anchor_wrapper { 20 | basic_request const& message_; 21 | explicit anchor_wrapper(basic_request const& message) : message_(message) {} 22 | typedef typename basic_request::string_type string_type; 23 | operator string_type() { return message_.anchor(); } 24 | }; 25 | } // namespace impl 26 | 27 | template 28 | inline impl::anchor_wrapper anchor(basic_request const& request) { 29 | return impl::anchor_wrapper(request); 30 | } 31 | 32 | } // namespace http 33 | 34 | } // namespace network 35 | 36 | } // namespace boost 37 | 38 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_ANCHOR_HPP_20100618 39 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/destination.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DESTINATION_HPP_20100624 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DESTINATION_HPP_20100624 3 | 4 | // Copyright 2010 (c) Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_a.txt or copy at 7 | // http://www.boost.org/LICENSE_1_-1.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_response; 18 | 19 | template 20 | struct basic_request; 21 | 22 | template 23 | struct Request; 24 | 25 | template 26 | struct Response; 27 | 28 | BOOST_NETWORK_DEFINE_HTTP_WRAPPER(destination, destination, destination); 29 | 30 | } // namespace http 31 | 32 | } // namespace network 33 | 34 | } // namespace boost 35 | 36 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DESTINATION_HPP_20100624 37 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/host.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HOST_HPP_20100618 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HOST_HPP_20100618 3 | 4 | // Copyright 2010 (c) Dean Michael Berris. 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | namespace boost { 11 | namespace network { 12 | namespace http { 13 | 14 | template 15 | struct basic_request; 16 | 17 | namespace impl { 18 | 19 | template 20 | struct host_wrapper { 21 | basic_request const& message_; 22 | 23 | explicit host_wrapper(basic_request const& message) : message_(message) {} 24 | 25 | typedef typename basic_request::string_type string_type; 26 | 27 | operator string_type() { return message_.host(); } 28 | }; 29 | } // namespace impl 30 | 31 | template 32 | inline impl::host_wrapper host(basic_request const& request) { 33 | return impl::host_wrapper(request); 34 | } 35 | 36 | } // namespace http 37 | 38 | } // namespace network 39 | 40 | } // namespace boost 41 | 42 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HOST_HPP_20100618 43 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/major_version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MAJOR_VERSION_HPP_20101120 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MAJOR_VERSION_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct basic_request; 19 | 20 | template 21 | struct major_version_wrapper { 22 | basic_request const& request; 23 | explicit major_version_wrapper(basic_request const& request) 24 | : request(request) {} 25 | operator std::uint8_t() { return request.http_version_major; } 26 | }; 27 | 28 | template 29 | inline typename enable_if, major_version_wrapper >::type 30 | major_version(basic_request const& request) { 31 | return major_version_wrapper(request); 32 | } 33 | 34 | } // namespace http 35 | /* http */ 36 | 37 | } // namespace network 38 | /* network */ 39 | 40 | } // namespace boost 41 | /* boost */ 42 | 43 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MAJOR_VERSION_HPP_20101120 \ 44 | */ 45 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/method.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_METHOD_HPP_20101118 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_METHOD_HPP_20101118 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_request; 18 | 19 | template 20 | struct method_wrapper { 21 | explicit method_wrapper(basic_request const& message) 22 | : message_(message) {} 23 | 24 | basic_request const& message_; 25 | 26 | typedef typename basic_request::string_type string_type; 27 | 28 | operator string_type() { return message_.method; } 29 | }; 30 | 31 | template 32 | inline typename enable_if, typename string::type>::type 33 | method(basic_request const& message) { 34 | return method_wrapper(message); 35 | } 36 | 37 | } // namespace http 38 | /* http */ 39 | 40 | } // namespace network 41 | /* network */ 42 | 43 | } // namespace boost 44 | /* boost */ 45 | 46 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_METHOD_HPP_20101118 */ 47 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/minor_version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MINOR_VERSION_HPP_20101120 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MINOR_VERSION_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct basic_request; 19 | 20 | template 21 | struct minor_version_wrapper { 22 | basic_request const& request; 23 | explicit minor_version_wrapper(basic_request const& request) 24 | : request(request) {} 25 | operator std::uint8_t() { return request.http_version_minor; } 26 | }; 27 | 28 | template 29 | inline typename enable_if, minor_version_wrapper >::type 30 | minor_version(basic_request const& request) { 31 | return minor_version_wrapper(request); 32 | } 33 | 34 | } // namespace http 35 | /* http */ 36 | 37 | } // namespace network 38 | /* network */ 39 | 40 | } // namespace boost 41 | /* boost */ 42 | 43 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MINOR_VERSION_HPP_20101120 \ 44 | */ 45 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/path.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_PATH_HPP_20100618 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_PATH_HPP_20100618 3 | 4 | // Copyright 2010 (c) Dean Michael Berris. 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | namespace boost { 11 | namespace network { 12 | namespace http { 13 | 14 | template 15 | struct basic_request; 16 | 17 | namespace impl { 18 | 19 | template 20 | struct path_wrapper { 21 | basic_request const& message_; 22 | 23 | explicit path_wrapper(basic_request const& message) : message_(message) {} 24 | 25 | typedef typename basic_request::string_type string_type; 26 | 27 | operator string_type() { return message_.path(); } 28 | }; 29 | } // namespace impl 30 | 31 | template 32 | inline impl::path_wrapper path(basic_request const& request) { 33 | return impl::path_wrapper(request); 34 | } 35 | 36 | } // namespace http 37 | 38 | } // namespace network 39 | 40 | } // namespace boost 41 | 42 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_PATH_HPP_20100618 43 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/protocol.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_PROTOCOL_HPP_20100619 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_PROTOCOL_HPP_20100619 3 | 4 | // Copyright 2010 (c) Dean Michael Berris. 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | namespace boost { 11 | namespace network { 12 | namespace http { 13 | 14 | template 15 | struct basic_request; 16 | 17 | namespace impl { 18 | template 19 | struct protocol_wrapper { 20 | basic_request const& message_; 21 | explicit protocol_wrapper(basic_request const& message) : message_(message) {} 22 | typedef typename basic_request::string_type string_type; 23 | operator string_type() { return message_.protocol(); } 24 | }; 25 | } // namespace impl 26 | 27 | template 28 | inline impl::protocol_wrapper protocol(basic_request const& request) { 29 | return impl::protocol_wrapper(request); 30 | } 31 | 32 | } // namespace http 33 | 34 | } // namespace network 35 | 36 | } // namespace boost 37 | 38 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_PROTOCOL_HPP_20100619 39 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/query.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_QUERY_HPP_20100618 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_QUERY_HPP_20100618 3 | 4 | // Copyright 2010 (c) Dean Michael Berris. 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | namespace boost { 11 | namespace network { 12 | namespace http { 13 | 14 | template 15 | struct basic_request; 16 | 17 | namespace impl { 18 | 19 | template 20 | struct query_wrapper { 21 | basic_request const& message_; 22 | 23 | explicit query_wrapper(basic_request const& message) : message_(message) {} 24 | 25 | typedef typename basic_request::string_type string_type; 26 | 27 | operator string_type() { return message_.query(); } 28 | }; 29 | 30 | } // namespace impl 31 | 32 | template 33 | inline impl::query_wrapper query(basic_request const& request) { 34 | return impl::query_wrapper(request); 35 | } 36 | 37 | } // namespace http 38 | 39 | } // namespace network 40 | 41 | } // namespace boost 42 | 43 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_QUERY_HPP_20100618 44 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/ready.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | namespace http { 14 | 15 | template 16 | struct async_message; 17 | 18 | namespace impl { 19 | template 20 | struct ready_wrapper 21 | : boost::network::detail::wrapper_base_const > { 22 | typedef boost::network::detail::wrapper_base_const > 23 | wrapper_base; 24 | explicit ready_wrapper(async_message const& message) 25 | : wrapper_base(message) {} 26 | operator bool() { 27 | return wrapper_base::_message.version_.is_ready() && 28 | wrapper_base::_message.status_.is_ready() && 29 | wrapper_base::_message.status_message_.is_ready() && 30 | wrapper_base::_message.headers_.is_ready() && 31 | wrapper_base::_message.body_.is_ready(); 32 | } 33 | }; 34 | } // namespace impl 35 | 36 | template 37 | inline bool ready(async_message const& message) { 38 | return impl::ready_wrapper(message); 39 | } 40 | 41 | } // namespace http 42 | /* http */ 43 | 44 | } // namespace network 45 | /* network */ 46 | 47 | } // namespace boost 48 | /* boost */ 49 | 50 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618 */ 51 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/source.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_SOURCE_HPP_20100622 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_SOURCE_HPP_20100622 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | namespace http { 14 | 15 | template 16 | struct basic_response; 17 | 18 | template 19 | struct basic_request; 20 | 21 | BOOST_NETWORK_DEFINE_HTTP_WRAPPER(source, source, source); 22 | 23 | } // namespace http 24 | 25 | } // namespace network 26 | 27 | } // namespace boost 28 | 29 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_SOURCE_HPP_20100622 30 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/status.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_STATUS_HPP_20100603 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_STATUS_HPP_20100603 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_response; 18 | 19 | namespace impl { 20 | 21 | template 22 | struct status_wrapper { 23 | 24 | basic_response const& response_; 25 | 26 | explicit status_wrapper(basic_response const& response) 27 | : response_(response) {} 28 | 29 | status_wrapper(status_wrapper const& other) : response_(other.response_) {} 30 | 31 | operator std::uint16_t() { return response_.status(); } 32 | }; 33 | 34 | } // namespace impl 35 | 36 | template 37 | struct Response; 38 | 39 | template 40 | inline impl::status_wrapper status(basic_response const& response) { 41 | return impl::status_wrapper(response); 42 | } 43 | 44 | } // namespace http 45 | 46 | } // namespace network 47 | 48 | } // namespace boost 49 | 50 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_STATUS_HPP_20100603 51 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/uri.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_URI_HPP_20100620 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_URI_HPP_20100620 3 | 4 | // Copyright 2010 (c) Dean Michael Berris. 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct basic_request; 18 | 19 | namespace impl { 20 | template 21 | struct uri_wrapper { 22 | basic_request const& message_; 23 | explicit uri_wrapper(basic_request const& message) : message_(message) {} 24 | typedef typename basic_request::string_type string_type; 25 | operator string_type() { return message_.uri().raw(); } 26 | operator boost::network::uri::uri() { return message_.uri(); } 27 | }; 28 | } // namespace impl 29 | 30 | template 31 | inline impl::uri_wrapper uri(basic_request const& request) { 32 | return impl::uri_wrapper(request); 33 | } 34 | 35 | } // namespace http 36 | 37 | } // namespace network 38 | 39 | } // namespace boost 40 | 41 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_URI_HPP_20100620 42 | -------------------------------------------------------------------------------- /boost/network/protocol/http/message/wrappers/version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_VERSION_HPP_20100603 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_VERSION_HPP_20100603 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | namespace boost { 11 | namespace network { 12 | namespace http { 13 | 14 | template 15 | struct basic_response; 16 | 17 | namespace impl { 18 | 19 | template 20 | struct version_wrapper { 21 | 22 | typedef typename string::type string_type; 23 | 24 | basic_response const& response_; 25 | 26 | explicit version_wrapper(basic_response const& response) 27 | : response_(response) {} 28 | 29 | version_wrapper(version_wrapper const& other) : response_(other.response_) {} 30 | 31 | operator string_type() { return response_.version(); } 32 | }; 33 | 34 | } // namespace impl 35 | 36 | template 37 | inline impl::version_wrapper version(basic_response const& response) { 38 | return impl::version_wrapper(response); 39 | } 40 | 41 | } // namespace http 42 | 43 | } // namespace network 44 | 45 | } // namespace boost 46 | 47 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_VERSION_HPP_20100603 48 | -------------------------------------------------------------------------------- /boost/network/protocol/http/request.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 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 | #ifndef __NETWORK_PROTOCOL_HTTP_REQUEST_20070908_1_HPP__ 8 | #define __NETWORK_PROTOCOL_HTTP_REQUEST_20070908_1_HPP__ 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | basic_request& operator<<(basic_request& message, 18 | Directive const& directive) { 19 | directive(message); 20 | return message; 21 | } 22 | 23 | } // namespace http 24 | } // namespace network 25 | } // namespace boost 26 | 27 | 28 | #endif // __NETWORK_PROTOCOL_HTTP_REQUEST_20070908-1_HPP__ 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/server.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2009 (c) Tarro, Inc. 2 | // Copyright 2009 (c) Dean Michael Berris 3 | // Copyright 2010 (c) Glyn Matthews 4 | // Copyright Google, Inc. 2015 5 | // Copyright 2003-2008 (c) Chris Kholhoff 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #ifndef BOOST_NETWORK_HTTP_SERVER_HPP_ 11 | #define BOOST_NETWORK_HTTP_SERVER_HPP_ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace boost { 18 | namespace network { 19 | namespace http { 20 | 21 | /** 22 | * The main HTTP Server template implementing an asynchronous HTTP service. 23 | * 24 | * Usage Example: 25 | * \code{.cpp} 26 | * handler_type handler; 27 | * http_server::options options(handler); 28 | * options.thread_pool( 29 | * std::make_shared()); 30 | * http_server server(options.address("localhost").port("8000")); 31 | * \endcode 32 | * 33 | */ 34 | template 35 | struct server : async_server_base { 36 | /// A convenience typedef for the base of this type, implementing most of 37 | /// the internal details. 38 | typedef async_server_base server_base; 39 | 40 | /// The options supported by the server. 41 | typedef server_options options; 42 | 43 | using server_base::server_base; 44 | }; 45 | 46 | } // namespace http 47 | } // namespace network 48 | } // namespace boost 49 | 50 | #endif // BOOST_NETWORK_HTTP_SERVER_HPP_ 51 | -------------------------------------------------------------------------------- /boost/network/protocol/http/server/request.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // request.hpp 3 | // ~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // Copyright (c) 2009 Dean Michael Berris (mikhailberis@gmail.com) 7 | // Copyright (c) 2009 Tarro, Inc. 8 | // 9 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 10 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | // 12 | 13 | #ifndef BOOST_NETWORK_HTTP_REQUEST_HPP 14 | #define BOOST_NETWORK_HTTP_REQUEST_HPP 15 | 16 | #include 17 | #include 18 | #include 19 | #include "header.hpp" 20 | 21 | namespace boost { 22 | namespace network { 23 | namespace http { 24 | 25 | /// A request received from a client. 26 | struct request { 27 | std::string method; 28 | std::string uri; 29 | int http_version_major; 30 | int http_version_minor; 31 | std::vector
headers; 32 | std::string body; 33 | }; 34 | 35 | inline void swap(request& l, request& r) { 36 | using std::swap; 37 | swap(l.method, r.method); 38 | swap(l.uri, r.uri); 39 | swap(l.http_version_major, r.http_version_major); 40 | swap(l.http_version_minor, r.http_version_minor); 41 | swap(l.headers, r.headers); 42 | swap(l.body, r.body); 43 | } 44 | 45 | } // namespace http 46 | 47 | } // namespace network 48 | 49 | } // namespace boost 50 | 51 | #endif // BOOST_NETWORK_HTTP_REQUEST_HPP 52 | -------------------------------------------------------------------------------- /boost/network/protocol/http/server/storage_base.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_SERVER_STORAGE_BASE_HPP_20101210 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_SERVER_STORAGE_BASE_HPP_20101210 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | struct server_storage_base { 17 | struct no_io_service {}; 18 | struct has_io_service {}; 19 | 20 | protected: 21 | template 22 | explicit server_storage_base(server_options const& options) 23 | : self_service_(options.io_service() 24 | ? options.io_service() 25 | : std::make_shared()), 26 | service_(*self_service_) {} 27 | 28 | std::shared_ptr self_service_; 29 | asio::io_service& service_; 30 | }; 31 | 32 | } /* http */ 33 | 34 | } /* network */ 35 | 36 | } /* boost */ 37 | 38 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_SERVER_STORAGE_BASE_HPP_20101210 */ 39 | -------------------------------------------------------------------------------- /boost/network/protocol/http/support/client_or_server.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_CLIENT_OR_SERVER_HPP_20101127 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_CLIENT_OR_SERVER_HPP_20101127 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template 18 | struct unsupported_tag; 19 | 20 | template 21 | struct client_or_server { 22 | typedef unsupported_tag type; 23 | }; 24 | 25 | template 26 | struct client_or_server >::type> { 27 | typedef tags::server type; 28 | }; 29 | 30 | template 31 | struct client_or_server >::type> { 32 | typedef tags::client type; 33 | }; 34 | 35 | } // namespace http 36 | /* http */ 37 | 38 | } // namespace network 39 | /* network */ 40 | 41 | } // namespace boost 42 | /* boost */ 43 | 44 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_CLIENT_OR_SERVER_HPP_20101127 */ 45 | -------------------------------------------------------------------------------- /boost/network/protocol/http/support/is_client.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_SUPPORT_IS_CLIENT_HPP_20101118 2 | #define BOOST_NETWORK_PROTOCOL_SUPPORT_IS_CLIENT_HPP_20101118 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct is_client : mpl::false_ {}; 18 | 19 | template 20 | struct is_client< 21 | Tag, typename enable_if::type> : mpl::true_ {}; 22 | 23 | } // namespace http 24 | /* http */ 25 | 26 | } // namespace network 27 | /* network */ 28 | 29 | } // namespace boost 30 | /* boost */ 31 | 32 | #endif /* BOOST_NETWORK_PROTOCOL_SUPPORT_IS_CLIENT_HPP_20101118 */ 33 | -------------------------------------------------------------------------------- /boost/network/protocol/http/support/is_http.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_HTTP_HPP_20100622 2 | #define BOOST_NETWORK_SUPPORT_IS_HTTP_HPP_20100622 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct is_http : mpl::false_ {}; 18 | 19 | template 20 | struct is_http::type> : mpl::true_ {}; 22 | 23 | } // namespace http 24 | 25 | } // namespace network 26 | 27 | } // namespace boost 28 | 29 | #endif // BOOST_NETWORK_SUPPORT_IS_HTTP_HPP_20100622 30 | -------------------------------------------------------------------------------- /boost/network/protocol/http/support/is_keepalive.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_KEEPALIVE_HPP_20100927 2 | #define BOOST_NETWORK_SUPPORT_IS_KEEPALIVE_HPP_20100927 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct unsupported_tag; 18 | 19 | template 20 | struct is_keepalive : mpl::false_ {}; 21 | 22 | template 23 | struct is_keepalive< 24 | Tag, typename enable_if::type> : mpl::true_ {}; 25 | 26 | } // namespace http 27 | /* http */ 28 | 29 | } // namespace network 30 | /* network */ 31 | 32 | } // namespace boost 33 | /* boost */ 34 | 35 | #endif /* BOOST_NETWORK_SUPPORT_IS_KEEPALIVE_HPP_20100927 */ 36 | -------------------------------------------------------------------------------- /boost/network/protocol/http/support/is_server.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_SUPPORT_IS_SERVER_HPP_20101118 2 | #define BOOST_NETWORK_PROTOCOL_SUPPORT_IS_SERVER_HPP_20101118 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct is_server : mpl::false_ {}; 18 | 19 | template 20 | struct is_server< 21 | Tag, typename enable_if::type> : mpl::true_ {}; 22 | 23 | } // namespace http 24 | /* http */ 25 | 26 | } // namespace network 27 | /* network */ 28 | 29 | } // namespace boost 30 | /* boost */ 31 | 32 | #endif /* BOOST_NETWORK_PROTOCOL_SUPPORT_IS_SERVER_HPP_20101118 */ 33 | -------------------------------------------------------------------------------- /boost/network/protocol/http/support/is_simple.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_SIMPLE_HPP_20100927 2 | #define BOOST_NETWORK_SUPPORT_IS_SIMPLE_HPP_20100927 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct is_simple : mpl::false_ {}; 18 | 19 | template 20 | struct is_simple< 21 | Tag, typename enable_if::type> : mpl::true_ {}; 22 | 23 | } // namespace http 24 | /* http */ 25 | 26 | } // namespace network 27 | /* network */ 28 | 29 | } // namespace boost 30 | /* boost */ 31 | 32 | #endif /* BOOST_NETWORK_SUPPORT_IS_SIMPLE_HPP_20100927 */ 33 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the Boost Network library 2 | // Based on the Pion Network Library (r421) 3 | // Copyright Atomic Labs, Inc. 2007-2008 4 | // See http://cpp-netlib.sourceforge.net for library home page. 5 | // 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_HPP 11 | #define BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_HPP 12 | 13 | // Convenience header for including different traits implementations. 14 | #include 15 | //#include 16 | #include 17 | 18 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_HPP 19 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/connection_keepalive.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Dean Michael Berris 2010. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_CONECTION_KEEPALIVE_20091218 7 | #define BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_CONECTION_KEEPALIVE_20091218 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template 17 | struct connection_keepalive : is_keepalive {}; 18 | 19 | } // namespace http 20 | /* http */ 21 | 22 | } // namespace network 23 | /* network */ 24 | 25 | } // namespace boost 26 | /* boost */ 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_CONECTION_KEEPALIVE_20091218 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/delegate_factory.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_DELEGATE_FACTORY_HPP_20110819 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_DELEGATE_FACTORY_HPP_20110819 3 | 4 | // Copyright 2011 Dean Michael Berris (dberris@google.com). 5 | // Copyright 2011 Google, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | namespace impl { 17 | 18 | template 19 | struct connection_delegate_factory; 20 | 21 | } // namespace impl 22 | /* impl */ 23 | 24 | template 25 | struct unsupported_tag; 26 | 27 | template 28 | struct delegate_factory { 29 | typedef unsupported_tag type; 30 | }; 31 | 32 | template 33 | struct delegate_factory >::type> { 34 | typedef impl::connection_delegate_factory type; 35 | }; 36 | 37 | } // namespace http 38 | /* http */ 39 | } // namespace network 40 | /* network */ 41 | } // namespace boost 42 | /* boost */ 43 | 44 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_DELEGATE_FACTORY_HPP_20110819 */ 45 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/chunk_cache.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_CHUNK_CACHE_CONTAINER_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_CHUNK_CACHE_CONTAINER_IPP 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace boost { 17 | namespace network { 18 | namespace http { 19 | 20 | template 21 | struct chunk_cache { 22 | // TODO(dberris): define the allocator using an allocator_traits? 23 | typedef std::list::type> > type; 24 | }; 25 | 26 | } // namespace http 27 | 28 | } // namespace network 29 | 30 | } // namespace boost 31 | 32 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_CHUNK_CACHE_CONTAINER_IPP 33 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/content.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_CONTENT_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_CONTENT_IPP 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template <> 17 | struct content { 18 | static char const* type_html() { 19 | static char const* const TYPE_HTML = "text/html"; 20 | return TYPE_HTML; 21 | }; 22 | 23 | static char const* type_text() { 24 | static char const* const TYPE_TEXT = "text/plain"; 25 | return TYPE_TEXT; 26 | }; 27 | 28 | static char const* type_xml() { 29 | static char const* const TYPE_XML = "text/xml"; 30 | return TYPE_XML; 31 | }; 32 | 33 | static char const* type_urlencoded() { 34 | static char const* const TYPE_URLENCODED = 35 | "application/x-www-form-urlencoded"; 36 | return TYPE_URLENCODED; 37 | }; 38 | }; 39 | 40 | } // namespace http 41 | 42 | } // namespace network 43 | 44 | } // namespace boost 45 | 46 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_CONTENT_IPP 47 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/cookie_name.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_COOKIE_NAME_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_COOKIE_NAME_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct cookie_name { 19 | static std::uint32_t const MAX = 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_COOKIE_NAME_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/cookie_value.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_COOKIE_VALUE_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_COOKIE_VALUE_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct cookie_value { 19 | static std::uint32_t const MAX = 1024u * 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_COOKIE_VALUE_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/cookies_container.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_COOKIES_CONTAINER_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_COOKIES_CONTAINER_IPP 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | namespace http { 17 | 18 | template 19 | struct cookies_container { 20 | typedef std::multimap::type, typename string::type> 21 | type; 22 | }; 23 | 24 | } // namespace http 25 | 26 | } // namespace network 27 | 28 | } // namespace boost 29 | 30 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_COOKIES_CONTAINER_IPP 31 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/delimiters.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 3 | // Copyright Google, Inc. 2015 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_DELIMITERS_IPP 9 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_DELIMITERS_IPP 10 | 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | // specialize on the tags::http_default_8bit_tcp_resolve type 18 | template <> 19 | struct delimiters { 20 | static char const* string_crlf() { 21 | static char const* const CRLF = "\x0D\x0A"; 22 | return CRLF; 23 | }; 24 | 25 | static char const* string_http_version() { 26 | static char const* const HTTP_VERSION = "HTTP/1.1"; 27 | return HTTP_VERSION; 28 | }; 29 | 30 | static char const* header_name_value_delimiter() { 31 | static char const* const HEADER_NAME_VALUE_DELIMITER = ": "; 32 | return HEADER_NAME_VALUE_DELIMITER; 33 | }; 34 | }; 35 | 36 | } // namespace http 37 | 38 | } // namespace network 39 | 40 | } // namespace boost 41 | 42 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_DELIMITERS_IPP 43 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/header_name.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_HEADER_NAME_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_HEADER_NAME_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct header_name { 19 | static std::uint32_t const MAX = 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_HEADER_NAME_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/header_value.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_HEADER_VALUE_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_HEADER_VALUE_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct header_value { 19 | static std::uint32_t const MAX = 1024u * 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_HEADER_VALUE_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/headers_container.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2013 Google, Inc. 3 | // Copyright 2008 Dean Michael Berris 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP 9 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace boost { 19 | namespace network { 20 | namespace impl { 21 | 22 | // Moving implementation from original 23 | // message_traits implementation by 24 | // Atomic Labs, Inc. 25 | // -- 26 | // returns true if str1 < str2 (ignoring case) 27 | struct is_less_ignore_case_impl { 28 | inline bool operator()( 29 | string::type /*unused*/const& str1, 30 | string::type const& str2) 31 | const { 32 | return to_lower_copy(str1) < to_lower_copy(str2); 33 | }; 34 | }; 35 | 36 | template 37 | struct headers_container_impl< 38 | Tag, typename enable_if::type> { 39 | 40 | typedef is_less_ignore_case_impl is_less_ignore_case; 41 | 42 | typedef std::multimap::type, 43 | string::type, 44 | is_less_ignore_case> type; 45 | }; 46 | 47 | } // namespace impl 48 | } // namespace network 49 | } // namespace boost 50 | 51 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP 52 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/method.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_METHOD_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_METHOD_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct method { 19 | static std::uint32_t const MAX = 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_METHOD_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/post_content.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_POST_CONTENT_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_POST_CONTENT_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct post_content { 19 | static std::uint32_t const MAX = 1024u * 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_POST_CONTENT_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/query_container.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_QUERY_CONTAINER_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_QUERY_CONTAINER_IPP 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | namespace http { 17 | 18 | template 19 | struct query_container { 20 | typedef std::multimap::type, typename string::type> 21 | type; 22 | }; 23 | 24 | } // namespace http 25 | 26 | } // namespace network 27 | 28 | } // namespace boost 29 | 30 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_QUERY_CONTAINER_IPP 31 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/query_name.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_NAME_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_NAME_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct query_name { 19 | static std::uint32_t const MAX = 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_NAME_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/query_string.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_STRING_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_STRING_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct query_string { 19 | static std::uint32_t const MAX = 1024u * 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_STRING_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/query_value.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_VALUE_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_VALUE_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct query_value { 19 | static std::uint32_t const MAX = 1024u * 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_QUERY_VALUE_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/request_methods.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_REQUEST_METHODS_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_REQUEST_METHODS_IPP 9 | 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace http { 15 | 16 | template <> 17 | struct request_methods { 18 | static char const* head() { 19 | static char const* const HEAD = "HEAD"; 20 | return HEAD; 21 | }; 22 | 23 | static char const* get() { 24 | static char const* const GET = "GET"; 25 | return GET; 26 | }; 27 | 28 | static char const* put() { 29 | static char const* const PUT = "PUT"; 30 | return PUT; 31 | }; 32 | 33 | static char const* post() { 34 | static char const* const POST = "POST"; 35 | return POST; 36 | }; 37 | 38 | static char const* delete_() { 39 | static char const* const DELETE_ = "DELETE"; 40 | return DELETE_; 41 | }; 42 | }; 43 | 44 | } // namespace http 45 | 46 | } // namespace network 47 | 48 | } // namespace boost 49 | 50 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_REQUEST_METHODS_IPP 51 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/resource.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_RESOURCE_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_RESOURCE_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct resource { 19 | static std::uint32_t const MAX = 1024u * 256u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_RESOURCE_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/response_code.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_RESPONSE_CODE_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_RESPONSE_CODE_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | /* This glob doesn't have a specialization on the 18 | * tags::http_default_8bit_tcp_resolve 19 | * yet because it doesn't need to define different behaviour/types 20 | * on different message tags -- for example, it doesn't need to 21 | * determine the type or change the values of the data no matter 22 | * what the tag type is provided. 23 | */ 24 | template 25 | struct response_code { 26 | static std::uint16_t const RC_OK = 200u; 27 | static std::uint16_t const RC_CREATED = 201u; 28 | static std::uint16_t const RC_NO_CONTENT = 204u; 29 | static std::uint16_t const RC_UNAUTHORIZED = 401u; 30 | static std::uint16_t const RC_FORBIDDEN = 403u; 31 | static std::uint16_t const RC_NOT_FOUND = 404u; 32 | static std::uint16_t const RC_METHOD_NOT_ALLOWED = 405u; 33 | static std::uint16_t const RC_NOT_MODIFIED = 304u; 34 | static std::uint16_t const RC_BAD_REQUEST = 400u; 35 | static std::uint16_t const RC_SERVER_ERROR = 500u; 36 | static std::uint16_t const RC_NOT_IMPLEMENTED = 501u; 37 | }; 38 | 39 | } // namespace http 40 | 41 | } // namespace network 42 | 43 | } // namespace boost 44 | 45 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_RESPONSE_CODE_IPP 46 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/impl/status_message.ipp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2008. 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 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_STATUS_MESSAGE_IPP 8 | #define BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_STATUS_MESSAGE_IPP 9 | 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace http { 16 | 17 | template <> 18 | struct status_message_text { 19 | static std::uint32_t const MAX = 1024u; 20 | }; 21 | 22 | } // namespace http 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_PARSER_TRAITS_STATUS_MESSAGE_IPP 29 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/resolver.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_RESOLVER_20091214 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_RESOLVER_20091214 3 | 4 | // Copyright Dean Michael Berris 2009. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace boost { 20 | namespace network { 21 | namespace http { 22 | 23 | template 24 | struct unsupported_tag; 25 | 26 | template 27 | struct resolver 28 | : mpl::if_, is_http >, 29 | asio::ip::tcp::resolver, 30 | typename mpl::if_, is_http >, 31 | asio::ip::udp::resolver, 32 | unsupported_tag >::type> { 33 | static_assert(mpl::not_, is_tcp > >::value, 34 | "Transport protocol must be TCP or UDP"); 35 | }; 36 | 37 | } // namespace http 38 | 39 | } // namespace network 40 | 41 | } // namespace boost 42 | 43 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_RESOLVER_20091214 44 | -------------------------------------------------------------------------------- /boost/network/protocol/http/traits/resolver_policy.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_RESOLVER_POLICY_20091214 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_RESOLVER_POLICY_20091214 3 | 4 | // Copyright Dean Michael Berris 2009. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace boost { 18 | namespace network { 19 | namespace http { 20 | 21 | template 22 | struct unsupported_tag; 23 | 24 | template 25 | struct resolver_policy 26 | : mpl::if_, is_http >, 27 | policies::async_resolver, 28 | typename mpl::if_, policies::sync_resolver, 29 | unsupported_tag >::type> {}; 30 | 31 | } // namespace http 32 | 33 | } // namespace network 34 | 35 | } // namespace boost 36 | 37 | #endif // BOOST_NETWORK_PROTOCOL_HTTP_RESOLVER_POLICY_20091214 38 | -------------------------------------------------------------------------------- /boost/network/support/is_async.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_ASYNC_HPP_20100608 2 | #define BOOST_NETWORK_SUPPORT_IS_ASYNC_HPP_20100608 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Copyright 2010 (c) Sinefunc, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | 17 | template 18 | struct is_async : mpl::false_ {}; 19 | 20 | template 21 | struct is_async< 22 | Tag, typename enable_if::type> : mpl::true_ {}; 23 | 24 | } // namespace network 25 | } // namespace boost 26 | 27 | #endif // BOOST_NETWORK_SUPPORT_IS_ASYNC_HPP_2010608 28 | -------------------------------------------------------------------------------- /boost/network/support/is_default_string.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Dean Michael Berris 2010 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_SUPPORT_STRING_CHECK_20100808 7 | #define BOOST_NETWORK_SUPPORT_STRING_CHECK_20100808 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct is_default_string : mpl::false_ {}; 17 | 18 | template 19 | struct is_default_string< 20 | Tag, 21 | typename enable_if::type> : mpl::true_ {}; 22 | 23 | } // namespace network 24 | } // namespace boost 25 | 26 | #endif // BOOST_NETWORK_SUPPORT_STRING_CHECK_20100808 27 | -------------------------------------------------------------------------------- /boost/network/support/is_default_wstring.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Dean Michael Berris 2010 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_SUPPORT_WSTRING_CHECK_20100808 7 | #define BOOST_NETWORK_SUPPORT_WSTRING_CHECK_20100808 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | 14 | template 15 | struct is_default_wstring : mpl::false_ {}; 16 | 17 | template 18 | struct is_default_wstring< 19 | Tag, 20 | typename enable_if::type> : mpl::true_ {}; 21 | 22 | } // namespace network 23 | } // namespace boost 24 | 25 | #endif // BOOST_NETWORK_SUPPORT_WSTRING_CHECK_20100808 26 | -------------------------------------------------------------------------------- /boost/network/support/is_http.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_HTTP_HPP_20100622 2 | #define BOOST_NETWORK_SUPPORT_IS_HTTP_HPP_20100622 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct is_http : mpl::false_ {}; 17 | 18 | template 19 | struct is_http::type> : mpl::true_ {}; 21 | 22 | } // namespace network 23 | 24 | } // namespace boost 25 | 26 | #endif // BOOST_NETWORK_SUPPORT_IS_HTTP_HPP_20100622 27 | -------------------------------------------------------------------------------- /boost/network/support/is_keepalive.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_KEEPALIVE_HPP_20100927 2 | #define BOOST_NETWORK_SUPPORT_IS_KEEPALIVE_HPP_20100927 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct is_keepalive : mpl::false_ {}; 17 | 18 | template 19 | struct is_keepalive< 20 | Tag, typename enable_if::type> : mpl::true_ {}; 21 | 22 | } /* network */ 23 | 24 | } /* boost */ 25 | 26 | #endif /* BOOST_NETWORK_SUPPORT_IS_KEEPALIVE_HPP_20100927 */ 27 | -------------------------------------------------------------------------------- /boost/network/support/is_pod.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_POD_HPP_20101120 2 | #define BOOST_NETWORK_SUPPORT_IS_POD_HPP_20101120 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct is_pod : mpl::false_ {}; 17 | 18 | template 19 | struct is_pod::type> : mpl::true_ {}; 21 | 22 | } // namespace network 23 | // namespace network 24 | /* network */ 25 | 26 | } // namespace boost 27 | // namespace boost 28 | /* boost */ 29 | 30 | #endif /* BOOST_NETWORK_SUPPORT_IS_POD_HPP_20101120 */ 31 | -------------------------------------------------------------------------------- /boost/network/support/is_simple.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_SIMPLE_HPP_20100927 2 | #define BOOST_NETWORK_SUPPORT_IS_SIMPLE_HPP_20100927 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct is_simple : mpl::false_ {}; 17 | 18 | template 19 | struct is_simple< 20 | Tag, typename enable_if::type> : mpl::true_ {}; 21 | 22 | } /* network */ 23 | 24 | } /* boost */ 25 | 26 | #endif /* BOOST_NETWORK_SUPPORT_IS_SIMPLE_HPP_20100927 */ 27 | -------------------------------------------------------------------------------- /boost/network/support/is_sync.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_SYNC_HPP_20100623 2 | #define BOOST_NETWORK_SUPPORT_IS_SYNC_HPP_20100623 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct is_sync : mpl::false_ {}; 17 | 18 | template 19 | struct is_sync::type> : mpl::true_ {}; 21 | 22 | } // namespace network 23 | 24 | } // namespace boost 25 | 26 | #endif // BOOST_NETWORK_SUPPORT_IS_SYNC_HPP_20100623 27 | -------------------------------------------------------------------------------- /boost/network/support/is_tcp.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_TCP_HPP_20100622 2 | #define BOOST_NETWORK_SUPPORT_IS_TCP_HPP_20100622 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | 16 | template 17 | struct is_tcp : mpl::false_ {}; 18 | 19 | template 20 | struct is_tcp::type> : mpl::true_ {}; 22 | 23 | } // namespace network 24 | 25 | } // namespace boost 26 | 27 | #endif // BOOST_NETWORK_SUPPORT_IS_TCP_HPP_20100622 28 | -------------------------------------------------------------------------------- /boost/network/support/is_udp.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_SUPPORT_IS_UDP_HPP_20100622 2 | #define BOOST_NETWORK_SUPPORT_IS_UDP_HPP_20100622 3 | 4 | // Copyright 2010 (c) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | 17 | template 18 | struct is_udp : mpl::false_ {}; 19 | 20 | template 21 | struct is_udp::type> : mpl::true_ {}; 23 | 24 | } // namespace network 25 | 26 | } // namespace boost 27 | 28 | #endif // BOOST_NETWORK_SUPPORT_IS_UDP_HPP_20100622 29 | -------------------------------------------------------------------------------- /boost/network/support/pod_or_normal.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_POD_OR_NORMAL_HPP_20101128 2 | #define BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_POD_OR_NORMAL_HPP_20101128 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | 16 | template 17 | struct pod_or_normal { 18 | typedef tags::normal type; 19 | }; 20 | 21 | template 22 | struct pod_or_normal< 23 | Tag, typename enable_if::type> : tags::pod {}; 24 | 25 | } // namespace network 26 | } // namespace boost 27 | 28 | #endif /* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_POD_OR_NORMAL_HPP_20101128 */ 29 | -------------------------------------------------------------------------------- /boost/network/traits/char.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Dean Michael Berris 2008, 2009. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_TRAITS_CHAR_HPP 7 | #define BOOST_NETWORK_TRAITS_CHAR_HPP 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct unsupported_tag; 17 | 18 | template 19 | struct char_ { 20 | typedef unsupported_tag type; 21 | }; 22 | 23 | template 24 | struct char_ >::type> { 25 | typedef char type; 26 | }; 27 | 28 | template 29 | struct char_ >::type> { 30 | typedef wchar_t type; 31 | }; 32 | 33 | } // namespace network 34 | 35 | } // namespace boost 36 | 37 | #endif // BOOST_NETWORK_TRAITS_CHAR_HPP 38 | -------------------------------------------------------------------------------- /boost/network/traits/headers_container.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2009. 2 | // Copyright 2013 Google, Inc. 3 | // Copyright 2013 Dean Michael Berris 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #ifndef BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC 9 | #define BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace network { 17 | namespace impl { 18 | 19 | template 20 | struct headers_container_impl { 21 | typedef std::multimap::type, typename string::type> 22 | type; 23 | }; 24 | 25 | } // namespace impl 26 | 27 | template 28 | struct headers_container : impl::headers_container_impl {}; 29 | 30 | } // namespace network 31 | } // namespace boost 32 | 33 | #endif // __BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC__ 34 | -------------------------------------------------------------------------------- /boost/network/traits/istream.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BOOST_NETWORK_TRAITS_ISTREAM_HPP_20100924 3 | #define BOOST_NETWORK_TRAITS_ISTREAM_HPP_20100924 4 | 5 | // Copyright 2010 (C) Dean Michael Berris 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace network { 17 | 18 | template 19 | struct unsupported_tag; 20 | 21 | template 22 | struct istream { 23 | typedef unsupported_tag type; 24 | }; 25 | 26 | template 27 | struct istream >::type> { 28 | typedef std::istream type; 29 | }; 30 | 31 | template 32 | struct istream >::type> { 33 | typedef std::wistream type; 34 | }; 35 | 36 | } // namespace network 37 | /* network */ 38 | 39 | } // namespace boost 40 | /* boost */ 41 | 42 | #endif /* BOOST_NETWORK_TRAITS_ISTREAM_HPP_20100924 */ 43 | -------------------------------------------------------------------------------- /boost/network/traits/istringstream.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2009. 2 | // Copyright (c) Dean Michael Berris 2009. 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 | #ifndef BOOST_NETWORK_TRAITS_ISTRINGSTREAM_INC 8 | #define BOOST_NETWORK_TRAITS_ISTRINGSTREAM_INC 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace network { 17 | 18 | template 19 | struct unsupported_tag; 20 | 21 | template 22 | struct istringstream { 23 | typedef unsupported_tag type; 24 | }; 25 | 26 | template 27 | struct istringstream >::type> { 28 | typedef std::istringstream type; 29 | }; 30 | 31 | template 32 | struct istringstream >::type> { 33 | typedef std::basic_istringstream type; 34 | }; 35 | 36 | } // namespace network 37 | 38 | } // namespace boost 39 | 40 | #endif // BOOST_NETWORK_TRAITS_ISTRINGSTREAM_INC 41 | -------------------------------------------------------------------------------- /boost/network/traits/ostream_iterator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_TRAITS_OSTREAM_ITERATOR_HPP_20100815 2 | #define BOOST_NETWORK_TRAITS_OSTREAM_ITERATOR_HPP_20100815 3 | 4 | // Copyright 2010 (C) Dean Michael Berris 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | 17 | template 18 | struct unsupported_tag; 19 | 20 | template 21 | struct ostream_iterator; 22 | 23 | template 24 | struct ostream_iterator 25 | : mpl::if_, std::ostream_iterator, 26 | typename mpl::if_, 27 | std::ostream_iterator, 28 | unsupported_tag >::type> {}; 29 | 30 | } // namespace network 31 | 32 | } // namespace boost 33 | 34 | #endif // BOOST_NETWORK_TRAITS_OSTREAM_ITERATOR_HPP_20100815 35 | -------------------------------------------------------------------------------- /boost/network/traits/ostringstream.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2009. 2 | // Copyright (c) Dean Michael Berris 2009, 2010. 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 | #ifndef BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC 8 | #define BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace network { 17 | 18 | template 19 | struct unsupported_tag; 20 | 21 | template 22 | struct ostringstream { 23 | typedef unsupported_tag type; 24 | }; 25 | 26 | template 27 | struct ostringstream >::type> { 28 | typedef std::ostringstream type; 29 | }; 30 | 31 | template 32 | struct ostringstream >::type> { 33 | typedef std::wostringstream type; 34 | }; 35 | 36 | } // namespace network 37 | } // namespace boost 38 | 39 | #endif // BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC 40 | -------------------------------------------------------------------------------- /boost/network/traits/string.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Dean Michael Berris 2008, 2009. 2 | // Glyn Matthews 2009. 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 | #ifndef BOOST_NETWORK_TRAITS_STRING_INC 8 | #define BOOST_NETWORK_TRAITS_STRING_INC 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #ifndef BOOST_NETWORK_DEFAULT_STRING 15 | #define BOOST_NETWORK_DEFAULT_STRING std::string 16 | #endif 17 | 18 | #ifndef BOOST_NETWORK_DEFAULT_WSTRING 19 | #define BOOST_NETWORK_DEFAULT_WSTRING std::wstring 20 | #endif 21 | 22 | namespace boost { 23 | namespace network { 24 | 25 | template 26 | struct unsupported_tag; 27 | 28 | template 29 | struct string { 30 | typedef unsupported_tag type; 31 | }; 32 | 33 | template 34 | struct string >::type> { 35 | typedef BOOST_NETWORK_DEFAULT_STRING type; 36 | }; 37 | 38 | template 39 | struct string >::type> { 40 | typedef BOOST_NETWORK_DEFAULT_WSTRING type; 41 | }; 42 | 43 | } // namespace network 44 | } // namespace boost 45 | 46 | #endif // BOOST_NETWORK_TRAITS_STRING_INC 47 | -------------------------------------------------------------------------------- /boost/network/traits/vector.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Dean Michael Berris 2008, 2009. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_TRAITS_VECTOR_HPP 7 | #define BOOST_NETWORK_TRAITS_VECTOR_HPP 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | 15 | template 16 | struct unsupported_tag; 17 | 18 | template 19 | struct vector { 20 | 21 | template 22 | struct apply : mpl::if_, std::vector, 23 | unsupported_tag > {}; 24 | }; 25 | 26 | } // namespace network 27 | 28 | } // namespace boost 29 | 30 | #endif // BOOST_NETWORK_TRAITS_VECTOR_HPP 31 | -------------------------------------------------------------------------------- /boost/network/uri.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_URL_HPP_ 2 | #define BOOST_NETWORK_URL_HPP_ 3 | 4 | // Copyright 2009 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /boost/network/uri/config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef __BOOST_NETWORK_URI_CONFIG_INC__ 7 | #define __BOOST_NETWORK_URI_CONFIG_INC__ 8 | 9 | #include 10 | #include 11 | 12 | #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_URI_DYN_LINK) 13 | #define BOOST_URI_DECL 14 | #else 15 | #define BOOST_URI_DECL 16 | #endif // defined(BOOST_ALL_DYN_LINK) || defined(BOOST_URI_DYN_LINK) 17 | 18 | #endif // __BOOST_NETWORK_URI_CONFIG_INC__ 19 | -------------------------------------------------------------------------------- /boost/network/uri/directives.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef __BOOST_NETWORK_URI_DIRECTIVES_INC__ 7 | #define __BOOST_NETWORK_URI_DIRECTIVES_INC__ 8 | 9 | #include 10 | #include 11 | 12 | namespace boost { 13 | namespace network { 14 | namespace uri { 15 | inline uri &operator<<(uri &uri_, const uri &root_uri) { 16 | if (empty(uri_) && valid(root_uri)) { 17 | uri_.append(std::begin(root_uri), std::end(root_uri)); 18 | } 19 | return uri_; 20 | } 21 | 22 | template 23 | inline uri &operator<<(uri &uri_, const Directive &directive) { 24 | directive(uri_); 25 | return uri_; 26 | } 27 | } // namespace uri 28 | } // namespace network 29 | } // namespace boost 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #endif // __BOOST_NETWORK_URI_DIRECTIVES_INC__ 41 | -------------------------------------------------------------------------------- /boost/network/uri/directives/authority.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ 7 | #define BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | namespace uri { 14 | 15 | struct authority_directive { 16 | 17 | explicit authority_directive(std::string authority) 18 | : authority_(std::move(authority)) {} 19 | 20 | template 21 | void operator()(Uri &uri) const { 22 | uri.append(authority_); 23 | } 24 | 25 | std::string authority_; 26 | }; 27 | 28 | inline authority_directive authority(const std::string &authority) { 29 | return authority_directive(authority); 30 | } 31 | } // namespace uri 32 | } // namespace network 33 | } // namespace boost 34 | 35 | #endif // BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ 36 | -------------------------------------------------------------------------------- /boost/network/uri/directives/fragment.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ 7 | #define BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | namespace uri { 17 | struct fragment_directive { 18 | 19 | explicit fragment_directive(std::string fragment) 20 | : fragment_(std::move(fragment)) {} 21 | 22 | template 23 | void operator()(Uri &uri) const { 24 | uri.append("#"); 25 | uri.append(fragment_); 26 | } 27 | 28 | std::string fragment_; 29 | }; 30 | 31 | inline fragment_directive fragment(const std::string &fragment) { 32 | return fragment_directive(fragment); 33 | } 34 | } // namespace uri 35 | } // namespace network 36 | } // namespace boost 37 | 38 | #endif // BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ 39 | -------------------------------------------------------------------------------- /boost/network/uri/directives/host.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ 7 | #define BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace uri { 16 | struct host_directive { 17 | 18 | explicit host_directive(std::string host) : host_(std::move(host)) {} 19 | 20 | template 21 | void operator()(Uri &uri) const { 22 | uri.append(host_); 23 | } 24 | 25 | std::string host_; 26 | }; 27 | 28 | inline host_directive host(const std::string &host) { 29 | return host_directive(host); 30 | } 31 | } // namespace uri 32 | } // namespace network 33 | } // namespace boost 34 | 35 | #endif // BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ 36 | -------------------------------------------------------------------------------- /boost/network/uri/directives/path.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef __BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__ 7 | #define __BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | namespace uri { 17 | struct path_directive { 18 | 19 | explicit path_directive(std::string path) : path_(std::move(path)) {} 20 | 21 | template 22 | void operator()(Uri &uri) const { 23 | uri.append(path_); 24 | } 25 | 26 | std::string path_; 27 | }; 28 | 29 | struct encoded_path_directive { 30 | 31 | explicit encoded_path_directive(std::string path) : path_(std::move(path)) {} 32 | 33 | void operator()(uri &uri_) const { 34 | std::string encoded_path; 35 | encode(path_, std::back_inserter(encoded_path)); 36 | uri_.append(encoded_path); 37 | } 38 | 39 | std::string path_; 40 | }; 41 | 42 | inline path_directive path(const std::string &path) { 43 | return path_directive(path); 44 | } 45 | 46 | inline encoded_path_directive encoded_path(const std::string &path) { 47 | return encoded_path_directive(path); 48 | } 49 | 50 | } // namespace uri 51 | } // namespace network 52 | } // namespace boost 53 | 54 | #endif // __BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__ 55 | -------------------------------------------------------------------------------- /boost/network/uri/directives/port.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ 7 | #define BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace uri { 16 | struct port_directive { 17 | 18 | explicit port_directive(std::string port) : port_(std::move(port)) {} 19 | 20 | explicit port_directive(std::uint16_t port) 21 | : port_(std::to_string(port)) {} 22 | 23 | template 24 | void operator()(Uri &uri) const { 25 | uri.append(":"); 26 | uri.append(port_); 27 | } 28 | 29 | std::string port_; 30 | }; 31 | 32 | inline port_directive port(const std::string &port) { 33 | return port_directive(port); 34 | } 35 | 36 | inline port_directive port(std::uint16_t port) { 37 | return port_directive(port); 38 | } 39 | 40 | } // namespace uri 41 | } // namespace network 42 | } // namespace boost 43 | 44 | #endif // BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ 45 | -------------------------------------------------------------------------------- /boost/network/uri/directives/scheme.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef __BOOST_NETWORK_URI_DIRECTIVES_SCHEME_INC__ 7 | #define __BOOST_NETWORK_URI_DIRECTIVES_SCHEME_INC__ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace boost { 15 | namespace network { 16 | namespace uri { 17 | struct scheme_directive { 18 | 19 | explicit scheme_directive(std::string scheme) : scheme(std::move(scheme)) {} 20 | 21 | template 22 | void operator()(Uri &uri) const { 23 | uri.append(scheme); 24 | if (opaque_schemes::exists(scheme)) { 25 | uri.append(":"); 26 | } else { 27 | uri.append("://"); 28 | } 29 | } 30 | 31 | std::string scheme; 32 | }; 33 | 34 | inline scheme_directive scheme(const std::string &scheme) { 35 | return scheme_directive(scheme); 36 | } 37 | 38 | namespace schemes { 39 | inline uri &http(uri &uri_) { return uri_ << scheme("http"); } 40 | 41 | inline uri &https(uri &uri_) { return uri_ << scheme("https"); } 42 | 43 | inline uri &file(uri &uri_) { return uri_ << scheme("file"); } 44 | } // namespace schemes 45 | } // namespace uri 46 | } // namespace network 47 | } // namespace boost 48 | 49 | #endif // __BOOST_NETWORK_URI_DIRECTIVES_SCHEME_INC__ 50 | -------------------------------------------------------------------------------- /boost/network/uri/directives/user_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ 7 | #define BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | namespace network { 15 | namespace uri { 16 | struct user_info_directive { 17 | 18 | explicit user_info_directive(std::string user_info) 19 | : user_info_(std::move(user_info)) {} 20 | 21 | template 22 | void operator()(Uri &uri) const { 23 | uri.append(user_info_); 24 | uri.append("@"); 25 | } 26 | 27 | std::string user_info_; 28 | }; 29 | 30 | inline user_info_directive user_info(const std::string &user_info) { 31 | return user_info_directive(user_info); 32 | } 33 | } // namespace uri 34 | } // namespace network 35 | } // namespace boost 36 | 37 | #endif // BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ 38 | -------------------------------------------------------------------------------- /boost/network/uri/schemes.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Glyn Matthews. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef __BOOST_NETWORK_URI_SCHEMES_INC__ 7 | #define __BOOST_NETWORK_URI_SCHEMES_INC__ 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | namespace uri { 14 | class hierarchical_schemes { 15 | 16 | public: 17 | static bool exists(const std::string &scheme); 18 | }; 19 | 20 | class opaque_schemes { 21 | 22 | public: 23 | static bool exists(const std::string &scheme); 24 | }; 25 | } // namespace uri 26 | } // namespace network 27 | } // namespace boost 28 | 29 | #endif // __BOOST_NETWORK_URI_SCHEMES_INC__ 30 | -------------------------------------------------------------------------------- /boost/network/uri/uri_io.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011, 2012. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef __BOOST_NETWORK_URI_URI_IO_INC__ 7 | #define __BOOST_NETWORK_URI_URI_IO_INC__ 8 | 9 | #include 10 | 11 | namespace boost { 12 | namespace network { 13 | namespace uri { 14 | 15 | inline std::ostream &operator<<(std::ostream &os, const uri &uri_) { 16 | return os << uri_.string(); 17 | } 18 | } // namespace uri 19 | } // namespace network 20 | } // namespace boost 21 | 22 | #endif // __BOOST_NETWORK_URI_URI_IO_INC__ 23 | -------------------------------------------------------------------------------- /boost/network/version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_NETWORK_VERSION_HPP_20091214 2 | #define BOOST_NETWORK_VERSION_HPP_20091214 3 | 4 | // Copyright 2009, 2013 Dean Michael Berris 5 | // Copyright Glyn Matthews 2010. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | 12 | #define BOOST_NETLIB_VERSION_MAJOR 0 13 | #define BOOST_NETLIB_VERSION_MINOR 12 14 | #define BOOST_NETLIB_VERSION_INCREMENT 0 15 | 16 | #ifndef BOOST_NETLIB_VERSION 17 | #define BOOST_NETLIB_VERSION \ 18 | BOOST_STRINGIZE(BOOST_NETLIB_VERSION_MAJOR) "." BOOST_STRINGIZE( \ 19 | BOOST_NETLIB_VERSION_MINOR) "." BOOST_STRINGIZE(BOOST_NETLIB_VERSION_INCREMENT) 20 | #endif // BOOST_NETLIB_VERSION 21 | 22 | #endif // BOOST_NETWORK_VERSION_HPP_20091214 23 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p build 5 | cd build 6 | cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ 7 | -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ 8 | -DCPP-NETLIB_ENABLE_HTTPS=$ENABLE_HTTPS \ 9 | -DBOOST_INCLUDEDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/include" \ 10 | -DBOOST_LIBRARYDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/lib" \ 11 | -DCMAKE_CXX_FLAGS="-std=c++11 ${CMAKE_CXX_FLAGS}" \ 12 | .. 13 | make -j2 14 | make test 15 | cd .. 16 | -------------------------------------------------------------------------------- /cppnetlibConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the cppnetlib package 2 | # It defines the following variables 3 | # CPPNETLIB_INCLUDE_DIRS - include directories for cppnetlib 4 | # CPPNETLIB_LIBRARIES - libraries to link against 5 | # CPPNETLIB_EXECUTABLE - the bar executable 6 | 7 | # Compute paths 8 | get_filename_component(CPPNETLIB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 9 | set(CPPNETLIB_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") 10 | 11 | # Our library dependencies (contains definitions for IMPORTED targets) 12 | if( NOT TARGET cppnetlib-client-connections 13 | AND NOT TARGET cppnetlib-server-parsers 14 | AND NOT TARGET cppnetlib-uri 15 | AND NOT CPPNETLIB_BINARY_DIR) 16 | include("${CPPNETLIB_CMAKE_DIR}/cppnetlibTargets.cmake") 17 | endif() 18 | 19 | # These are IMPORTED targets created by cppnetlibTargets.cmake 20 | set(CPPNETLIB_LIBRARIES 21 | cppnetlib-client-connections 22 | cppnetlib-server-parsers 23 | cppnetlib-uri) 24 | #set(CPPNETLIB_EXECUTABLE ...) # maybe the examples? 25 | -------------------------------------------------------------------------------- /cppnetlibConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "@CPPNETLIB_VERSION_STRING@") 2 | 3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 4 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 5 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 6 | else() 7 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 8 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 9 | set(PACKAGE_VERSION_EXACT TRUE) 10 | endif() 11 | endif() -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Automatic redirection failed, please go to index.html. 15 | 16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /install-boost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then 5 | wget -O boost_${BOOST_VERSION}.tar.bz2 http://sourceforge.net/projects/boost/files/boost/${BOOST_VER}/boost_${BOOST_VERSION}.tar.bz2/download 6 | tar jxf boost_${BOOST_VERSION}.tar.bz2 7 | cd boost_${BOOST_VERSION} 8 | ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} 9 | ./b2 --stagedir=. -j4 --layout=tagged variant=debug,release link=shared threading=multi address-model=64 cxxflags='-std=c++11' install >boost-build.log 2>&1 10 | cd .. 11 | rm -rf boost_${BOOST_VERSION} 12 | rm -rf boost_${BOOST_VERSION}.tar.bz2 13 | fi 14 | -------------------------------------------------------------------------------- /libs/mime/To-Do.txt: -------------------------------------------------------------------------------- 1 | To Do list for Boost.Mime: 2 | 3 | General: 4 | * Finish the test suites 5 | ** Compare results to python parser 6 | ** Try to parse some bad mime inputs 7 | --> Added 0019-NoBoundary test 8 | * Integrate into cpp-netlib 9 | * Write some docs 10 | 11 | Specific: 12 | * Rename make_mime into something better. Parse, Encode? 13 | --> Changed the name to 'parse_mime', and made the stream and iterator versions use the same name 14 | * Start using boost::exception 15 | * Look into making the parsing restartable 16 | * Figure out how to -------------------------------------------------------------------------------- /libs/mime/doc/quick_start.qbk: -------------------------------------------------------------------------------- 1 | [/ 2 | (C) Copyright 2010 Marshall Clow 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:quick_start Quick Start] 10 | 11 | [endsect] [/ quick_start] 12 | -------------------------------------------------------------------------------- /libs/mime/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CPP-NETLIB_SOURCE_DIR}) 2 | file ( COPY TestMessages DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) 3 | 4 | #This test causes a "too many sections" error on Windows MinGW64 5 | #(MSVC has /bigobj, MinGW does not) 6 | if (NOT(${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows")) 7 | if ( Boost_FOUND ) 8 | add_executable ( mime-roundtrip mime-roundtrip.cpp ) 9 | target_link_libraries ( mime-roundtrip ${Boost_LIBRARIES} 10 | ${CMAKE_THREAD_LIBS_INIT}) 11 | set_target_properties( mime-roundtrip 12 | PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) 13 | add_test ( mime-roundtrip ${CPP-NETLIB_BINARY_DIR}/tests/mime-roundtrip ) 14 | endif () 15 | endif() 16 | 17 | -------------------------------------------------------------------------------- /libs/mime/test/TestMessages/.gitattributes: -------------------------------------------------------------------------------- 1 | * -crlf 2 | -------------------------------------------------------------------------------- /libs/mime/test/mimeParse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # A python program to compare against the output from "mime-structure" tool. 4 | # 5 | # Usage: python mimeParse.py 6 | # 7 | 8 | import sys 9 | import email 10 | 11 | def parseOne ( msg, title, prefix ): 12 | # if prefix != "": 13 | # print msg 14 | if title != None: 15 | print "%sData from: %s" % ( prefix, title ) 16 | print "%sContent-Type: %s" % ( prefix, msg.get_content_type ()) 17 | print "%sThere are %d headers" % ( prefix, msg.__len__ ()) 18 | payload = msg.get_payload (); 19 | if msg.is_multipart (): 20 | print "%sThere are %s sub parts" % ( prefix, len ( payload )) 21 | for p in payload: 22 | parseOne ( p, None, prefix + " " ) 23 | else: 24 | bodyLen = 0 25 | aBody = "" 26 | for p in payload: 27 | bodyLen += len (p) 28 | aBody += p 29 | 30 | print "%sThe body is %d bytes long" % ( prefix, bodyLen ) 31 | print prefix, 32 | if bodyLen < 10: 33 | for c in aBody: 34 | print ord(c), 35 | else: 36 | for i in range(0,5): 37 | print ord (aBody[i]), 38 | 39 | print "... ", 40 | for i in range(1,6): 41 | print ord (aBody[-i]), 42 | print '' 43 | 44 | # _structure ( msg ) 45 | 46 | 47 | def main(): 48 | for a in sys.argv[1:]: 49 | print "**********************************" 50 | parseOne ( email.message_from_file ( open ( a )), a, "" ) 51 | 52 | main () -------------------------------------------------------------------------------- /libs/network/benchmarks/README.rst: -------------------------------------------------------------------------------- 1 | Here we can collect some statistics about different areas of 2 | performance in the :mod:`cpp-netlib`, including run-time and 3 | compile-time. 4 | -------------------------------------------------------------------------------- /libs/network/build/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CPP-NETLIB_SOURCE_DIR}) 2 | find_package( Boost 1.45.0 COMPONENTS unit_test_framework system regex thread filesystem ) 3 | 4 | add_library(cppnetlib-uri STATIC ${CPP-NETLIB_SOURCE_DIR}/libs/network/src/parse_uri_impl.cpp) 5 | add_library(cppnetlib-server-parsers STATIC ${CPP-NETLIB_SOURCE_DIR}/libs/network/src/server_request_parsers_impl.cpp) 6 | 7 | -------------------------------------------------------------------------------- /libs/network/doc/.gitignore: -------------------------------------------------------------------------------- 1 | _build -------------------------------------------------------------------------------- /libs/network/doc/_ext/adjusts.py: -------------------------------------------------------------------------------- 1 | from sphinx.writers import html as sphinx_htmlwriter 2 | 3 | class CppNetlibHTMLTranslator(sphinx_htmlwriter.SmartyPantsHTMLTranslator): 4 | """ 5 | cpp-netlib-customized HTML transformations of documentation. Based on 6 | djangodocs.DjangoHTMLTranslator 7 | """ 8 | 9 | def visit_section(self, node): 10 | node['ids'] = map(lambda x: "cpp-netlib-%s" % x, node['ids']) 11 | sphinx_htmlwriter.SmartyPantsHTMLTranslator.visit_section(self, node) 12 | -------------------------------------------------------------------------------- /libs/network/doc/_static/Button-Info-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/_static/Button-Info-icon.png -------------------------------------------------------------------------------- /libs/network/doc/_static/Button-Warning-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/_static/Button-Warning-icon.png -------------------------------------------------------------------------------- /libs/network/doc/_static/ftp_uri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/_static/ftp_uri.png -------------------------------------------------------------------------------- /libs/network/doc/_static/http_uri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/_static/http_uri.png -------------------------------------------------------------------------------- /libs/network/doc/_static/mailto_uri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/_static/mailto_uri.png -------------------------------------------------------------------------------- /libs/network/doc/_static/orange-background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/_static/orange-background.jpg -------------------------------------------------------------------------------- /libs/network/doc/contents.rst: -------------------------------------------------------------------------------- 1 | .. _contents: 2 | 3 | Contents 4 | -------- 5 | 6 | .. toctree:: 7 | :maxdepth: 4 8 | 9 | index.rst 10 | whats_new.rst 11 | getting_started.rst 12 | examples.rst 13 | reference.rst 14 | references.rst 15 | -------------------------------------------------------------------------------- /libs/network/doc/examples.rst: -------------------------------------------------------------------------------- 1 | .. _examples: 2 | 3 | Examples 4 | ======== 5 | 6 | The :mod:`cpp-netlib` is a practical library that is designed to aid 7 | the development of applications for that need to communicate using 8 | common networking protocols. The following set of examples describe a 9 | series of realistic examples that use the :mod:`cpp-netlib` for these 10 | kinds of application. All examples are built using CMake. 11 | 12 | HTTP examples 13 | ````````````` 14 | 15 | The HTTP component of the :mod:`cpp-netlib` contains a client and server. 16 | The examples that follow show how to use both for programs that can be 17 | embedded into larger applications. 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | 22 | examples/http/http_client 23 | examples/http/simple_wget 24 | examples/http/hello_world_server 25 | examples/http/hello_world_client 26 | examples/http/atom_reader 27 | examples/http/twitter_search 28 | -------------------------------------------------------------------------------- /libs/network/doc/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: adbe6ea7ac2e69d5b593dfb1e312603d 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /libs/network/doc/html/_sources/contents.txt: -------------------------------------------------------------------------------- 1 | .. _contents: 2 | 3 | Contents 4 | -------- 5 | 6 | .. toctree:: 7 | :maxdepth: 4 8 | 9 | index.rst 10 | whats_new.rst 11 | getting_started.rst 12 | examples.rst 13 | reference.rst 14 | references.rst 15 | -------------------------------------------------------------------------------- /libs/network/doc/html/_sources/examples.txt: -------------------------------------------------------------------------------- 1 | .. _examples: 2 | 3 | Examples 4 | ======== 5 | 6 | The :mod:`cpp-netlib` is a practical library that is designed to aid 7 | the development of applications for that need to communicate using 8 | common networking protocols. The following set of examples describe a 9 | series of realistic examples that use the :mod:`cpp-netlib` for these 10 | kinds of application. All examples are built using CMake. 11 | 12 | HTTP examples 13 | ````````````` 14 | 15 | The HTTP component of the :mod:`cpp-netlib` contains a client and server. 16 | The examples that follow show how to use both for programs that can be 17 | embedded into larger applications. 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | 22 | examples/http/http_client 23 | examples/http/simple_wget 24 | examples/http/hello_world_server 25 | examples/http/hello_world_client 26 | examples/http/atom_reader 27 | examples/http/twitter_search 28 | -------------------------------------------------------------------------------- /libs/network/doc/html/_sources/reference.txt: -------------------------------------------------------------------------------- 1 | .. _reference: 2 | 3 | Reference Manual 4 | ================ 5 | 6 | This reference manual refers to the API documentation of the public interfaces 7 | to the different client and/or server implementations within :mod:`cpp-netlib`. 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | reference/http_client 13 | reference/http_request 14 | reference/http_response 15 | reference/http_server 16 | 17 | -------------------------------------------------------------------------------- /libs/network/doc/html/_sources/references.txt: -------------------------------------------------------------------------------- 1 | References 2 | ========== 3 | 4 | About :mod:`cpp-netlib` 5 | ~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | * `BoostCon 2010 Slides`_ 8 | * `BoostCon 2010 Paper`_ 9 | 10 | Other sources 11 | ~~~~~~~~~~~~~ 12 | 13 | * `Template Metaprogramming`_: The best guide to C++ template metaprogramming. 14 | * `HTTP 1.0`_: The HTTP 1.0 specification. 15 | * `HTTP 1.1 (RFC 2616)`_: The HTTP 1.1 specification. 16 | * `URI Generic Syntax (RFC 3986)`_: Generic URI syntax specification. 17 | * `Format for Literal IPv6 Addresses in URLs (RFC 2732)`_: Literal IPv6 Addresses in URLs. 18 | 19 | .. _`BoostCon 2010 Slides`: http://www.filetolink.com/b0e89d06 20 | .. _`BoostCon 2010 Paper`: http://github.com/downloads/mikhailberis/cpp-netlib-boostcon-paper/cpp-netlib.pdf 21 | .. _`Template Metaprogramming`: http://www.boostpro.com/mplbook/ 22 | .. _`HTTP 1.0`: http://www.w3.org/Protocols/HTTP/1.0/spec.html 23 | .. _`HTTP 1.1 (RFC 2616)`: http://www.w3.org/Protocols/rfc2616/rfc2616.html 24 | .. _`URI Generic Syntax (RFC 3986)`: http://www.ietf.org/rfc/rfc3986.txt 25 | .. _`Format for Literal IPv6 Addresses in URLs (RFC 2732)`: http://www.ietf.org/rfc/rfc2732.txt 26 | -------------------------------------------------------------------------------- /libs/network/doc/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /libs/network/doc/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/comment-bright.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/comment-close.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/comment.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/dialog-note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/dialog-note.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/dialog-seealso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/dialog-seealso.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/dialog-todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/dialog-todo.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/dialog-topic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/dialog-topic.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/dialog-warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/dialog-warning.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/down-pressed.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/down.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/file.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/footerbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/footerbg.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/headerbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/headerbg.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/ie6.css: -------------------------------------------------------------------------------- 1 | * html img, 2 | * html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none", 3 | this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')", 4 | this.src = "_static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''), 5 | this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')", 6 | this.runtimeStyle.backgroundImage = "none")),this.pngSet=true) 7 | );} 8 | -------------------------------------------------------------------------------- /libs/network/doc/html/_static/middlebg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/middlebg.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/minus.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/plus.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/transparent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/transparent.gif -------------------------------------------------------------------------------- /libs/network/doc/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/up-pressed.png -------------------------------------------------------------------------------- /libs/network/doc/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/_static/up.png -------------------------------------------------------------------------------- /libs/network/doc/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/doc/html/objects.inv -------------------------------------------------------------------------------- /libs/network/doc/reference.rst: -------------------------------------------------------------------------------- 1 | .. _reference: 2 | 3 | Reference Manual 4 | ================ 5 | 6 | This reference manual refers to the API documentation of the public interfaces 7 | to the different client and/or server implementations within :mod:`cpp-netlib`. 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | reference/http_client 13 | reference/http_request 14 | reference/http_response 15 | reference/http_server 16 | 17 | -------------------------------------------------------------------------------- /libs/network/doc/references.rst: -------------------------------------------------------------------------------- 1 | References 2 | ========== 3 | 4 | About :mod:`cpp-netlib` 5 | ~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | * `BoostCon 2010 Slides`_ 8 | * `BoostCon 2010 Paper`_ 9 | 10 | Other sources 11 | ~~~~~~~~~~~~~ 12 | 13 | * `Template Metaprogramming`_: The best guide to C++ template metaprogramming. 14 | * `HTTP 1.0`_: The HTTP 1.0 specification. 15 | * `HTTP 1.1 (RFC 2616)`_: The HTTP 1.1 specification. 16 | * `URI Generic Syntax (RFC 3986)`_: Generic URI syntax specification. 17 | * `Format for Literal IPv6 Addresses in URLs (RFC 2732)`_: Literal IPv6 Addresses in URLs. 18 | 19 | .. _`BoostCon 2010 Slides`: http://www.filetolink.com/b0e89d06 20 | .. _`BoostCon 2010 Paper`: http://github.com/downloads/mikhailberis/cpp-netlib-boostcon-paper/cpp-netlib.pdf 21 | .. _`Template Metaprogramming`: http://www.boostpro.com/mplbook/ 22 | .. _`HTTP 1.0`: http://www.w3.org/Protocols/HTTP/1.0/spec.html 23 | .. _`HTTP 1.1 (RFC 2616)`: http://www.w3.org/Protocols/rfc2616/rfc2616.html 24 | .. _`URI Generic Syntax (RFC 3986)`: http://www.ietf.org/rfc/rfc3986.txt 25 | .. _`Format for Literal IPv6 Addresses in URLs (RFC 2732)`: http://www.ietf.org/rfc/rfc2732.txt 26 | -------------------------------------------------------------------------------- /libs/network/example/atom/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "atom.hpp" 7 | #include 8 | #include 9 | 10 | int main(int argc, char *argv[]) { 11 | using namespace boost::network; 12 | 13 | if (argc != 2) { 14 | std::cout << "Usage: " << argv[0] << " " << std::endl; 15 | return 1; 16 | } 17 | 18 | try { 19 | http::client client; 20 | http::client::request request(argv[1]); 21 | request << header("Connection", "close"); 22 | http::client::response response = client.get(request); 23 | atom::feed feed(response); 24 | 25 | std::cout << "Feed: " << feed.title() << " (" << feed.subtitle() << ")" 26 | << std::endl; 27 | for (const atom::entry & entry : feed) { 28 | std::cout << entry.title() << " (" << entry.published() << ")" 29 | << std::endl; 30 | } 31 | } 32 | catch (std::exception &e) { 33 | std::cerr << e.what() << std::endl; 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /libs/network/example/http/hello_world_client.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2010. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | //[ hello_world_client_main 7 | /*` 8 | This is a part of the 'Hello World' example. We create a client 9 | object and make a single HTTP request. If we use make this request 10 | to the `hello_world_server`, then the output is simply "Hello, 11 | World!". 12 | */ 13 | #include 14 | #include 15 | 16 | namespace http = boost::network::http; 17 | 18 | int main(int argc, char *argv[]) { 19 | 20 | if (argc != 2) { 21 | std::cerr << "Usage: " << argv[0] << " url" << std::endl; 22 | return 1; 23 | } 24 | 25 | try { 26 | /*<< Creates the client. >>*/ 27 | http::client client; 28 | /*<< Creates a request using a URI supplied on the command 29 | line. >>*/ 30 | http::client::request request(argv[1]); 31 | /*<< Gets a response from the HTTP server. >>*/ 32 | http::client::response response = client.get(request); 33 | /*<< Prints the response body to the console. >>*/ 34 | std::cout << body(response) << std::endl; 35 | } 36 | catch (std::exception &e) { 37 | std::cerr << e.what() << std::endl; 38 | return 1; 39 | } 40 | 41 | return 0; 42 | } 43 | //] 44 | -------------------------------------------------------------------------------- /libs/network/example/http/one_liner.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2010. 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 | //[ http_one_liner_main 8 | /*` 9 | 10 | */ 11 | #include 12 | 13 | using namespace std; 14 | using namespace boost::network; 15 | using namespace boost::network::http; 16 | 17 | int main(int argc, const char *argv[]) { 18 | /*<< The client sends an HTTP request to the server, and the output 19 | is printed to the console. >>*/ 20 | cout << body(client().get(client::request("http://www.boost.org/"))); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /libs/network/example/http/ssl/dh2048.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIIBCAKCAQEA1wI+wQdLMRtQK+0EIXNg+g+J/EhIZedqdkSKKLIdclDAjUdbnDWJ 3 | rMR76tKGItPb0LkWHfxJkrziyvZRO2KWTThQ1Tz05x+OgM2ckHT+QsTxNqOosvdT 4 | pOtMt260WaXVYvHJ0CZgTo7+DUcXNYZW/xvSW206RW9oJIgqCFrhUrKGpVFuqLZZ 5 | Nwjy62Ueg3TUwE5D5K0xgUjyCAuHZmeI2uQUbJS6u9GeraV5h0QtH3njDS6mD64v 6 | cN5MqQXO1UTl4sQUhDPamyiJz57/o/jinHJUDLz1FGS8kOR8ecYAx8JryFgm4qPd 7 | +MYaDDIJku8f19Rnjb1SI/Y28uHL9X2dswIBAg== 8 | -----END DH PARAMETERS----- 9 | -------------------------------------------------------------------------------- /libs/network/example/http_client1.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Dean Michael Berris 2011. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include 8 | 9 | int main(int argc, char* argv[]) { 10 | using namespace boost::network; 11 | 12 | if (argc != 2) { 13 | std::cout << "Usage: " << argv[0] << " " << std::endl; 14 | return 1; 15 | } 16 | 17 | http::client client; 18 | http::client::request request(argv[1]); 19 | request << header("Connection", "close"); 20 | http::client::response response = client.get(request); 21 | std::cout << body(response) << std::endl; 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /libs/network/example/rss/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "rss.hpp" 7 | #include 8 | #include 9 | 10 | int main(int argc, char *argv[]) { 11 | using namespace boost::network; 12 | 13 | if (argc != 2) { 14 | std::cout << "Usage: " << argv[0] << " " << std::endl; 15 | return 1; 16 | } 17 | 18 | try { 19 | http::client client; 20 | http::client::request request(argv[1]); 21 | request << header("Connection", "close"); 22 | http::client::response response = client.get(request); 23 | rss::channel channel(response); 24 | 25 | std::cout << "Channel: " << channel.title() << " (" << channel.description() 26 | << ")" << std::endl; 27 | for (const rss::item & item : channel) { 28 | std::cout << item.title() << " (" << item.author() << ")" << std::endl; 29 | } 30 | } 31 | catch (std::exception &e) { 32 | std::cerr << e.what() << std::endl; 33 | } 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /libs/network/example/simple_wget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2009, 2010. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | //[ simple_wget_main 7 | /*` 8 | This is a very basic clone of wget. It's missing a lot of 9 | features, such as content-type detection, but it does the 10 | fundamental things the same. 11 | 12 | It demonstrates the use the `uri` and the `http::client`. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | namespace http = boost::network::http; 22 | namespace uri = boost::network::uri; 23 | 24 | namespace { 25 | std::string get_filename(const uri::uri &url) { 26 | std::string path = uri::path(url); 27 | std::size_t index = path.find_last_of('/'); 28 | std::string filename = path.substr(index + 1); 29 | return filename.empty() ? "index.html" : filename; 30 | } 31 | } // namespace 32 | 33 | int main(int argc, char *argv[]) { 34 | 35 | if (argc != 2) { 36 | std::cerr << "Usage: " << argv[0] << " url" << std::endl; 37 | return 1; 38 | } 39 | 40 | http::client client; 41 | try { 42 | http::client::request request(argv[1]); 43 | http::client::response response = client.get(request); 44 | 45 | std::string filename = get_filename(request.uri()); 46 | std::cout << "Saving to: " << filename << std::endl; 47 | std::ofstream ofs(filename.c_str()); 48 | ofs << static_cast(body(response)) << std::endl; 49 | } 50 | catch (std::exception &e) { 51 | std::cerr << e.what() << std::endl; 52 | return 1; 53 | } 54 | 55 | return 0; 56 | } 57 | //] 58 | -------------------------------------------------------------------------------- /libs/network/example/trivial_google.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Dean Michael Berris 2 | // Copyright 2014 Google, Inc. 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 | #include 8 | 9 | #include 10 | 11 | namespace http = boost::network::http; 12 | 13 | int main(int, char * []) { 14 | http::client client; 15 | http::client::request request("https://www.google.com/"); 16 | http::client::response response = client.get(request); 17 | std::cout << body(response) << std::endl; 18 | } 19 | -------------------------------------------------------------------------------- /libs/network/example/uri_builder.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2011. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace boost::network; 11 | 12 | int main(int argc, char *argv[]) { 13 | 14 | uri::uri url; 15 | url << uri::scheme("http") << uri::host("www.github.com") 16 | << uri::path("/cpp-netlib"); 17 | std::cout << url << std::endl; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /libs/network/experiment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Google, Inc. 2 | # Copyright 2010 Dean Michael Berris 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 | # Commenting this out until it's ready for prime-time later on. 8 | # include_directories(${CPP-NETLIB_SOURCE_DIR}) 9 | # set(CMAKE_BUILD_TYPE Release) 10 | # if (Boost_FOUND) 11 | # add_executable(cpp-netlib-utils_base64_experiment utils_base64_experiment.cpp) 12 | # target_link_libraries(cpp-netlib-utils_base64_experiment ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 13 | # if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") 14 | # target_link_libraries(cpp-netlib-utils_base64_experiment rt) 15 | # endif() 16 | # set_target_properties(cpp-netlib-utils_base64_experiment 17 | # PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) 18 | # endif() 19 | -------------------------------------------------------------------------------- /libs/network/src/client.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2011 Dean Michael Berris (dberris@google.com). 3 | // Copyright 2011 Google, Inc. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #ifdef BOOST_NETWORK_NO_LIB 9 | #warn Building the library even with BOOST_NETWORK_NO_LIB defined. 10 | #undef BOOST_NETWORK_NO_LIB 11 | #endif 12 | 13 | #include 14 | 15 | #ifdef BOOST_NETWORK_ENABLE_HTTPS 16 | #include 17 | #endif 18 | -------------------------------------------------------------------------------- /libs/network/src/server_request_parsers_impl.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Dean Michael Berris. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifdef BOOST_NETWORK_NO_LIB 7 | #undef BOOST_NETWORK_NO_LIB 8 | #endif 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /libs/network/src/uri/uri.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Glyn Matthews. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | -------------------------------------------------------------------------------- /libs/network/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Dean Michael Berris 2010. 2 | # Copyright 2015 Google, Inc. 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 | include_directories(${CPP-NETLIB_SOURCE_DIR} ${gtest_SOURCE_DIR}/include) 8 | 9 | add_subdirectory(uri) 10 | add_subdirectory(http) 11 | 12 | if (Boost_FOUND) 13 | set(TESTS message_test message_transform_test utils_thread_pool 14 | # utils_base64_test -- turn on when ready. 15 | ) 16 | foreach (test ${TESTS}) 17 | if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU) 18 | set_source_files_properties(${test}.cpp 19 | PROPERTIES COMPILE_FLAGS "-Wall") 20 | endif() 21 | add_executable(cpp-netlib-${test} ${test}.cpp) 22 | add_dependencies(cpp-netlib-${test} cppnetlib-uri gtest_main) 23 | target_link_libraries(cpp-netlib-${test} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri gtest_main) 24 | if (OPENSSL_FOUND) 25 | target_link_libraries(cpp-netlib-${test} ${OPENSSL_LIBRARIES}) 26 | endif() 27 | if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") 28 | target_link_libraries(cpp-netlib-${test} ws2_32 wsock32) 29 | endif() 30 | if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") 31 | target_link_libraries(cpp-netlib-${test} rt) 32 | endif() 33 | set_target_properties(cpp-netlib-${test} 34 | PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) 35 | add_test(cpp-netlib-${test} 36 | ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-${test}) 37 | endforeach (test) 38 | 39 | # Also copy the server directory to the root of the build directory. 40 | file(COPY server DESTINATION ${CPP-NETLIB_BINARY_DIR}/libs/network/test/) 41 | endif() 42 | -------------------------------------------------------------------------------- /libs/network/test/client_server_include_failure.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2010. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #define BOOST_TEST_MODULE Client and server includes 7 | #include 8 | 9 | // 10 | // The problem here is a bizarre compilation failure in including 11 | // these two files, and instantiating a client. It's described at 12 | // http://github.com/cpp-netlib/cpp-netlib/issues#issue/13 13 | // 14 | #include 15 | #include 16 | 17 | BOOST_AUTO_TEST_CASE(test1) { 18 | typedef boost::network::http::basic_client< 19 | boost::network::http::tags::http_keepalive_8bit_udp_resolve, 1, 1> 20 | http_client; 21 | http_client client; 22 | } 23 | -------------------------------------------------------------------------------- /libs/network/test/http/client_constructor_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2010 Dean Michael Berris. 3 | // Copyright 2015 Google, Inc. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // Migrated from using Boost.Test to using googletest intead. 9 | #include 10 | 11 | #include 12 | #include "client_types.hpp" 13 | 14 | namespace http = boost::network::http; 15 | 16 | TYPED_TEST_CASE(HTTPClientTest, ClientTypes); 17 | 18 | TYPED_TEST(HTTPClientTest, Constructors) { 19 | typename TypeParam::options options; 20 | TypeParam instance; 21 | TypeParam instance2( 22 | options.io_service(std::make_shared())); 23 | } 24 | 25 | TYPED_TEST(HTTPClientTest, ConstructorsWithOptions) { 26 | typename TypeParam::options options; 27 | TypeParam instance(options.follow_redirects(true).cache_resolved(true)); 28 | TypeParam instance2( 29 | options.openssl_certificate("foo").openssl_verify_path("bar")); 30 | TypeParam instance3( 31 | options.openssl_certificate_file("foo").openssl_private_key_file("bar")); 32 | TypeParam instance4( 33 | options.follow_redirects(true) 34 | .io_service(std::make_shared()) 35 | .cache_resolved(true)); 36 | } 37 | -------------------------------------------------------------------------------- /libs/network/test/http/client_get_different_port_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2010 Dean Michael Berris. 3 | // Copyright 2016 Google, Inc. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #include 9 | #include 10 | #include "client_types.hpp" 11 | 12 | namespace net = boost::network; 13 | namespace http = boost::network::http; 14 | 15 | TYPED_TEST_CASE(HTTPClientTest, ClientTypes); 16 | 17 | TYPED_TEST(HTTPClientTest, GetDifferentPort) { 18 | TypeParam client; 19 | typename TypeParam::request r("http://www.boost.org:80/"); 20 | auto response_ = client.get(r); 21 | auto range = headers(response_)["Content-Type"]; 22 | EXPECT_TRUE(std::begin(range) != std::end(range)); 23 | EXPECT_NE(0, body(response_).size()); 24 | } 25 | -------------------------------------------------------------------------------- /libs/network/test/http/client_get_streaming_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Dean Michael Berris <mikhailberis@gmail.com>. 2 | // Copyright 2016 Google, Inc. 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 | #include 8 | #include 9 | #include 10 | #include "client_types.hpp" 11 | 12 | namespace net = boost::network; 13 | namespace http = boost::network::http; 14 | 15 | struct body_handler { 16 | explicit body_handler(std::string& body) : body(body) {} 17 | 18 | BOOST_NETWORK_HTTP_BODY_CALLBACK(operator(), range, error) { 19 | (void)error; 20 | body.append(std::begin(range), std::end(range)); 21 | } 22 | 23 | std::string& body; 24 | }; 25 | 26 | TYPED_TEST_CASE(HTTPClientTest, ClientTypes); 27 | 28 | TYPED_TEST(HTTPClientTest, GetStreamingTest) { 29 | typename TypeParam::request request("http://www.boost.org"); 30 | typename TypeParam::response response; 31 | typename TypeParam::string_type body_string; 32 | typename TypeParam::string_type dummy_body; 33 | body_handler handler_instance(body_string); 34 | { 35 | TypeParam client_; 36 | ASSERT_NO_THROW(response = client_.get(request, handler_instance)); 37 | auto range = headers(response)["Content-Type"]; 38 | ASSERT_TRUE(!boost::empty(range)); 39 | EXPECT_EQ(0u, body(response).size()); 40 | EXPECT_EQ("HTTP/1.", response.version().substr(0, 7)); 41 | EXPECT_EQ(200u, response.status()); 42 | EXPECT_EQ("OK", response.status_message()); 43 | dummy_body = body(response); 44 | } 45 | EXPECT_EQ(dummy_body, typename TypeParam::string_type()); 46 | } 47 | -------------------------------------------------------------------------------- /libs/network/test/http/client_types.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_TYPES_ROOWQCLE 2 | #define CLIENT_TYPES_ROOWQCLE 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Copyright 2015 Google, Inc. 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | #include 11 | #include 12 | #include "tag_types.hpp" 13 | #include 14 | 15 | // HTTPClientTest is a re-usable fixture for client tests that need to test 16 | // various variations of the client. This is to be used with googletest's 17 | // type-parameteric tests: 18 | // 19 | // using ClientTypes = ::testing::Types< 20 | // std::tuple, std::tuple>; 21 | // INSTANTIATE_TYPED_TEST_CASE_P(MyTest, HTTPClientTest, ClientTypes) 22 | // 23 | // We also already provide ClientTypes as a convenience in this header for all 24 | // known and supported client type implementations in the library. 25 | // 26 | // T must be a tuple in the form: . 27 | template 28 | class HTTPClientTest : public ::testing::Test { 29 | public: 30 | using ClientType = T; 31 | }; 32 | 33 | // This is the list of known ClientTypes for testing. 34 | using ClientTypes = ::testing::Types< 35 | boost::network::http::basic_client< 36 | boost::network::http::tags::http_default_8bit_tcp_resolve, 1, 0>, 37 | boost::network::http::basic_client< 38 | boost::network::http::tags::http_default_8bit_tcp_resolve, 1, 1>, 39 | boost::network::http::basic_client< 40 | boost::network::http::tags::http_default_8bit_udp_resolve, 1, 0>, 41 | boost::network::http::basic_client< 42 | boost::network::http::tags::http_default_8bit_udp_resolve, 1, 1>>; 43 | 44 | #endif /* CLIENT_TYPES_ROOWQCLE */ 45 | -------------------------------------------------------------------------------- /libs/network/test/http/message_async_ready_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2010 Dean Michael Berris. 3 | // Copyright 2016 Google, Inc. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #include 9 | #include 10 | #include "tag_types.hpp" 11 | 12 | namespace http = boost::network::http; 13 | 14 | template 15 | class MessageTest : public ::testing::Test {}; 16 | 17 | TYPED_TEST_CASE(MessageTest, TagTypes); 18 | 19 | TYPED_TEST(MessageTest, UnreadyStateResponseTest) { 20 | using response = http::basic_response; 21 | response r; 22 | EXPECT_FALSE(ready(r)); 23 | } 24 | -------------------------------------------------------------------------------- /libs/network/test/http/tag_types.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TAG_TYPES_4NNM8B5T 2 | #define TAG_TYPES_4NNM8B5T 3 | 4 | // Copyright 2010 Dean Michael Berris. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | using TagTypes = 13 | ::testing::Types; 17 | 18 | #endif /* TAG_TYPES_4NNM8B5T */ 19 | -------------------------------------------------------------------------------- /libs/network/test/message_transform_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Dean Michael Berris 2007. 3 | // Copyright 2015, Google, Inc. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | TEST(MessageTransformTest, TransformToUpper) { 13 | using namespace boost::network; 14 | 15 | message msg; 16 | msg << source("me"); 17 | ASSERT_EQ("me",source(msg)); 18 | msg << transform(to_upper_, source_); 19 | ASSERT_EQ("ME",source(msg)); 20 | msg << destination("you"); 21 | ASSERT_EQ("you",destination(msg)); 22 | msg << transform(to_upper_, destination_); 23 | ASSERT_EQ("YOU",destination(msg)); 24 | } 25 | 26 | TEST(MessageTransformTest, TransformToLower) { 27 | using namespace boost::network; 28 | 29 | message msg; 30 | msg << source("ME"); 31 | ASSERT_EQ("ME",source(msg)); 32 | msg << transform(to_lower_, source_); 33 | ASSERT_EQ("me",source(msg)); 34 | msg << destination("YOU"); 35 | ASSERT_EQ("YOU",destination(msg)); 36 | msg << transform(to_lower_, destination_); 37 | ASSERT_EQ("you",destination(msg)); 38 | } 39 | -------------------------------------------------------------------------------- /libs/network/test/server/boost.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/cpp-netlib/89f97682ba7ba68291b1ca9be21303d9c9d1c052/libs/network/test/server/boost.jpg -------------------------------------------------------------------------------- /libs/network/test/server/certificate.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICAzCCAWwCCQDVrANJOmGIcjANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB 3 | VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0 4 | cyBQdHkgTHRkMCAXDTA5MTIxNzIzMTcwN1oYDzE5MTcwMzExMTAyMDM1WjBFMQsw 5 | CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu 6 | ZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCw 7 | c3j9E+LMKqw2PBf/a5zLIAfNxDadFW2OB3S85kXgr72x/00oi5JiPOeA7LGrmhuJ 8 | +nDXiO+AWL1O6fOzOkyTd0Nh1hCHJzjrJEfIt3iqdQGHiocVupWN5iCQRzCrErbP 9 | vtvvs/r7mMheb9W3q9lntKPwiZ7mmr/daYdAbVuQpQIDAQABMA0GCSqGSIb3DQEB 10 | BQUAA4GBAHz1OhxKYSc5kYmgkMYYwtmHFWWTL2jy6xk4+yv5sGAmze4dvtQqCNiA 11 | TaljCHWdAkHaXXBzbZ7+e3qem2M1Y31HqO0ZiQezpJ1TFLPc5/0uNX8JIPovb+s7 12 | c/wevNe16tw4dhM0DQ2V3FH8AwiQANUtZ8yFk91RH4rTaQBQDYOE 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /libs/network/test/server/cgi-bin/cgisupport.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright Kim Grasman 2008. 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http:#www.boost.org/LICENSE_1_0.txt) 7 | # 8 | 9 | class http_headers: 10 | def __init__(self, header_str): 11 | self.parse(header_str) 12 | 13 | def raw_headers(self): 14 | return self.raw 15 | 16 | def iteritems(self): 17 | return self.headers.iteritems() 18 | 19 | def value(self, name): 20 | return self.headers[name] 21 | 22 | def parse(self, header_str): 23 | self.raw = header_str 24 | self.headers = self.__parse_headers(header_str) 25 | 26 | def __parse_headers(self, str): 27 | dict = {} 28 | 29 | # I'm sure there are better ways to do this in Python, 30 | # but I don't know my way around so well 31 | lines = str.split('\n') 32 | for line in lines: 33 | header = line.split(': ') 34 | if len(header) > 0: 35 | name = header[0] 36 | if len(header) > 1: 37 | value = ': '.join(header[1:]) # re-join the rest of the items as value 38 | 39 | if len(name) > 0: 40 | dict[name] = value 41 | 42 | return dict 43 | -------------------------------------------------------------------------------- /libs/network/test/server/cgi-bin/echo_body.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright Divye Kapoor 2008. 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http:#www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # This program sets up a CGI application on localhost 9 | # It can be accessed by http://localhost:8000/cgi-bin/echo_form.py 10 | # It returns the query parameters passed to the CGI Script as plain text. 11 | # 12 | import cgitb; cgitb.enable() # for debugging only 13 | import cgi 14 | import os, sys 15 | 16 | sys.stdout.write( "Content-type: text/plain; charset=us-ascii\r\n\r\n" ) 17 | sys.stdout.write( "\r\n" ) 18 | 19 | # POST data/form data is available in the .value property 20 | sys.stdout.write( cgi.FieldStorage().value ) 21 | -------------------------------------------------------------------------------- /libs/network/test/server/cgi-bin/echo_headers.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright Kim Grasman 2008. 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http:#www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # This program sets up a CGI application on localhost 9 | # It can be accessed by http://localhost:8000/cgi-bin/echo_headers.py 10 | # 11 | import cgi 12 | import os, sys 13 | import cgisupport 14 | 15 | sys.stdout.write( "Content-type: text/plain; charset=us-ascii\r\n\r\n" ) 16 | sys.stdout.write( "\r\n" ) 17 | 18 | hdrs = cgisupport.http_headers(os.environ.get('HTTP_ALL_HEADERS')) 19 | 20 | for h,v in hdrs.iteritems(): 21 | print h + ": " + v 22 | -------------------------------------------------------------------------------- /libs/network/test/server/cgi-bin/multiline-header.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright Divye Kapoor 2008. 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http:#www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # This program sets up a CGI application on localhost 9 | # It can be accessed by http://localhost:8000/cgi-bin/requestinfo.py 10 | # It returns the query parameters passed to the CGI Script as plain text. 11 | # 12 | import cgitb; cgitb.enable() # for debugging only 13 | import cgi 14 | import os, sys 15 | 16 | print "X-CppNetlib-Test: multi-line-header\r\n" 17 | print " that-should-concatenate\r\n" 18 | print "Content-type: text/plain; charset=us-ascii\r\n\r\n" 19 | print "\r\n" 20 | 21 | form = cgi.FieldStorage() 22 | qstring = "" 23 | qstring_dict = {} 24 | 25 | if os.environ.has_key("QUERY_STRING"): 26 | qstring = os.environ["QUERY_STRING"] 27 | try: 28 | qstring_dict = cgi.parse_qs(qstring,1,1) # parse_qs(query_string,keep_blanks,strict_parsing) 29 | except ValueError: 30 | print "Error parsing query string." 31 | 32 | print "Query string:", qstring 33 | 34 | print "GET parameters:", 35 | for i in qstring_dict.keys(): 36 | print i,"-",qstring_dict[i],";", 37 | print 38 | 39 | # Remove GET params and print only the POST ones 40 | print "POST parameters:", 41 | for i in form.keys(): 42 | if i not in qstring_dict.keys(): 43 | print i,"-",form.getfirst(i, ""),";", 44 | print 45 | -------------------------------------------------------------------------------- /libs/network/test/server/cgi-bin/sleep.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import os, sys, time 3 | 4 | if os.environ.has_key("QUERY_STRING") and os.environ["QUERY_STRING"].isdigit(): 5 | time.sleep(int(os.environ["QUERY_STRING"])) 6 | 7 | sys.stdout.write( "HTTP/1.0 200\r\n" ) 8 | sys.stdout.write( "\r\n" ) 9 | -------------------------------------------------------------------------------- /libs/network/test/server/cgi_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright Divye Kapoor 2008. 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http:#www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # This program sets up a CGI HTTP Server at port 8000 on localhost 9 | # It will be used to test the http::client interface of the library 10 | 11 | import CGIHTTPServer 12 | import BaseHTTPServer 13 | import threading 14 | 15 | from threading import Thread, Event 16 | 17 | stop_serving = Event() 18 | server_thread = None 19 | 20 | def run(server_class=BaseHTTPServer.HTTPServer, handler_class=CGIHTTPServer.CGIHTTPRequestHandler): 21 | server_address = ('',8000) 22 | httpd = server_class(server_address, handler_class) 23 | while not stop_serving.isSet(): 24 | httpd.handle_request() 25 | 26 | 27 | def start_server(): 28 | server_thread = Thread(None, run, "HTTP Server",(), None, None) 29 | server_thread.start() 30 | server_thread.join() 31 | 32 | 33 | if __name__ == '__main__': 34 | start_server() 35 | -------------------------------------------------------------------------------- /libs/network/test/server/http_test_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright Allister Levi Sanchez 2008. 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # This program sets up a CGI HTTP Server at port 8000 on localhost 9 | # It will be used to test the http::client interface of the library 10 | 11 | import BaseHTTPServer 12 | import CGIHTTPServer 13 | import os 14 | 15 | class HttpTestHandler(CGIHTTPServer.CGIHTTPRequestHandler): 16 | 17 | def run_cgi(self): 18 | """Version of run_cgi that provides more HTTP headers.""" 19 | headers_str = '' 20 | for a in self.headers.items(): 21 | headers_str += "%s: %s\n" % a 22 | 23 | os.environ['HTTP_ALL_HEADERS'] = headers_str 24 | 25 | # run the rest of run_cgi 26 | CGIHTTPServer.CGIHTTPRequestHandler.run_cgi(self) 27 | 28 | def run_server(server_class=BaseHTTPServer.HTTPServer, handler_class=HttpTestHandler): 29 | server_address = ('',8000) 30 | httpd = server_class(server_address, handler_class) 31 | httpd.serve_forever() 32 | 33 | if __name__ == '__main__': 34 | run_server() 35 | -------------------------------------------------------------------------------- /libs/network/test/server/https_test_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright 2009 Jeroen Habraken 3 | # Copyright 2009 Dean Michael Berris 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | import socket 9 | 10 | from BaseHTTPServer import HTTPServer 11 | from SimpleHTTPServer import SimpleHTTPRequestHandler 12 | from CGIHTTPServer import CGIHTTPRequestHandler 13 | 14 | from OpenSSL import SSL 15 | 16 | import os 17 | 18 | class SecureHTTPServer(HTTPServer): 19 | def __init__(self, server_address, HandlerClass): 20 | HTTPServer.__init__(self, server_address, HandlerClass) 21 | 22 | ctx = SSL.Context(SSL.SSLv23_METHOD) 23 | ctx.use_privatekey_file ("key.pem") 24 | ctx.use_certificate_file("certificate.pem") 25 | self.socket = SSL.Connection(ctx, socket.socket(self.address_family, 26 | self.socket_type)) 27 | self.server_bind() 28 | self.server_activate() 29 | 30 | class SecureHTTPRequestHandler(CGIHTTPRequestHandler): 31 | def setup(self): 32 | self.connection = self.request 33 | self.rfile = socket._fileobject(self.request, "rb", self.rbufsize) 34 | self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) 35 | 36 | def run_cgi(self): 37 | """Version of run_cgi that provides more HTTP headers.""" 38 | headers_str = '' 39 | for a in self.headers.items(): 40 | headers_str += "%s: %s\n" % a 41 | 42 | os.environ['HTTP_ALL_HEADERS'] = headers_str 43 | 44 | # run the rest of run_cgi 45 | CGIHTTPRequestHandler.run_cgi(self) 46 | 47 | if __name__ == '__main__': 48 | SecureHTTPServer(('127.0.0.1', 8443), SecureHTTPRequestHandler).serve_forever() 49 | 50 | -------------------------------------------------------------------------------- /libs/network/test/server/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQCwc3j9E+LMKqw2PBf/a5zLIAfNxDadFW2OB3S85kXgr72x/00o 3 | i5JiPOeA7LGrmhuJ+nDXiO+AWL1O6fOzOkyTd0Nh1hCHJzjrJEfIt3iqdQGHiocV 4 | upWN5iCQRzCrErbPvtvvs/r7mMheb9W3q9lntKPwiZ7mmr/daYdAbVuQpQIDAQAB 5 | AoGBAIJ7MXn8TZdq6uRENf7ERjMTIZIwya4JnXUM4G+b3QqVCrLottcHtxz8Krl0 6 | zsG1+S1kTDOmaG1BseP8LyFXOC4Ni8H6vjnFG/vTzuArPhtoB9B5wXDnPfPQH22a 7 | 10XH3aGbOoyP9sg0HF0ZJsnou3QgQfg49whWa8gl8SUSckI1AkEA4NFwJ7GpVmIA 8 | ZuVzguKEKNNxC9PNUDeGUCyjH5fejolL2wIQQ4rKpml05TbUuugQByxBi+Gbd51j 9 | hGeFOncVywJBAMjsrWoOyGpDJIe2H0Aklecp9awn2H59GFNBmDvUO6LAAkr5Dkky 10 | 64QGLCZLAdswH9QaMuBvzKSZkzGcfDKwpU8CQBxTJt9Jaf1hMY3FQO1vnpkKMsb7 11 | s3V02W5GgXLcjoTE1ZLNSsFHvkqDJOAwLVMzI7nToJqAHTdP1Bb9d/KqyEsCQA0x 12 | /fGJJwBTiIKhI0xDGtUjnE7CDyW/cWmGVUkYlxIJKh1iXd3QykbRYPTi2Cxc7Lox 13 | PkYfEYF91Hzdmgp6L2ECQFcCg0qKfvy1YeTChrDFMBrZx4yoqYGBnqEqxshksAJg 14 | o1r5HVSlO71aVgeAs/5DD4IIb2OyiJE/dv6t0L8TQeQ= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /libs/network/test/server/test.xml: -------------------------------------------------------------------------------- 1 | 2 | Hi! This is node 1 3 | Node 2 here. 4 | 5 | -------------------------------------------------------------------------------- /libs/network/test/uri/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Dean Michael Berris 2010. 2 | # Copyright 2016 Google, Inc. 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 | include_directories(${CPP-NETLIB_SOURCE_DIR}) 8 | 9 | if (Boost_FOUND) 10 | set(TESTS uri_test uri_builder_test uri_builder_stream_test 11 | uri_encoding_test relative_uri_test) 12 | foreach (test ${TESTS}) 13 | if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU) 14 | set_source_files_properties(${test}.cpp 15 | PROPERTIES COMPILE_FLAGS "-Wall") 16 | endif() 17 | add_executable(cpp-netlib-${test} ${test}.cpp) 18 | add_dependencies(cpp-netlib-${test} cppnetlib-uri gtest_main) 19 | target_link_libraries(cpp-netlib-${test} 20 | ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri 21 | gtest_main) 22 | if (OPENSSL_FOUND) 23 | target_link_libraries(cpp-netlib-${test} ${OPENSSL_LIBRARIES}) 24 | endif() 25 | if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU 26 | AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") 27 | target_link_libraries(cpp-netlib-${test} ws2_32) 28 | endif() 29 | set_target_properties(cpp-netlib-${test} 30 | PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) 31 | add_test(cpp-netlib-${test} 32 | ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-${test}) 33 | endforeach (test) 34 | endif() 35 | -------------------------------------------------------------------------------- /libs/network/test/uri/relative_uri_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Glyn Matthews 2012. 2 | // Copyright 2016 Google, Inc. 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 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace boost::network; 13 | 14 | TEST(RelativeURITest, NotSupported) { 15 | // don't yet support relative URIs 16 | uri::uri instance("example.com"); 17 | ASSERT_FALSE(uri::valid(instance)); 18 | } 19 | --------------------------------------------------------------------------------