mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-15 23:26:36 +08:00
接收请求时保留URL路径中多于的斜杠(/)
This commit is contained in:
@@ -37,18 +37,13 @@ type HTTPListener struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *HTTPListener) Serve() error {
|
func (this *HTTPListener) Serve() error {
|
||||||
handler := http.NewServeMux()
|
|
||||||
handler.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
|
|
||||||
this.handleHTTP(writer, request)
|
|
||||||
})
|
|
||||||
|
|
||||||
this.addr = this.Group.Addr()
|
this.addr = this.Group.Addr()
|
||||||
this.isHTTP = this.Group.IsHTTP()
|
this.isHTTP = this.Group.IsHTTP()
|
||||||
this.isHTTPS = this.Group.IsHTTPS()
|
this.isHTTPS = this.Group.IsHTTPS()
|
||||||
|
|
||||||
this.httpServer = &http.Server{
|
this.httpServer = &http.Server{
|
||||||
Addr: this.addr,
|
Addr: this.addr,
|
||||||
Handler: handler,
|
Handler: this,
|
||||||
ReadHeaderTimeout: 2 * time.Second, // TODO 改成可以配置
|
ReadHeaderTimeout: 2 * time.Second, // TODO 改成可以配置
|
||||||
IdleTimeout: 2 * time.Minute, // TODO 改成可以配置
|
IdleTimeout: 2 * time.Minute, // TODO 改成可以配置
|
||||||
ErrorLog: httpErrorLogger,
|
ErrorLog: httpErrorLogger,
|
||||||
@@ -118,8 +113,8 @@ func (this *HTTPListener) Reload(group *serverconfigs.ServerAddressGroup) {
|
|||||||
this.Reset()
|
this.Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理HTTP请求
|
// ServerHTTP 处理HTTP请求
|
||||||
func (this *HTTPListener) handleHTTP(rawWriter http.ResponseWriter, rawReq *http.Request) {
|
func (this *HTTPListener) ServeHTTP(rawWriter http.ResponseWriter, rawReq *http.Request) {
|
||||||
// 域名
|
// 域名
|
||||||
reqHost := rawReq.Host
|
reqHost := rawReq.Host
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user