Tôi đang cố gắng để thực hiện một máy chủ SSL trong hệ thống sử dụng FiddlerCore:SSL nhận một kỷ lục mà vượt quá độ dài tối đa cho phép khi sửa đổi theo yêu cầu với cáy
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();
}
}
}
trong firefox, GET http://localhost:7777/
hoạt động tốt, nhưng khi tôi GET https://localhost:7777/
, báo cáo firefox lỗi sau:
Tại sao tôi lại có được điều này, và làm thế nào tôi có thể sửa chữa nó?
CẬP NHẬT Điều này xảy ra chỉ khi tôi sử dụng trình kích hoạt làm proxy với firefox. Khi tôi xóa proxy không hợp lệ, tôi có thể truy cập https://localhost:7777/
. Tuy nhiên, tôi cũng muốn có thể truy cập https://localhost:7777/
qua proxy
Hãy sao lưu một chút. Khi Fiddler * không * được đặt làm proxy trong Firefox, bạn có thể truy cập vào https: // localhost: 7777 không? Ngoài ra, phiên bản Firefox chính xác mà bạn đang sử dụng là gì? Một breakpoint trên utilCreateResponseAndBypassServer có bao giờ bị tấn công không? – EricLaw
Tôi đang sử dụng ff17.0.1. Khi tôi truy cập vào 'https: // localhost: 7777' mà không có proxy, nó hoạt động. 'oS.utilCreateResponseAndBypassServer();' bị nhấn và hàm trả về một đáp ứng với lõi fiddler. –