adds support for retrieving headers from the request and response objects

This commit is contained in:
Peter Thorson
2013-04-06 15:30:35 -05:00
parent d47327d2a6
commit 51caf0517e
2 changed files with 29 additions and 0 deletions

View File

@@ -571,6 +571,22 @@ public:
// Pass-through access to the request and response objects //
/////////////////////////////////////////////////////////////
/// Retrieve a request header
/**
* Retrieve the value of a header from the handshake HTTP request.
*
* @param key Name of the header to get
*/
const std::string & get_request_header(const std::string &key);
/// Retrieve a response header
/**
* Retrieve the value of a header from the handshake HTTP request.
*
* @param key Name of the header to get
*/
const std::string & get_response_header(const std::string &key);
/// Set response status code and message
/**
* Sets the response status code to `code` and looks up the corresponding

View File

@@ -359,6 +359,19 @@ void connection<config>::select_subprotocol(const std::string & value) {
}
}
template <typename config>
const std::string &
connection<config>::get_request_header(const std::string &key) {
return m_request.get_header(key);
}
template <typename config>
const std::string &
connection<config>::get_response_header(const std::string &key) {
return m_response.get_header(key);
}
template <typename config>
void connection<config>::set_status(
http::status_code::value code)