Beispiel #1
0
 internal static void HandleHTTPError(Session oSession, SessionFlags flagViolation, bool bPoisonClientConnection, bool bPoisonServerConnection, string sMessage)
 {
     if (bPoisonClientConnection)
     {
         oSession.PoisonClientPipe();
     }
     if (bPoisonServerConnection)
     {
         oSession.PoisonServerPipe();
     }
     oSession.SetBitFlag(flagViolation, true);
     if ((CONFIG.bReportHTTPErrors && !CONFIG.QuietMode) && !oSession.oFlags.ContainsKey("x-HTTPProtocol-Violation"))
     {
         oSession.oFlags.Remove("ui-hide");
         frmAlert alert = new frmAlert("HTTP Protocol Violation", "Fiddler has detected a protocol violation in session #" + oSession.id.ToString() + ".\n\n" + sMessage, "Note: You can disable this message using Tools | Fiddler Options");
         _frmMain.BeginInvoke(new alerterDelegate(_frmMain.ShowAlert), new object[] { alert });
     }
     Log.LogFormat("{0} - [#{1}] {2}", new object[] { "Fiddler.Network.ProtocolViolation", oSession.id.ToString(), sMessage });
     sMessage = "[ProtocolViolation] " + sMessage;
     if ((oSession["x-HTTPProtocol-Violation"] == null) || !oSession["x-HTTPProtocol-Violation"].Contains(sMessage))
     {
         Session session;
         (session = oSession)["x-HTTPProtocol-Violation"] = session["x-HTTPProtocol-Violation"] + sMessage;
     }
 }
Beispiel #2
0
        private static bool ConfirmServerCertificate(Session oS, string sExpectedCN, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            bool flag;

            if (FiddlerApplication.CheckOverrideCertificatePolicy(oS, sExpectedCN, certificate, chain, sslPolicyErrors, out flag))
            {
                return(flag);
            }
            if ((sslPolicyErrors == SslPolicyErrors.None) || CONFIG.IgnoreServerCertErrors)
            {
                return(true);
            }
            if ((slAcceptableBadCertificates != null) && slAcceptableBadCertificates.Contains(certificate.GetSerialNumberString()))
            {
                return(true);
            }
            if (CONFIG.QuietMode)
            {
                return(false);
            }
            frmAlert alert = new frmAlert("Ignore remote certificate error?", string.Format("Session #{5}: The remote server ({0}) presented a certificate that did not validate, due to {1}.\r\n\r\nSUBJECT: {2}\r\nISSUER: {3}\r\nEXPIRES: {4}\r\n\r\n(This warning can be disabled by clicking Tools | Fiddler Options.)", new object[] { sExpectedCN, sslPolicyErrors, certificate.Subject, certificate.Issuer, certificate.GetExpirationDateString(), oS.id }), "Ignore errors and proceed anyway?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2)
            {
                TopMost       = true,
                StartPosition = FormStartPosition.CenterScreen
            };
            DialogResult result = (DialogResult)FiddlerApplication._frmMain.Invoke(new getDecisionDelegate(FiddlerApplication._frmMain.GetDecision), new object[] { alert });

            if (DialogResult.Yes == result)
            {
                if (slAcceptableBadCertificates == null)
                {
                    slAcceptableBadCertificates = new StringCollection();
                }
                slAcceptableBadCertificates.Add(certificate.GetSerialNumberString());
            }
            return(DialogResult.Yes == result);
        }