summaryrefslogtreecommitdiff
path: root/src/HttpServer.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-19 11:13:48 -0800
committerPixel <pixel@nobis-crew.org>2011-11-19 11:13:48 -0800
commitef18c9c988730813f6299d0c7792920e525137fd (patch)
tree53545ac07456f26cc0f19f8f5f7f2d218c4ca480 /src/HttpServer.cc
parent861a79f0207a8391fa37b30427d36cf46c41cbd4 (diff)
Handling more Connection tags, separated with commas; and adding the 'split' method to String.
Diffstat (limited to 'src/HttpServer.cc')
-rw-r--r--src/HttpServer.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/HttpServer.cc b/src/HttpServer.cc
index d99e1ea..3da8cf5 100644
--- a/src/HttpServer.cc
+++ b/src/HttpServer.cc
@@ -254,14 +254,23 @@ bool Balau::HttpWorker::handleClient() {
Http::StringMap::iterator i = httpHeaders.find("Connection");
if (i != httpHeaders.end()) {
- if (i->second == "close") {
- persistent = false;
- } else if (i->second == "keep-alive") {
- persistent = true;
- } else {
- Balau::Printer::elog(Balau::E_HTTPSERVER, "%s has an improper Connection HTTP header", m_name.to_charp());
- send400();
- return false;
+ String conn = i->second;
+ String::List connVals = conn.split(',');
+ bool gotOne = false;
+ for (String::List::iterator j = connVals.begin(); j != connVals.end(); j++) {
+ if ((*j == "close") && (!gotOne)) {
+ gotOne = true;
+ persistent = false;
+ } else if ((*j == "keep-alive") && (!gotOne)) {
+ gotOne = true;
+ persistent = true;
+ } else if (*j == "TE") {
+ Balau::Printer::elog(Balau::E_HTTPSERVER, "%s got the 'TE' connection marker (which is still unknown)", m_name.to_charp());
+ } else {
+ Balau::Printer::elog(Balau::E_HTTPSERVER, "%s has an improper Connection HTTP header (%s)", m_name.to_charp(), j->to_charp());
+ send400();
+ return false;
+ }
}
} else {
persistent = true;