aboutsummaryrefslogtreecommitdiffstats
path: root/http_connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'http_connection.h')
-rw-r--r--http_connection.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/http_connection.h b/http_connection.h
index 7c4da26..6338c6f 100644
--- a/http_connection.h
+++ b/http_connection.h
@@ -53,8 +53,28 @@ namespace flask
};
request req = parser_.to_request();
+ if (parser_.http_major == 1 && parser_.http_minor == 0)
+ {
+ // HTTP/1.0
+ if (!(req.headers.count("connection") && boost::iequals(req.headers["connection"],"Keep-Alive")))
+ close_connection_ = true;
+ }
+ else
+ {
+ // HTTP/1.1
+ if (req.headers.count("connection") && req.headers["connection"] == "close")
+ close_connection_ = true;
+ }
+
res = handler_->handle(req);
+#ifdef FLASK_ENABLE_LOGGING
+ std::cerr << "HTTP/" << parser_.http_major << "." << parser_.http_minor << ' ';
+ std::cerr << method_name(req.method);
+ std::cerr << " " << res.code << std::endl;
+ std::cerr << "res body: " << res.body << std::endl;
+#endif
+
static std::string seperator = ": ";
static std::string crlf = "\r\n";