async public static Task <ProxySslRequest> For(ProxyRequest wrapperRequest, IRequestInspector wrapperRequestInspector) { if (_certProvider == null) { _certProvider = new CertificateProvider(MakeCertPath); _certProvider.EnsureRootCertificate(); } var sslRequest = new ProxySslRequest { WrapperRequest = wrapperRequest, ClientPid = wrapperRequest.ClientPid, ClientSocket = wrapperRequest.ClientSocket, ClientStream = wrapperRequest.ClientStream }; if (wrapperRequestInspector != null) { wrapperRequestInspector.OnTransferredToSecureRequest(sslRequest); } var hostName = sslRequest.GetHostName(); sslRequest._hostCert = _certProvider.GetCertificateForHost(hostName); var clientSsslStream = new SslStream(wrapperRequest.ClientStream, true, RemoteCertificateValidator, sslRequest.LocalCertificateSelector); await clientSsslStream.AuthenticateAsServerAsync(sslRequest._hostCert); sslRequest.SecureClientStream = clientSsslStream; sslRequest.ReadPrologue(); return(sslRequest); }
async public static Task<ProxySslRequest> For(ProxyRequest wrapperRequest, IRequestInspector wrapperRequestInspector) { if (_certProvider == null) { _certProvider = new CertificateProvider(MakeCertPath); _certProvider.EnsureRootCertificate(); } var sslRequest = new ProxySslRequest { WrapperRequest = wrapperRequest, ClientPid = wrapperRequest.ClientPid, ClientSocket = wrapperRequest.ClientSocket, ClientStream = wrapperRequest.ClientStream }; if (wrapperRequestInspector != null) wrapperRequestInspector.OnTransferredToSecureRequest(sslRequest); var hostName = sslRequest.GetHostName(); sslRequest._hostCert = _certProvider.GetCertificateForHost(hostName); var clientSsslStream = new SslStream(wrapperRequest.ClientStream, true, RemoteCertificateValidator, sslRequest.LocalCertificateSelector); await clientSsslStream.AuthenticateAsServerAsync(sslRequest._hostCert); sslRequest.SecureClientStream = clientSsslStream; sslRequest.ReadPrologue(); return sslRequest; }
async public static Task<ProxyResponse> From(Socket socket, Stream stream, IRequestInspector requestInspector) { var response = new ProxyResponse(); response.RemoteSocket = socket; response.RemoteStream = stream; requestInspector.OnResponseBegun(response); await response.ReadPrologue(); await response.ReadContent(); return response; }
async public static Task <ProxyResponse> From(Socket socket, Stream stream, IRequestInspector requestInspector) { var response = new ProxyResponse(); response.RemoteSocket = socket; response.RemoteStream = stream; requestInspector.OnResponseBegun(response); await response.ReadPrologue(); await response.ReadContent(); return(response); }
public void RegisterInspector(IRequestInspector requestInspector) { _requestInspector = requestInspector; }