protected void OnRemoteReceive(IAsyncResult iasyncResult_0) { try { int num = this.pipeToRemote.EndReceive(iasyncResult_0); if (num > 0) { this._lngIngressByteCount += (long)num; Trace.WriteLine("[GenericTunnel] Received from server: " + num.ToString() + " bytes. Sending to client..."); Trace.WriteLine(Utilities.ByteArrayToHexView(this.arrResponseBytes, 16, num)); FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, num); this.pipeToClient.Send(this.arrResponseBytes, 0, num); this.pipeToRemote.BeginReceive(this.arrResponseBytes, 0, this.arrResponseBytes.Length, SocketFlags.None, new AsyncCallback(this.OnRemoteReceive), null); } else { Trace.WriteLine("[GenericTunnel] ReadFromRemote failed, ret=" + num.ToString()); FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, 0); this.CloseTunnel(); } } catch (Exception ex) { Trace.WriteLine("[GenericTunnel] OnRemoteReceive failed... " + ex.Message); this.CloseTunnel(); } }
protected void OnRemoteReceive(IAsyncResult iasyncResult_0) { try { int num = this.socketRemote.EndReceive(iasyncResult_0); if (num > 0) { this._lngIngressByteCount += (long)num; FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, num); if (this._mySession.responseBodyBytes != null) { if (this._mySession.responseBodyBytes.LongLength != 0L) { goto IL_107; } } try { HTTPSServerHello hTTPSServerHello = new HTTPSServerHello(); if (hTTPSServerHello.LoadFromStream(new MemoryStream(this.arrResponseBytes, 0, num, false))) { string s = string.Format("This is a CONNECT tunnel, through which encrypted HTTPS traffic flows.\n{0}\n\n{1}\n", CONFIG.bMITM_HTTPS ? "Fiddler's HTTPS Decryption feature is enabled, but this specific tunnel was configured not to be decrypted. Settings can be found inside Tools > Fiddler Options > HTTPS." : "To view the encrypted sessions inside this tunnel, enable the Tools > Fiddler Options > HTTPS > Decrypt HTTPS traffic option.", hTTPSServerHello.ToString()); this._mySession.responseBodyBytes = Encoding.UTF8.GetBytes(s); this._mySession["https-Server-SessionID"] = hTTPSServerHello.SessionID; this._mySession["https-Server-Cipher"] = hTTPSServerHello.CipherSuite; } } catch (Exception ex) { this._mySession.requestBodyBytes = Encoding.UTF8.GetBytes("Response HTTPSParse failed: " + ex.Message); } IL_107: this.socketClient.BeginSend(this.arrResponseBytes, 0, num, SocketFlags.None, new AsyncCallback(this.OnClientSent), this.socketClient); } else { FiddlerApplication.DoReadResponseBuffer(this._mySession, this.arrResponseBytes, 0); this.CloseTunnel(); } } catch (Exception) { this.CloseTunnel(); } }