private ToByteArray ( bool prependStatusLine, bool appendEmptyLine ) : byte[] | ||
prependStatusLine | bool | |
appendEmptyLine | bool | |
Résultat | byte[] |
internal bool SecureClientPipe(string sHostname, HTTPResponseHeaders oHeaders) { X509Certificate2 x509Certificate; try { x509Certificate = CertMaker.FindCert(sHostname); } catch (Exception ex) { FiddlerApplication.Log.LogFormat("fiddler.https> Failed to obtain certificate for {0} due to {1}", new object[] { sHostname, ex.Message }); x509Certificate = null; } try { if (x509Certificate == null) { FiddlerApplication.DoNotifyUser("Unable to find Certificate for " + sHostname, "HTTPS Interception Failure"); oHeaders.SetStatus(502, "Fiddler unable to generate certificate"); } if (CONFIG.bDebugSpew) { FiddlerApplication.DebugSpew("SecureClientPipe for: " + this.ToString() + " sending data to client:\n" + Utilities.ByteArrayToHexView(oHeaders.ToByteArray(true, true), 32)); } base.Send(oHeaders.ToByteArray(true, true)); bool result; if (oHeaders.HTTPResponseCode != 200) { FiddlerApplication.DebugSpew("SecureClientPipe returning FALSE because HTTPResponseCode != 200"); result = false; return(result); } this._httpsStream = new SslStream(new NetworkStream(this._baseSocket, false), false); this._httpsStream.AuthenticateAsServer(x509Certificate, ClientPipe._bWantClientCert, CONFIG.oAcceptedClientHTTPSProtocols, false); result = true; return(result); } catch (Exception eX) { FiddlerApplication.Log.LogFormat("SecureClientPipe ({0} failed: {1}.", new object[] { sHostname, Utilities.DescribeException(eX) }); try { base.End(); } catch (Exception) { } } return(false); }
internal bool SecureClientPipe(string sHostname, HTTPResponseHeaders oHeaders) { X509Certificate2 certificate; try { certificate = CertMaker.FindCert(sHostname, true); } catch (Exception exception) { FiddlerApplication.Log.LogFormat("fiddler.https> Failed to obtain certificate for {0} due to {1}", new object[] { sHostname, exception.Message }); certificate = null; } try { if (certificate == null) { FiddlerApplication.DoNotifyUser("Unable to find Certificate for " + sHostname, "HTTPS Interception Failure"); oHeaders.HTTPResponseCode = 0x1f6; oHeaders.HTTPResponseStatus = "502 Fiddler unable to generate certificate"; } if (CONFIG.bDebugSpew) { FiddlerApplication.DebugSpew("SecureClientPipe for: " + this.ToString() + " sending data to client:\n" + Utilities.ByteArrayToHexView(oHeaders.ToByteArray(true, true), 0x20)); } base.Send(oHeaders.ToByteArray(true, true)); if (oHeaders.HTTPResponseCode != 200) { FiddlerApplication.DebugSpew("SecureClientPipe returning FALSE because HTTPResponseCode != 200"); return(false); } base._httpsStream = new SslStream(new NetworkStream(base._baseSocket, false), false); base._httpsStream.AuthenticateAsServer(certificate, _bWantClientCert, CONFIG.oAcceptedClientHTTPSProtocols, false); return(true); } catch (Exception exception2) { FiddlerApplication.Log.LogFormat("Secure client pipe failed: {0}{1}.", new object[] { exception2.Message, (exception2.InnerException == null) ? string.Empty : (" InnerException: " + exception2.InnerException.Message) }); FiddlerApplication.DebugSpew("Secure client pipe failed: " + exception2.Message); try { base.End(); } catch (Exception) { } } return(false); }
internal bool SecureClientPipe(string sHostname, HTTPResponseHeaders oHeaders) { X509Certificate2 certificate; try { certificate = CertMaker.FindCert(sHostname); } catch (Exception exception) { FiddlerApplication.Log.LogFormat("fiddler.https> Failed to obtain certificate for {0} due to {1}", new object[] { sHostname, exception.Message }); certificate = null; } try { if (certificate == null) { FiddlerApplication.DoNotifyUser("Unable to find Certificate for " + sHostname, "HTTPS Interception Failure"); oHeaders.HTTPResponseCode = 0x1f6; oHeaders.HTTPResponseStatus = "502 Fiddler unable to generate certificate"; } if (CONFIG.bDebugSpew) { FiddlerApplication.DebugSpew("SecureClientPipe for: " + this.ToString() + " sending data to client:\n" + Utilities.ByteArrayToHexView(oHeaders.ToByteArray(true, true), 0x20)); } base.Send(oHeaders.ToByteArray(true, true)); if (oHeaders.HTTPResponseCode != 200) { FiddlerApplication.DebugSpew("SecureClientPipe returning FALSE because HTTPResponseCode != 200"); return false; } base._httpsStream = new SslStream(new NetworkStream(base._baseSocket, false), false); base._httpsStream.AuthenticateAsServer(certificate, _bWantClientCert, CONFIG.oAcceptedClientHTTPSProtocols, false); return true; } catch (Exception exception2) { FiddlerApplication.Log.LogFormat("SecureClientPipe ({0} failed: {1}.", new object[] { sHostname, Utilities.DescribeException(exception2) }); try { base.End(); } catch (Exception) { } } return false; }