|
@@ -126,7 +126,7 @@ func (v *VhostMuxer) handle(c frpNet.Conn) {
|
|
|
|
|
|
sConn, reqInfoMap, err := v.vhostFunc(c)
|
|
sConn, reqInfoMap, err := v.vhostFunc(c)
|
|
if err != nil {
|
|
if err != nil {
|
|
- log.Error("get hostname from http/https request error: %v", err)
|
|
|
|
|
|
+ log.Warn("get hostname from http/https request error: %v", err)
|
|
c.Close()
|
|
c.Close()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -135,17 +135,19 @@ func (v *VhostMuxer) handle(c frpNet.Conn) {
|
|
path := strings.ToLower(reqInfoMap["Path"])
|
|
path := strings.ToLower(reqInfoMap["Path"])
|
|
l, ok := v.getListener(name, path)
|
|
l, ok := v.getListener(name, path)
|
|
if !ok {
|
|
if !ok {
|
|
|
|
+ res := notFoundResponse()
|
|
|
|
+ res.Write(c)
|
|
log.Debug("http request for host [%s] path [%s] not found", name, path)
|
|
log.Debug("http request for host [%s] path [%s] not found", name, path)
|
|
c.Close()
|
|
c.Close()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// if authFunc is exist and userName/password is set
|
|
// if authFunc is exist and userName/password is set
|
|
- // verify user access
|
|
|
|
|
|
+ // then verify user access
|
|
if l.mux.authFunc != nil && l.userName != "" && l.passWord != "" {
|
|
if l.mux.authFunc != nil && l.userName != "" && l.passWord != "" {
|
|
bAccess, err := l.mux.authFunc(c, l.userName, l.passWord, reqInfoMap["Authorization"])
|
|
bAccess, err := l.mux.authFunc(c, l.userName, l.passWord, reqInfoMap["Authorization"])
|
|
if bAccess == false || err != nil {
|
|
if bAccess == false || err != nil {
|
|
- l.Debug("check Authorization failed")
|
|
|
|
|
|
+ l.Debug("check http Authorization failed")
|
|
res := noAuthResponse()
|
|
res := noAuthResponse()
|
|
res.Write(c)
|
|
res.Write(c)
|
|
c.Close()
|
|
c.Close()
|