From 0c2f90ee5c713fcb3aedb236fcebe7dd6d323ba3 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Wed, 2 Mar 2011 22:25:09 +0100 Subject: Add ability to serve parts of a file. --- http_connection.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'http_connection.h') diff --git a/http_connection.h b/http_connection.h index d810254..f5cd01a 100644 --- a/http_connection.h +++ b/http_connection.h @@ -11,6 +11,9 @@ #include using boost::asio::ip::tcp; +#include +namespace fs = boost::filesystem; + #include namespace HTTP { @@ -54,6 +57,9 @@ namespace HTTP { void send_data(const void* data, std::size_t size); void send_data(std::istream& stream); + //! Send file. + void send_file(const fs::path& filename); + private: typedef std::vector > HeaderList; @@ -76,7 +82,7 @@ namespace HTTP { bool parse_request(boost::asio::streambuf& buf); //! Write response headers. - void write_headers(); + void write_headers(int code = 200); //! Response headers written? bool headers_written; -- cgit v1.2.3