[WEBSOCKET]在日志中增加详细错误提示/TLS连接增加InsecureSkipVerify选项

This commit is contained in:
GoEdgeLab
2020-11-30 15:29:02 +08:00
parent 494112adbe
commit f61aa657fc
2 changed files with 6 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
package nodes
import (
"errors"
"github.com/iwind/TeaGo/logs"
"io"
"net/http"
@@ -11,6 +12,7 @@ import (
func (this *HTTPRequest) doWebsocket() {
if this.web.WebsocketRef == nil || !this.web.WebsocketRef.IsOn || this.web.Websocket == nil || !this.web.Websocket.IsOn {
this.writer.WriteHeader(http.StatusForbidden)
this.addError(errors.New("websocket have not been enabled yet"))
return
}
@@ -23,6 +25,7 @@ func (this *HTTPRequest) doWebsocket() {
if err == nil {
if !this.web.Websocket.MatchOrigin(u.Host) {
this.writer.WriteHeader(http.StatusForbidden)
this.addError(errors.New("websocket origin '" + requestOrigin + "' not been allowed"))
return
}
}