diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-01-02 23:10:13 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-01-02 23:10:13 +0100 |
commit | ea754365e607c7c36d00909ea7605daeaa64243c (patch) | |
tree | 59a5a53bcb8cefb95af3848265cc4187a80cba10 /http_connection.cpp | |
parent | b429cd906e2fcaf96e6ed84d7a1b85b582330a13 (diff) |
Added send_data(istream).
Diffstat (limited to 'http_connection.cpp')
-rw-r--r-- | http_connection.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/http_connection.cpp b/http_connection.cpp index 128abf5..6e970b2 100644 --- a/http_connection.cpp +++ b/http_connection.cpp @@ -25,6 +25,17 @@ void HTTP::Connection::send_data(const void* data, std::size_t size) { boost::asio::write(socket, boost::asio::buffer(data, size)); } +void HTTP::Connection::send_data(std::istream& stream) { + char data[0x1000]; + std::streamsize size = 1; + while(size) { + stream.read(data, 0x1000); + size = stream.gcount(); + if(size > 0) + send_data(data, size); + } +} + HTTP::Connection::Connection(boost::asio::io_service& io_service) : socket(io_service) { headers_written = false; } |