Skip to content

Commit fb88282

Browse files
author
mikhail_beris
committed
Changes:
- boost/network/protocol/http/impl/request.hpp: updating includes to use the correct Fusion include for the map container - boost/network/protocol/http/client.hpp: removing dependence on std::ostringstream and moving the type of output string stream to be determined by the tag template parameter - boost/network/message.hpp: adding the default 'ostringstream_type' as an std::ostringstream in the default_ tag - libs/network/test/http_1_0_test.cpp: additional HTTP 1.0 test for port specified in the URL
1 parent bd2de71 commit fb88282

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

boost/network/message.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace boost { namespace network {
3434
struct tags {
3535
struct default_ {
3636
typedef std::string str_type;
37+
typedef std::ostringstream ostringstream_type;
3738
};
3839
};
3940

boost/network/protocol/http/client.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace boost { namespace network { namespace http {
2121
public:
2222

2323
response const get (basic_request<tag> const & request_) {
24-
// TODO: use Asio's iostream interface to perform
24+
// use Asio's iostream interface to perform
2525
// a synchronous request for data via HTTP
2626
// and then craft a response object to be returned
2727
// based on the headers received, and the contents
@@ -51,7 +51,7 @@ namespace boost { namespace network { namespace http {
5151
socket_stream << std::flush;
5252

5353
response response_;
54-
std::ostringstream body_stream;
54+
typename tag::ostringstream_type body_stream;
5555

5656
while (!socket_stream.eof()) {
5757
typename tag::str_type line;

boost/network/protocol/http/impl/request.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#ifndef __NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__
88
#define __NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__
99

10-
#include <boost/fusion/sequence/container/map.hpp>
10+
#include <boost/fusion/container/map.hpp>
1111
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
1212
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
1313

libs/network/test/http_1_0_test.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@ BOOST_AUTO_TEST_CASE(constructor_test) {
1919

2020
BOOST_AUTO_TEST_CASE(http_get_test) {
2121
using namespace boost::network;
22-
http::request request("http://boost.org/");
22+
http::request request("http://www.boost.org/");
23+
http::client client_;
24+
http::response response_;
25+
response_ = client_.get(request);
26+
headers_range<http::response>::type range = headers(response_)["Content-Length"];
27+
BOOST_CHECK ( range.first != range.second );
28+
BOOST_CHECK ( body(response_).size() != 0 );
29+
};
30+
31+
BOOST_AUTO_TEST_CASE(http_get_test_different_port) {
32+
using namespace boost::network;
33+
http::request request("http://www.boost.org:80/");
2334
http::client client_;
2435
http::response response_;
2536
response_ = client_.get(request);

0 commit comments

Comments
 (0)