mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-02 03:57:38 +03:00
fix: check masq url scheme in server cfg parsing
Check the url scheme of masquerade.proxy.url when parsing server config and fail fast if it is not "http" or "https". ref: #1227 The user assigned the URL with a naked hostname and got errors until the request was handled.
This commit is contained in:
parent
b960beabbd
commit
af2d75d1d0
1 changed files with 3 additions and 0 deletions
|
@ -804,6 +804,9 @@ func (c *serverConfig) fillMasqHandler(hyConfig *server.Config) error {
|
|||
if err != nil {
|
||||
return configError{Field: "masquerade.proxy.url", Err: err}
|
||||
}
|
||||
if u.Scheme != "http" && u.Scheme != "https" {
|
||||
return configError{Field: "masquerade.proxy.url", Err: fmt.Errorf("unsupported protocol scheme \"%s\"", u.Scheme)}
|
||||
}
|
||||
handler = &httputil.ReverseProxy{
|
||||
Rewrite: func(r *httputil.ProxyRequest) {
|
||||
r.SetURL(u)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue