diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-03-02 22:25:09 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-03-02 22:25:09 +0100 |
commit | 0c2f90ee5c713fcb3aedb236fcebe7dd6d323ba3 (patch) | |
tree | 5cd273e39a9679afd75a97bdb2bb6d1f839b0dc9 /http_connection.h | |
parent | 0649a5c78eeef6eba731ee1c698e18554cad5670 (diff) |
Add ability to serve parts of a file.
Diffstat (limited to 'http_connection.h')
-rw-r--r-- | http_connection.h | 8 |
1 files changed, 7 insertions, 1 deletions
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 <boost/enable_shared_from_this.hpp> using boost::asio::ip::tcp; +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; + #include <boost/function.hpp> 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<std::pair<std::string, std::string> > 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; |