From d42d6b7fe7f0a1779b02d95e53d76f8d98e6027e Mon Sep 17 00:00:00 2001 From: bboysoul <31786046+bboysoulcn@users.noreply.github.com> Date: Tue, 29 Jun 2021 11:28:55 +0800 Subject: [PATCH] Update https.go --- server/proxy/https.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/proxy/https.go b/server/proxy/https.go index 962f9a5..a0456fc 100644 --- a/server/proxy/https.go +++ b/server/proxy/https.go @@ -104,7 +104,7 @@ func (https *HttpsServer) NewHttps(l net.Listener, certFile string, keyFile stri func (https *HttpsServer) handleHttps(c net.Conn) { hostName, rb := GetServerNameFromClientHello(c) var targetAddr string - r := buildHttpsRequest(hostName,c) + r := buildMyHttpsRequest(hostName,c) var host *file.Host var err error if host, err = file.GetDb().GetInfoByHost(hostName, r); err != nil { @@ -177,7 +177,17 @@ func GetServerNameFromClientHello(c net.Conn) (string, []byte) { } // build https request -func buildHttpsRequest(hostName string, c net.Conn) *http.Request { +func buildHttpsRequest(hostName string) *http.Request { + r := new(http.Request) + r.RequestURI = "/" + r.URL = new(url.URL) + r.URL.Scheme = "https" + r.Host = hostName + return r +} +// addheader req + +func buildMyHttpsRequest(hostName string, c net.Conn) *http.Request { r := new(http.Request) r.RequestURI = "/" r.URL = new(url.URL)