mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
http: initialize connection type, cleanup
This commit is contained in:
1 parent
9daa7ec283
commit
8a18c591e9
3 files changed
+16
-19
No files matched your search
+5
-4
@@ -624,14 +624,15 @@ Request::build()
|
||||
std::string conn_str = "";
|
||||
switch (connection_type_){
|
||||
case restinio::http_connection_header_t::upgrade:
|
||||
throw std::invalid_argument("upgrade");
|
||||
if (logger_)
|
||||
logger_->e("Unsupported connection type 'upgrade', fallback to 'close'");
|
||||
// fallthrough
|
||||
case restinio::http_connection_header_t::close:
|
||||
conn_str = "close";
|
||||
break;
|
||||
case restinio::http_connection_header_t::keep_alive:
|
||||
conn_str = "keep-alive";
|
||||
break;
|
||||
case restinio::http_connection_header_t::close:
|
||||
conn_str = "close";
|
||||
connection_type_ = restinio::http_connection_header_t::close;
|
||||
}
|
||||
if (!conn_str.empty())
|
||||
request << "Connection: " << conn_str << "\r\n";
|
||||
|
||||
Reference in new issue
Block a user