Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

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

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Integrate uri#654

New issue

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

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

Already on GitHub?Sign in to your account

Merged
deanberris merged 5 commits intocpp-netlib:masterfromglynos:integrate_uri
May 18, 2016
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Replaced old, old URI class with the new dependency.
  • Loading branch information
@glynos
glynos committedMay 16, 2016
commitf8684e45d67152d1492c942173a42b64008543e0
74 changes: 37 additions & 37 deletionsCMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -107,8 +107,8 @@ if (Boost_FOUND)
add_subdirectory(libs/network/src)
if (CPP-NETLIB_BUILD_TESTS)
add_subdirectory(deps/googletest)
add_subdirectory(libs/network/test)
add_subdirectory(deps/uri/test)
add_subdirectory(libs/network/test)
endif (CPP-NETLIB_BUILD_TESTS)
if (CPP-NETLIB_BUILD_EXAMPLES)
add_subdirectory(libs/network/example)
Expand All@@ -123,39 +123,39 @@ enable_testing()

install(DIRECTORY boost DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

###
## Export Targets
# (so cpp-netlib can be easily used by other CMake projects)
# [see http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file]

# Add all targets to the build-tree export set
export(TARGETS cppnetlib-client-connections cppnetlib-server-parsers cppnetlib-uri
FILE "${PROJECT_BINARY_DIR}/cppnetlibTargets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE cppnetlib)
# Create the cppnetlibConfig.cmake and cppnetlibConfigVersion files
file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
"${CMAKE_INSTALL_FULL_INCLUDEDIR}")
# ... for the build tree
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" ${Boost_INCLUDE_DIRS})
configure_file(cppnetlibConfig.cmake.in
"${PROJECT_BINARY_DIR}/cppnetlibConfig.cmake" @ONLY)
# ... for the install tree
set(CONF_INCLUDE_DIRS "\${CPPNETLIB_CMAKE_DIR}/${REL_INCLUDE_DIR}")
set(CONF_INCLUDE_DIRS ${CONF_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
configure_file(cppnetlibConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake" @ONLY)
# ... for both
configure_file(cppnetlibConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake" @ONLY)
# Install the cppnetlibConfig.cmake and cppnetlibConfigVersion.cmake
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake"
"${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}"
COMPONENT dev)
# Install the export set for use with the install-tree
install(EXPORT cppnetlibTargets
DESTINATION "${INSTALL_CMAKE_DIR}"
COMPONENT dev)
# ###
# ## Export Targets
##(so cpp-netlib can be easily used by other CMake projects)
##[see http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file]
#
##Add all targets to the build-tree export set
#export(TARGETS cppnetlib-client-connections cppnetlib-server-parsers cppnetlib-uri
# FILE "${PROJECT_BINARY_DIR}/cppnetlibTargets.cmake")
##Export the package for use from the build-tree
##(this registers the build-tree with a global CMake-registry)
#export(PACKAGE cppnetlib)
##Create the cppnetlibConfig.cmake and cppnetlibConfigVersion files
#file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
# "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
##... for the build tree
#set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" ${Boost_INCLUDE_DIRS})
#configure_file(cppnetlibConfig.cmake.in
# "${PROJECT_BINARY_DIR}/cppnetlibConfig.cmake" @ONLY)
##... for the install tree
#set(CONF_INCLUDE_DIRS "\${CPPNETLIB_CMAKE_DIR}/${REL_INCLUDE_DIR}")
#set(CONF_INCLUDE_DIRS ${CONF_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
#configure_file(cppnetlibConfig.cmake.in
# "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake" @ONLY)
##... for both
#configure_file(cppnetlibConfigVersion.cmake.in
# "${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake" @ONLY)
##Install the cppnetlibConfig.cmake and cppnetlibConfigVersion.cmake
#install(FILES
# "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake"
# "${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake"
# DESTINATION "${INSTALL_CMAKE_DIR}"
# COMPONENT dev)
##Install the export set for use with the install-tree
#install(EXPORT cppnetlibTargets
# DESTINATION "${INSTALL_CMAKE_DIR}"
# COMPONENT dev)
28 changes: 14 additions & 14 deletionsboost/network/protocol/http/impl/request.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,7 @@
*/

#include <cstdint>
#include <network/uri/uri.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/fusion/container/map.hpp>
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
Expand All@@ -29,7 +30,6 @@
#include <boost/network/protocol/http/message/wrappers/headers.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/traits/vector.hpp>
#include <boost/network/uri/uri.hpp>

namespace boost {
namespace network {
Expand All@@ -50,7 +50,7 @@ namespace http {
*/
template <class Tag>
struct basic_request : public basic_message<Tag> {
boost::network::uri::uri uri_;
::network::uri uri_;
std::uint16_t source_port_;
typedef basic_message<Tag> base_type;

Expand All@@ -62,7 +62,7 @@ struct basic_request : public basic_message<Tag> {
explicit basic_request(string_type const& uri_)
: uri_(uri_), source_port_(0) {}

explicit basic_request(boost::network::uri::uri const& uri_)
explicit basic_request(::network::uri const& uri_)
: uri_(uri_), source_port_(0) {}

basic_request() : base_type(), source_port_(0) {}
Expand All@@ -83,29 +83,29 @@ struct basic_request : public basic_message<Tag> {
boost::swap(other.source_port_, this->source_port_);
}

string_type const host() const { return uri_.host(); }
string_type const host() const { return uri_.host().to_string(); }

port_type port() const {
boost::optional<port_type> port = uri::port_us(uri_);
if (!port) {
if (uri_.has_port()) {
return uri_.port<std::uint16_t>();
}
else {
typedef constants<Tag> consts;
return boost::iequals(uri_.scheme(), string_type(consts::https())) ? 443
: 80;
return boost::iequals(uri_.scheme(), string_type(consts::https())) ? 443 : 80;
}
return *port;
}

string_type const path() const { return uri_.path(); }
string_type const path() const { return uri_.path().to_string(); }

string_type const query() const { return uri_.query(); }
string_type const query() const { return uri_.query().to_string(); }

string_type const anchor() const { return uri_.fragment(); }
string_type const anchor() const { return uri_.fragment().to_string(); }

string_type const protocol() const { return uri_.scheme(); }
string_type const protocol() const { return uri_.scheme().to_string(); }

void uri(string_type const& new_uri) const { uri_ = new_uri; }

boost::network::uri::uri const& uri() const { return uri_; }
::network::uri const& uri() const { return uri_; }

void source_port(const std::uint16_t port) { source_port_ = port; }

Expand Down
11 changes: 6 additions & 5 deletionsboost/network/protocol/http/message/wrappers/port.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <cstdint>
#include <boost/network/uri/accessors.hpp>
#include <network/uri/uri.hpp>
#include <boost/optional.hpp>
#include <boost/version.hpp>

Expand DownExpand Up@@ -38,13 +38,14 @@ struct port_wrapper {
// conversions no longer work correctly with MSVC. The conversion therefore
// has to be done explicitly with as_optional().
boost::optional<std::uint16_t> as_optional() const {
return uri::port_us(message_.uri());
}
#else
operator boost::optional<std::uint16_t>() const {
return uri::port_us(message_.uri());
}
#endif
if (message_.uri().has_port()) {
return message_.uri().template port<std::uint16_t>();
}
return boost::optional<std::uint16_t>();
}

};

Expand Down
6 changes: 3 additions & 3 deletionsboost/network/protocol/http/message/wrappers/uri.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/network/uri/uri.hpp>
#include <network/uri/uri.hpp>

namespace boost {
namespace network {
Expand All@@ -22,8 +22,8 @@ struct uri_wrapper {
basic_request<Tag> const& message_;
explicit uri_wrapper(basic_request<Tag> const& message) : message_(message) {}
typedef typename basic_request<Tag>::string_type string_type;
operator string_type() { return message_.uri().raw(); }
operatorboost::network::uri::uri() { return message_.uri(); }
operator string_type() { return message_.uri().to_string(); }
operator ::network::uri() { return message_.uri(); }
};
} // namespace impl

Expand Down
22 changes: 5 additions & 17 deletionsboost/network/protocol/stream_handler.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,11 +73,8 @@ struct stream_handler {
tcp_sock_->async_write_some(buffers, handler);
}
}
catch (const std::error_code& e) {
std::cerr << e.message() << std::endl;
}
catch (const std::system_error& e) {
std::cerr << e.code() << ": " << e.what() << std::endl;
catch (const std::system_error&) {
// print system error
}
}

Expand All@@ -93,11 +90,8 @@ struct stream_handler {
tcp_sock_->async_read_some(buffers, handler);
}
}
catch (const std::error_code& e) {
std::cerr << e.message() << std::endl;
}
catch (const std::system_error& e) {
std::cerr << e.code() << ": " << e.what() << std::endl;
// print system error
}
}

Expand DownExpand Up@@ -126,11 +120,8 @@ struct stream_handler {
tcp_sock_->shutdown(::asio::ip::tcp::socket::shutdown_send, e);
}
}
catch (const std::error_code& e) {
std::cerr << e.message() << std::endl;
}
catch (const std::system_error& e) {
std::cerr << e.code() << ": " << e.what() << std::endl;

}
}

Expand DownExpand Up@@ -162,11 +153,8 @@ struct stream_handler {
// NOOP
}
}
catch (const std::error_code& e) {
std::cerr << e.message() << std::endl;
}
catch (const std::system_error& e) {
std::cerr << e.code() << ": " << e.what() << std::endl;

}
}
std::shared_ptr<tcp_socket> get_tcp_socket() { return tcp_sock_; }
Expand Down
11 changes: 0 additions & 11 deletionsboost/network/uri.hpp
View file
Open in desktop

This file was deleted.

96 changes: 0 additions & 96 deletionsboost/network/uri/accessors.hpp
View file
Open in desktop

This file was deleted.

Loading

[8]ページ先頭

©2009-2025 Movatter.jp