Skip to content

Commit

Permalink
*) Bugfix for http connection header validation
Browse files Browse the repository at this point in the history
   - Connection header was not handled correctly if it contains
     multiple values, e.g. Connection: TE, close 

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2219 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
theli committed Jun 20, 2006
1 parent f95c006 commit ed2cb04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/de/anomic/http/httpd.java
Expand Up @@ -257,8 +257,8 @@ private boolean handlePersistentConnection(httpHeader header) {
// 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;
}

Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/http/httpdFileHandler.java
Expand Up @@ -872,7 +872,7 @@ public void doResponse(Properties conProp, httpHeader requestHeader, OutputStrea

} 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) {}
}
Expand Down

0 comments on commit ed2cb04

Please sign in to comment.