strip the Connection, Keep-Alive, and Proxy-Connection headers, and always inject Connection: close
(this is the cause of the intermittent "view $page through squid, try to view eepsite, end up requesting through squid" bug)
This commit is contained in:
@ -119,6 +119,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
|||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Line=[" + line + "]");
|
_log.debug("Line=[" + line + "]");
|
||||||
|
|
||||||
|
if (line.startsWith("Connection: ") ||
|
||||||
|
line.startsWith("Keep-Alive: ") ||
|
||||||
|
line.startsWith("Proxy-Connection: "))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (method == null) { // first line (GET /base64/realaddr)
|
if (method == null) { // first line (GET /base64/realaddr)
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Method is null for [" + line + "]");
|
_log.debug("Method is null for [" + line + "]");
|
||||||
@ -190,8 +195,13 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
|||||||
_log.info("Setting host = " + host);
|
_log.info("Setting host = " + host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newRequest.append(line).append("\r\n"); // HTTP spec
|
|
||||||
if (line.length() == 0) break;
|
if (line.length() == 0) {
|
||||||
|
newRequest.append("Connection: close\r\n\r\n");
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
newRequest.append(line).append("\r\n"); // HTTP spec
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("NewRequest header: [" + newRequest.toString() + "]");
|
_log.debug("NewRequest header: [" + newRequest.toString() + "]");
|
||||||
|
Reference in New Issue
Block a user