From b44998122cccd9a76c9e4157cc67ac321a231d76 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Thu, 16 Jan 2025 14:45:35 +0800 Subject: [PATCH] chore: add more debug log Signed-off-by: Jianhui Zhao --- http.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/http.go b/http.go index 4ef81c8..7c91b7a 100644 --- a/http.go +++ b/http.go @@ -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 == "" { @@ -361,6 +361,7 @@ 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) } } @@ -368,14 +369,16 @@ func httpProxyRedirect(br *broker, c *gin.Context) { 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)