mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
nhttp: some minor code optimizations
Origin commit data
------------------
Commit: 2c3952cf42
Author: vanhofen <vanhofen@gmx.de>
Date: 2014-08-19 (Tue, 19 Aug 2014)
Origin message was:
------------------
- nhttp: some minor code optimizations
This commit is contained in:
@@ -96,10 +96,9 @@ void CWebserverConnection::HandleConnection() {
|
|||||||
if(string_tolower(Request.HeaderList["Connection"]) == "close"
|
if(string_tolower(Request.HeaderList["Connection"]) == "close"
|
||||||
|| (httprotocol != "HTTP/1.1" && string_tolower(Request.HeaderList["Connection"]) != "keep-alive")
|
|| (httprotocol != "HTTP/1.1" && string_tolower(Request.HeaderList["Connection"]) != "keep-alive")
|
||||||
|| !Webserver->CheckKeepAliveAllowedByIP(sock->get_client_ip()))
|
|| !Webserver->CheckKeepAliveAllowedByIP(sock->get_client_ip()))
|
||||||
keep_alive = false;
|
|
||||||
#else
|
|
||||||
keep_alive = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
keep_alive = false;
|
||||||
|
|
||||||
// Send a response
|
// Send a response
|
||||||
Response.SendResponse();
|
Response.SendResponse();
|
||||||
|
|
||||||
|
@@ -248,9 +248,8 @@ std::string CyhookHandler::BuildHeader(bool cache) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// print Status-line
|
// print Status-line
|
||||||
result = string_printf(HTTP_PROTOCOL " %d %s\r\nContent-Type: %s\r\n",httpStatus, responseString, ResponseMimeType.c_str());
|
result = string_printf(HTTP_PROTOCOL " %d %s\r\nContent-Type: %s\r\n", httpStatus, responseString, ResponseMimeType.c_str());
|
||||||
log_level_printf(2, "Response: HTTP/1.1 %d %s\r\nContent-Type: %s\r\n",
|
log_level_printf(2, "Response: HTTP/1.1 %d %s\r\nContent-Type: %s\r\n", httpStatus, responseString, ResponseMimeType.c_str());
|
||||||
httpStatus, responseString, ResponseMimeType.c_str());
|
|
||||||
|
|
||||||
switch (httpStatus) {
|
switch (httpStatus) {
|
||||||
case HTTP_UNAUTHORIZED:
|
case HTTP_UNAUTHORIZED:
|
||||||
@@ -285,7 +284,7 @@ std::string CyhookHandler::BuildHeader(bool cache) {
|
|||||||
// connection type
|
// connection type
|
||||||
#ifdef Y_CONFIG_FEATURE_KEEP_ALIVE
|
#ifdef Y_CONFIG_FEATURE_KEEP_ALIVE
|
||||||
if(keep_alive)
|
if(keep_alive)
|
||||||
result += "Connection: keep-alive\r\n";
|
result += "Connection: keep-alive\r\n";
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
result += "Connection: close\r\n";
|
result += "Connection: close\r\n";
|
||||||
|
Reference in New Issue
Block a user