diff options
author | yorickdewid <yorick17@outlook.com> | 2016-10-03 15:32:16 +0200 |
---|---|---|
committer | yorickdewid <yorick17@outlook.com> | 2016-10-03 15:32:16 +0200 |
commit | e40605da59e368be524dee0e9e9d41ef05149473 (patch) | |
tree | 92fdf510d4ec6656759dc09e51e7ff8bb65ca692 | |
parent | f4f6b024038a6b777507c1d6b848ae5bab2c7422 (diff) | |
download | crow-e40605da59e368be524dee0e9e9d41ef05149473.tar.gz crow-e40605da59e368be524dee0e9e9d41ef05149473.zip |
HTTP response redirect
- Log address
-rw-r--r-- | include/crow/http_response.h | 6 | ||||
-rw-r--r-- | include/crow/http_server.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/include/crow/http_response.h b/include/crow/http_response.h index f5e03b4..7940174 100644 --- a/include/crow/http_response.h +++ b/include/crow/http_response.h @@ -86,6 +86,12 @@ namespace crow completed_ = false; } + void redirect(const std::string& location) + { + code = 301; + set_header("Location", location); + } + void write(const std::string& body_part) { body += body_part; diff --git a/include/crow/http_server.h b/include/crow/http_server.h index d5abb11..ab2631b 100644 --- a/include/crow/http_server.h +++ b/include/crow/http_server.h @@ -141,7 +141,7 @@ namespace crow }); } - CROW_LOG_INFO << server_name_ << " server is running, local port " << port_; + CROW_LOG_INFO << server_name_ << " server is running at " << bindaddr_ <<":" << port_; signals_.async_wait( [&](const boost::system::error_code& /*error*/, int /*signal_number*/){ |