Fiddlercore - 请求的资源 URL 是通用的(与 OSCP 相关的)而不是实际资源

Fiddlercore - Requested resource URL's are generic (OSCP-related) instead of actual resource

我正在关注 this blogpost 以尝试了解 Fiddlercore 的功能。 根据博客,生成的控制台输出应该类似于:

Requested resource from URL http://www.mozilla.org/
Requested resource from URL http://mozorg.cdn.mozilla.net/media/css/tabzilla-min.css?build=c2a3f7a
Requested resource from URL http://mozorg.cdn.mozilla.net/media/js/site-min.js?build=c2a3f7a
Requested resource from URL http://mozorg.cdn.mozilla.net/media/css/responsive-min.css?build=c2a3f7a
Requested resource from URL http://mozorg.cdn.mozilla.net/media/img/favicon.ico
Requested resource from URL http://www.mozilla.org/en-US/

但是,在我的例子中,输出有一些相当通用的 URL。我想我的代理、浏览器……某处设置有问题?但我不知道是什么。 我正在尝试编写等待特定资源加载的代码,因此下面的输出并不是很有用。

Starting Fiddler proxy
Fiddler proxy listening on port 6143
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://www.mozilla.org/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://vassg142.ocsp.omniroot.com/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://clients1.google.com/ocsp
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://clients1.google.com/ocsp
Requested resource from URL http://clients1.google.com/ocsp
Requested resource from URL http://clients1.google.com/ocsp

问题已解决。 首先,我没有安装证书,但已通过以下代码修复:

        if (!Fiddler.CertMaker.rootCertExists())
                {
                    if (!Fiddler.CertMaker.createRootCert())
                    {
                        throw new Exception("Unable to create cert for FiddlerCore.");
            }
        }

        if (!Fiddler.CertMaker.rootCertIsTrusted())
        {
            if (!Fiddler.CertMaker.trustRootCert())
            {
                throw new Exception("Unable to install FiddlerCore's cert.");
            }
        }

其次,我必须为 Selenium 定义 SslProxy 以捕获 HTTPS:

        OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
        proxy.HttpProxy = string.Format("127.0.0.1:{0}", proxyPort);
        proxy.SslProxy = string.Format("127.0.0.1:{0}", proxyPort);

遇到同样的问题,但通过切换到 ChromeDriver 并指定 ssl 选项得到解决:

    server = new Server(@"C:\Users\<user>\Desktop\browsermob-proxy-2.1.4\bin\browsermob-proxy.
    server.Start();
    client = server.CreateProxy();
    client.NewHar("Test");
    var seleniumProxy = new Proxy { HttpProxy = client.SeleniumProxy, SslProxy= client.SeleniumProxy };
    ChromeOptions co = new ChromeOptions();
    co.Proxy = seleniumProxy;
    co.AcceptInsecureCertificates = true;
    driver = new ChromeDriver(co);
    ...