static void FiddlerApplication_BeforeRequest(Session rpSession) { if (Preference.Current.Network.UpstreamProxy.Enabled) rpSession["x-OverrideGateway"] = Preference.Current.Network.UpstreamProxy.Address; var rRequest = rpSession.oRequest; var rFullUrl = rpSession.fullUrl; var rPath = rpSession.PathAndQuery; NetworkSession rSession; if (rPath.StartsWith("/kcsapi/")) rSession = new ApiSession(rFullUrl); else if (rPath.StartsWith("/kcs/") || rPath.StartsWith("/gadget/")) rSession = new ResourceSession(rFullUrl, rPath); else rSession = new NetworkSession(rFullUrl); rSession.RequestBodyString = Uri.UnescapeDataString(rpSession.GetRequestBodyAsString()); rpSession.Tag = rSession; SessionSubject.OnNext(rSession); if (rFullUrl == GameConstants.GamePageUrl || rPath == "/gadget/js/kcs_flash.js") rpSession.bBufferResponse = true; var rResourceSession = rSession as ResourceSession; if (rResourceSession != null) CacheService.Instance.ProcessRequest(rResourceSession, rpSession); }
static void FiddlerApplication_BeforeRequest(Session rpSession) { if (r_BlockingList.Any(rpSession.uriContains)) { rpSession.utilCreateResponseAndBypassServer(); return; } if (!r_UpstreamProxy.IsNullOrEmpty()) { rpSession["x-OverrideGateway"] = r_UpstreamProxy; } var rRequest = rpSession.oRequest; var rFullUrl = rpSession.fullUrl; var rPath = rpSession.PathAndQuery; NetworkSession rSession; ApiSession rApiSession = null; if (rPath.StartsWith("/kcsapi/")) { rSession = rApiSession = new ApiSession(rFullUrl); } else if (rPath.StartsWith("/kcs/") || rPath.StartsWith("/gadget/")) { rSession = new ResourceSession(rFullUrl, rPath); } else { rSession = new NetworkSession(rFullUrl); } if (rApiSession != null && RequestFilterService.Instance.IsBlocked(rApiSession)) { rSession.State = NetworkSessionState.Blocked; rpSession.utilCreateResponseAndBypassServer(); return; } rSession.RequestBodyString = Uri.UnescapeDataString(rpSession.GetRequestBodyAsString()); rSession.Method = rpSession.RequestMethod; rpSession.Tag = rSession; if (rFullUrl.OICEquals(GameConstants.GamePageUrl) || rFullUrl.OICEquals("http://www.dmm.com/netgame_s/kancolle/") || rPath.OICEquals("/gadget/js/kcs_flash.js")) { rpSession.bBufferResponse = true; } var rResourceSession = rSession as ResourceSession; if (rResourceSession != null) { CacheService.Instance.ProcessRequest(rResourceSession, rpSession); } rSession.RequestHeaders = rpSession.RequestHeaders.Select(r => new SessionHeader(r.Name, r.Value)).ToArray(); SessionSubject.OnNext(rSession); if (!rpSession.bHasResponse && r_TrafficBarrier != null) { r_TrafficBarrier.Wait(); } }
public SessionViewModel(NetworkSession rpSession) { Source = rpSession; }