不支持CONNECT方法

This commit is contained in:
GoEdgeLab
2022-12-19 16:27:58 +08:00
parent 9c26ea80cc
commit a8111c76f6

View File

@@ -116,6 +116,12 @@ func (this *HTTPListener) Reload(group *serverconfigs.ServerAddressGroup) {
// ServerHTTP 处理HTTP请求 // ServerHTTP 处理HTTP请求
func (this *HTTPListener) ServeHTTP(rawWriter http.ResponseWriter, rawReq *http.Request) { func (this *HTTPListener) ServeHTTP(rawWriter http.ResponseWriter, rawReq *http.Request) {
// 不支持Connect
if rawReq.Method == http.MethodConnect {
http.Error(rawWriter, "Method Not Allowed", http.StatusMethodNotAllowed)
return
}
// 域名 // 域名
var reqHost = strings.TrimRight(rawReq.Host, ".") var reqHost = strings.TrimRight(rawReq.Host, ".")