Skip to content

Commit

Permalink
chore: add more debug log
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Jan 16, 2025
1 parent 391096e commit b449981
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ func httpProxyRedirect(br *broker, c *gin.Context) {
if location == "" {
location = cfg.HttpProxyRedirURL
if location != "" {
log.Debug().Msgf("use HttpProxyRedirURL from config: %s", location)
log.Debug().Msgf("use HttpProxyRedirURL from config: %s, devid: %s", location, devid)
}
} else {
log.Debug().Msgf("use HttpProxyRedir from HTTP header: %s", location)
log.Debug().Msgf("use HttpProxyRedir from HTTP header: %s, devid: %s", location, devid)
}

if location == "" {
Expand Down Expand Up @@ -361,21 +361,24 @@ func httpProxyRedirect(br *broker, c *gin.Context) {
if v, ok := httpProxySessions.Load(sid); ok {
close(v.(chan struct{}))
httpProxySessions.Delete(sid)
log.Debug().Msgf(`del old httpProxySession "%s" for device "%s"`, sid, devid)
}
}

sid = utils.GenUniqueID("http-proxy")

httpProxySessions.Store(sid, make(chan struct{}))

log.Debug().Msgf(`new httpProxySession "%s" for device "%s"`, sid, devid)

domain := c.Request.Header.Get("HttpProxyRedirDomain")
if domain == "" {
domain = cfg.HttpProxyRedirDomain
if domain != "" {
log.Debug().Msgf("set cookie domain from config: %s", domain)
log.Debug().Msgf("set cookie domain from config: %s, devid: %s", domain, devid)
}
} else {
log.Debug().Msgf("set cookie domain from HTTP header: %s", domain)
log.Debug().Msgf("set cookie domain from HTTP header: %s, devid: %s", domain, devid)
}

c.SetCookie("rtty-http-sid", sid, 0, "", domain, false, true)
Expand Down

0 comments on commit b449981

Please sign in to comment.