Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions boost/network/protocol/http/client/async_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ struct async_client

~async_client() throw() {
sentinel_.reset();
}

void wait_complete() {
sentinel_.reset();
if (lifetime_thread_.get()) {
if (lifetime_thread_->get_id() != boost::this_thread::get_id()) {
lifetime_thread_->join();
}
lifetime_thread_->join();
lifetime_thread_.reset();
}
}
Expand Down
4 changes: 4 additions & 0 deletions boost/network/protocol/http/client/facade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ struct basic_client_facade {
init_pimpl(options);
}

~basic_client_facade() {
pimpl->wait_complete();
}

response head(request const& request) {
return pimpl->request_skeleton(request,
"HEAD",
Expand Down
2 changes: 2 additions & 0 deletions boost/network/protocol/http/client/sync_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ struct sync_client
service_ptr.reset();
}

void wait_complete() {}

basic_response<Tag> request_skeleton(basic_request<Tag> const& request_,
string_type method, bool get_body,
body_callback_function_type callback,
Expand Down
12 changes: 12 additions & 0 deletions libs/network/test/http/client_get_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(https_client_get_test, client, client_types) {
}

#endif

BOOST_AUTO_TEST_CASE_TEMPLATE(http_temp_client_get_test, client, client_types) {
typename client::request request("http://www.google.co.kr");
typename client::response response;
BOOST_REQUIRE_NO_THROW ( response = client().get(request) );
typename net::headers_range<typename client::response>::type range = headers(response)["Content-Type"];
BOOST_CHECK ( !boost::empty(range) );
BOOST_REQUIRE_NO_THROW ( BOOST_CHECK ( body(response).size() != 0 ) );
BOOST_CHECK_EQUAL ( response.version().substr(0,7), std::string("HTTP/1.") );
BOOST_CHECK_EQUAL ( response.status(), 200u );
BOOST_CHECK_EQUAL ( response.status_message(), std::string("OK") );
}