Unverified Commit 8fdadb17 authored by justcoding121's avatar justcoding121 Committed by GitHub

Merge pull request #437 from justcoding121/master

Cache key fixes 
parents ba234a9c d329afdd
...@@ -46,9 +46,16 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -46,9 +46,16 @@ namespace Titanium.Web.Proxy.Network.Tcp
Version httpVersion, bool isHttps, List<SslApplicationProtocol> applicationProtocols, bool isConnect, Version httpVersion, bool isHttps, List<SslApplicationProtocol> applicationProtocols, bool isConnect,
ProxyServer proxyServer, IPEndPoint upStreamEndPoint, ExternalProxy externalProxy) ProxyServer proxyServer, IPEndPoint upStreamEndPoint, ExternalProxy externalProxy)
{ {
//http version is ignored since its an application level decision b/w HTTP 1.0/1.1
//also when doing connect request MS Edge browser sends http 1.0 but uses 1.1 after server sends 1.1 its response.
//That can create cache miss for same server connection unneccessarily expecially when prefetcing with Connect.
//http version 2 is separated using applicationProtocols below.
var cacheKeyBuilder = new StringBuilder($"{remoteHostName}-{remotePort}" + var cacheKeyBuilder = new StringBuilder($"{remoteHostName}-{remotePort}" +
$"-{(httpVersion == null ? string.Empty : httpVersion.ToString())}" + //when creating Tcp client if isHttps is true then isConnect won't matter
$"-{isHttps}-{isConnect}-"); //using {isHttps||isConnect} will prevent getting different cacheKeys
//in Explicit client handler for prefetch and in Request handler
//when checking for changed cache key!
$"-{isHttps}-{isHttps||isConnect}-");
if (applicationProtocols != null) if (applicationProtocols != null)
{ {
foreach (var protocol in applicationProtocols) foreach (var protocol in applicationProtocols)
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment