Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Bugfix for http connection header validation - Connection header was not handled correctly if it contains multiple values, e.g. Connection: TE, close

thelied2cb040d1b3
diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java
index ead72db1f..7ebc16cc2 100644
--- a/source/de/anomic/http/httpd.java
+++ b/source/de/anomic/http/httpd.java
@@ -257,8 +257,8 @@ public final class httpd implements serverHandler {
// persistent by default, but closed with the "Connection: close"
// property.
boolean persistent = !(httpVersion.equals("HTTP/0.9") || httpVersion.equals("HTTP/1.0"));
- if (((String)header.get(httpHeader.CONNECTION, "keep-alive")).toLowerCase().equals("close") ||
- ((String)header.get(httpHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().equals("close")) {
+ if (((String)header.get(httpHeader.CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1 ||
+ ((String)header.get(httpHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1) {
persistent = false;
}
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java
index 963b529b3..b8818c931 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/httpdFileHandler.java
@@ -872,7 +872,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
} finally {
try {out.flush();}catch (Exception e) {}
- if (!(requestHeader.get(httpHeader.CONNECTION, "close").equals("keep-alive"))) {
+ if (((String)requestHeader.get(httpHeader.CONNECTION, "close")).indexOf("keep-alive") == -1) {
// wait a little time until everything closes so that clients can read from the streams/sockets
try {Thread.sleep(1000);} catch (InterruptedException e) {}
}