我試圖實現使用FiddlerCore一個在系統SSL服務器修改請求時超過了最大允許長度的記錄:SSL收到與小提琴手
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace fiddlerCoreTest
{
using System.IO;
using System.Threading;
using Fiddler;
class Program
{
static Proxy oSecureEndpoint;
static string sSecureEndpointHostname = "localhost";
static int iSecureEndpointPort = 7777;
static void Main(string[] args)
{
//var tt = Fiddler.CertMaker.GetRootCertificate().GetRawCertData();
//File.WriteAllBytes("root.crt",tt);
Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
{
oS.bBufferResponse = false;
if ((oS.hostname == sSecureEndpointHostname)&&oS.port==7777)
{
oS.utilCreateResponseAndBypassServer();
oS.oResponse.headers.HTTPResponseStatus = "200 Ok";
oS.oResponse["Content-Type"] = "text/html; charset=UTF-8";
oS.oResponse["Cache-Control"] = "private, max-age=0";
oS.utilSetResponseBody("<html><body>Request for httpS://" + sSecureEndpointHostname + ":" + iSecureEndpointPort.ToString() + " received. Your request was:<br /><plaintext>" + oS.oRequest.headers.ToString());
}
};
FiddlerCoreStartupFlags oFCSF = FiddlerCoreStartupFlags.Default;
oFCSF = (oFCSF & ~FiddlerCoreStartupFlags.RegisterAsSystemProxy);
Fiddler.FiddlerApplication.Startup(8877, oFCSF);
oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(iSecureEndpointPort, true, sSecureEndpointHostname);
if (null != oSecureEndpoint)
{
FiddlerApplication.Log.LogFormat("Created secure end point listening on port {0}, using a HTTPS certificate for '{1}'", iSecureEndpointPort, sSecureEndpointHostname);
}
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
}
在Firefox
,GET http://localhost:7777/
工作正常,但是當我得到https://localhost:7777/
,以下錯誤Firefox的報道:
爲什麼我得到這個,我怎麼能解決這個問題?
UPDATE 這只是發生在我使用的是與Firefox代理小提琴手。當我刪除小提琴手代理時,我可以訪問https://localhost:7777/
。但是,我還希望能夠通過代理訪問https://localhost:7777/
讓我們稍微備份一下。當Fiddler *在Firefox中未被設置爲代理時,您可以訪問https:// localhost:7777嗎?另外,您使用的Firefox的確切版本是什麼? utilCreateResponseAndBypassServer上的斷點是否受到影響? – EricLaw
我正在使用ff17.0.1。當我訪問沒有代理的「https:// localhost:7777」時,它可以工作。 'oS.utilCreateResponseAndBypassServer();'被命中,並且該函數返回對fiddler核心的響應。 –