i2ptunnel: Fix HTTP websockets by passing through

Connection headers containing "upgrade" (ticket #2422)
Server-side change only. Client-side in previous commit.
This commit is contained in:
zzz
2019-02-03 17:29:16 +00:00
parent e20a6a9685
commit bd6cf53d53
3 changed files with 11 additions and 2 deletions

View File

@ -516,7 +516,12 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
} }
if (spoofHost != null) if (spoofHost != null)
setEntry(headers, "Host", spoofHost); setEntry(headers, "Host", spoofHost);
setEntry(headers, "Connection", "close");
// Force Connection: close, unless websocket
String conn = getEntryOrNull(headers, "Connection");
if (conn == null || !conn.toLowerCase(Locale.US).contains("upgrade"))
setEntry(headers, "Connection", "close");
// we keep the enc sent by the browser before clobbering it, since it may have // we keep the enc sent by the browser before clobbering it, since it may have
// been x-i2p-gzip // been x-i2p-gzip
String enc = getEntryOrNull(headers, "Accept-Encoding"); String enc = getEntryOrNull(headers, "Accept-Encoding");
@ -1044,6 +1049,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
name = "User-Agent"; name = "User-Agent";
else if ("referer".equals(lcName)) else if ("referer".equals(lcName))
name = "Referer"; name = "Referer";
else if ("connection".equals(lcName))
name = "Connection";
// For incoming, we remove certain headers to prevent spoofing. // For incoming, we remove certain headers to prevent spoofing.
// For outgoing, we remove certain headers to improve anonymity. // For outgoing, we remove certain headers to improve anonymity.

View File

@ -2,6 +2,8 @@
* I2CP: * I2CP:
- Remove revocation private key from CreateLeaseset2 message - Remove revocation private key from CreateLeaseset2 message
- Use correct key to sign SessionConfig with offline keys - Use correct key to sign SessionConfig with offline keys
* i2ptunnel: Fix HTTP websockets by passing through
Connection headers containing "upgrade" (ticket #2422)
* Streaming: * Streaming:
- Support offline signatures (proposal 123) - Support offline signatures (proposal 123)
- Don't send FROM in RESET, not required since 0.9.20 - Don't send FROM in RESET, not required since 0.9.20

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 5; public final static long BUILD = 6;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";