mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-16 04:42:22 +08:00
Fix method check for v2ray HTTP transport
This commit is contained in:
parent
2eecdc38a4
commit
4669854039
|
@ -53,9 +53,6 @@ func NewServer(ctx context.Context, options option.V2RayHTTPOptions, tlsConfig t
|
||||||
method: options.Method,
|
method: options.Method,
|
||||||
headers: options.Headers.Build(),
|
headers: options.Headers.Build(),
|
||||||
}
|
}
|
||||||
if server.method == "" {
|
|
||||||
server.method = "PUT"
|
|
||||||
}
|
|
||||||
if !strings.HasPrefix(server.path, "/") {
|
if !strings.HasPrefix(server.path, "/") {
|
||||||
server.path = "/" + server.path
|
server.path = "/" + server.path
|
||||||
}
|
}
|
||||||
|
@ -85,7 +82,7 @@ func (s *Server) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
|
||||||
s.invalidRequest(writer, request, http.StatusNotFound, E.New("bad path: ", request.URL.Path))
|
s.invalidRequest(writer, request, http.StatusNotFound, E.New("bad path: ", request.URL.Path))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if request.Method != s.method {
|
if s.method != "" && request.Method != s.method {
|
||||||
s.invalidRequest(writer, request, http.StatusNotFound, E.New("bad method: ", request.Method))
|
s.invalidRequest(writer, request, http.StatusNotFound, E.New("bad method: ", request.Method))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user