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

Commit25e7a38

Browse files
committed
Various changes investigating short reads
This is in relation to issue#425 where a report of a short_read stillhappening in Linux (Debian) with GCC/Clang. This couldn't be reproducedwith an OpenSSL acquired via Homebrew on Mac OS X.More tests would require specific OpenSSL versions, which may or maynot exhibit this issue.
1 parent28ba508 commit25e7a38

File tree

6 files changed

+68
-23
lines changed

6 files changed

+68
-23
lines changed

‎.ycm_extra_conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
'/usr/include/c++/4.6',
2727
'-isystem',
2828
'/usr/include/clang/3.0/include',
29+
'-isystem',
30+
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1',
2931
'-I',
3032
os.environ['BOOST_ROOT'],
3133
# Always enable debugging for the project when building for semantic

‎boost/network/protocol/http/message/wrappers/status_message.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_STATUS_MESSAGE_HPP_20100603
22
#defineBOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_STATUS_MESSAGE_HPP_20100603
33

4-
// Copyright 2010 (c) Dean Michael Berris
4+
// Copyright 2010 (c) Dean Michael Berris <dberris@google.com>
55
// Copyright 2010 (c) Sinefunc, Inc.
6+
// Copyright 2014 (c) Google, Inc.
67
// Distributed under the Boost Software License, Version 1.0.
78
// (See accompanying file LICENSE_1_0.txt or copy at
89
// http://www.boost.org/LICENSE_1_0.txt)
910

11+
#include<boost/network/traits/string.hpp>
12+
1013
namespaceboost {namespacenetwork {namespacehttp {
1114

1215
template<classTag>
@@ -27,12 +30,19 @@ namespace boost { namespace network { namespace http {
2730
status_message_wrapper(status_message_wrapperconst & other)
2831
: response_(other.response_) {}
2932

30-
operatorstring_type () {
33+
operatorstring_type ()const{
3134
return response_.status_message();
3235
}
3336

3437
};
3538

39+
template<classTag>
40+
inline std::ostream&
41+
operator<<(std::ostream& os,
42+
const status_message_wrapper<Tag>& wrapper) {
43+
return os <<static_cast<typename string<Tag>::type>(wrapper);
44+
}
45+
3646
}// namespace impl
3747

3848
template<classTag>

‎libs/network/example/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ add_executable(twitter_search twitter/search.cpp)
1616
add_executable(hello_world_serverhttp/hello_world_server.cpp)
1717
add_executable(hello_world_clienthttp/hello_world_client.cpp)
1818
add_executable(hello_world_async_server_with_work_queuehttp/hello_world_async_server_with_work_queue.cpp)
19+
add_executable(trivial_googletrivial_google.cpp)
1920
if (UNIX)
2021
add_executable(fileserverhttp/fileserver.cpp)
2122
endif (UNIX)
@@ -24,6 +25,7 @@ add_dependencies(simple_wget cppnetlib-uri cppnetlib-client-connections)
2425
add_dependencies(atom_readercppnetlib-uricppnetlib-client-connections)
2526
add_dependencies(rss_readercppnetlib-uricppnetlib-client-connections)
2627
add_dependencies(twitter_searchcppnetlib-uricppnetlib-client-connections)
28+
add_dependencies(trivial_googlecppnetlib-uricppnetlib-client-connections)
2729
set(BOOST_CLIENT_LIBS
2830
${Boost_PROGRAM_OPTIONS_LIBRARY}
2931
${Boost_THREAD_LIBRARY}
@@ -71,6 +73,12 @@ target_link_libraries(twitter_search
7173
cppnetlib-uri
7274
cppnetlib-client-connections)
7375

76+
target_link_libraries(trivial_google
77+
${BOOST_CLIENT_LIBS}
78+
${CMAKE_THREAD_LIBS_INIT}
79+
cppnetlib-uri
80+
cppnetlib-client-connections)
81+
7482
target_link_libraries(hello_world_server
7583
${BOOST_SERVER_LIBS}
7684
${CMAKE_THREAD_LIBS_INIT})
@@ -97,6 +105,7 @@ if (OPENSSL_FOUND)
97105
target_link_libraries(hello_world_server${OPENSSL_LIBRARIES})
98106
target_link_libraries(hello_world_client${OPENSSL_LIBRARIES})
99107
target_link_libraries(hello_world_async_server_with_work_queue${OPENSSL_LIBRARIES})
108+
target_link_libraries(trivial_google${OPENSSL_LIBRARIES})
100109
endif (OPENSSL_FOUND)
101110

102111
if (${CMAKE_CXX_COMPILER_ID}MATCHESGNUAND${CMAKE_SYSTEM_NAME}MATCHES"Windows")
@@ -108,6 +117,7 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windo
108117
target_link_libraries(hello_world_serverws2_32wsock32)
109118
target_link_libraries(hello_world_clientws2_32)
110119
target_link_libraries(hello_world_async_server_with_work_queuews2_32wsock32)
120+
target_link_libraries(trivial_googlews2_32)
111121
endif()
112122

113123
if (${CMAKE_SYSTEM_NAME}MATCHES"Linux")
@@ -119,6 +129,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
119129
target_link_libraries(hello_world_serverrt)
120130
target_link_libraries(hello_world_clientrt)
121131
target_link_libraries(hello_world_async_server_with_work_queuert)
132+
target_link_libraries(trivial_googlert)
122133
endif()
123134

124135
if (UNIX)
@@ -140,9 +151,11 @@ set_target_properties(simple_wget PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETL
140151
set_target_properties(atom_readerPROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
141152
set_target_properties(rss_readerPROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
142153
set_target_properties(twitter_searchPROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
154+
set_target_properties(trivial_googlePROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
143155
set_target_properties(hello_world_serverPROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
144156
set_target_properties(hello_world_clientPROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
145157
set_target_properties(hello_world_async_server_with_work_queuePROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
158+
146159
if (UNIX)
147160
set_target_properties(fileserverPROPERTIESRUNTIME_OUTPUT_DIRECTORY${CPP-NETLIB_BINARY_DIR}/example)
148161
endif (UNIX)

‎libs/network/example/http_client.cpp

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

2-
// Copyright Dean Michael Berris 2008.
2+
// Copyright 2008, 2014 Dean Michael Berris <dberris@google.com>
3+
// Copyright 2014 Google, Inc.
34
// 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)
5+
// (See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt)
67

78
//[ http_client_main
89
/*`
@@ -25,6 +26,7 @@ int main(int argc, char * argv[]) {
2526
options.add_options()
2627
("help,h","produce help message")
2728
("headers,H","print headers")
29+
("status,S","print status and message")
2830
("source,s", po::value<std::string>(&source),"source URL")
2931
;
3032

@@ -39,44 +41,44 @@ int main(int argc, char * argv[]) {
3941
std::cout <<"Error:" << e.what() << std::endl;
4042
std::cout << options << std::endl;
4143
return EXIT_FAILURE;
42-
};
44+
}
4345

4446
if (vm.count("help")) {
4547
std::cout << options << std::endl;
4648
return EXIT_SUCCESS;
47-
};
49+
}
4850

4951
if (vm.count("source") <1) {
5052
std::cout <<"Error: Source URL required." << std::endl;
5153
std::cout << options << std::endl;
5254
return EXIT_FAILURE;
53-
};
55+
}
5456

55-
show_headers = vm.count("headers") ?true :false ;
57+
show_headers = vm.count("headers") ?true :false;
58+
bool show_status = vm.count("status") ?true :false;
5659

57-
58-
typedef http::basic_client<http::tags::http_async_8bit_tcp_resolve,1,0>
59-
http_client;
60-
61-
http_client::requestrequest(source);
62-
http_client::string_type destination_ =host(request);
60+
http::client::requestrequest(source);
61+
http::client::string_type destination_ =host(request);
6362

6463
request << ::boost::network::header("Connection","close");
65-
http_client::options client_options;
66-
http_clientclient(client_options.follow_redirects(true));
67-
http_client::response response = client.get(request);
64+
http::client::options client_options;
65+
client_options.follow_redirects(true);
66+
http::clientclient(client_options);
67+
http::client::response response = client.get(request);
68+
69+
if (show_status)
70+
std::cout <<status(response) <<"" <<status_message(response) << std::endl;
6871

6972
if (show_headers) {
70-
headers_range<http_client::response>::type headers_ = response.headers();
73+
headers_range<http::client::response>::type headers_ = response.headers();
7174
typedef std::pair<std::string, std::string> header_type;
7275
BOOST_FOREACH(header_typeconst & header, headers_) {
7376
std::cout << header.first <<":" << header.second << std::endl;
7477
}
7578
std::cout << std::endl;
76-
};
79+
}
7780

78-
body_range<http_client::response>::type body_ =body(response).range();
79-
boost::copy(body_, std::ostream_iterator<char_<http_client::request::tag>::type>(std::cout));
81+
std::cout <<body(response);
8082
return EXIT_SUCCESS;
8183
}
8284
//]

‎libs/network/example/simple_wget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ main(int argc, char *argv[]) {
4343
return1;
4444
}
4545

46+
http::client client;
4647
try {
47-
http::client client;
4848
http::client::requestrequest(argv[1]);
4949
http::client::response response = client.get(request);
5050

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2014 Dean Michael Berris <dberris@google.com>
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<iostream>
8+
9+
#include<boost/network/include/http/client.hpp>
10+
11+
namespacehttp= boost::network::http;
12+
13+
intmain(int,char*[]) {
14+
http::client client;
15+
http::client::requestrequest("https://www.google.com/");
16+
http::client::response response = client.get(request);
17+
std::cout <<body(response) << std::endl;
18+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp