ソースを参照

Merge pull request #339 from dutchcoders/PR-298

clone url
tags/v1.2.0
Andrea Spacca 3年前
committed by GitHub
コミット
be6dea2546
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: 4AEE18F83AFDEB23
1個のファイルの変更15行の追加1行の削除
  1. +15
    -1
      server/handlers.go

+ 15
- 1
server/handlers.go ファイルの表示

@@ -556,8 +556,22 @@ func resolveWebAddress(r *http.Request, proxyPath string, proxyPort string) stri
return webAddress
}

// Similar to the logic found here:
// https://github.com/golang/go/blob/release-branch.go1.14/src/net/http/clone.go#L22-L33
func cloneURL(u *url.URL) *url.URL {
c := &url.URL{}
*c = *u

if u.User != nil {
c.User = &url.Userinfo{}
*c.User = *u.User
}

return c
}

func getURL(r *http.Request, proxyPort string) *url.URL {
u, _ := url.Parse(r.URL.String())
u := cloneURL(r.URL)

if r.TLS != nil {
u.Scheme = "https"


読み込み中…
キャンセル
保存