]> 127.0.0.1 Git - front/.git/commitdiff
1 v0.1.20241122063658
authorqydysky <qydysky@foxmail.com>
Fri, 22 Nov 2024 06:34:48 +0000 (06:34 +0000)
committerGitHub <noreply@github.com>
Fri, 22 Nov 2024 06:34:48 +0000 (06:34 +0000)
config.go
http.go
ws.go

index aa29ced88c3a95d9caa23a52d0e548deea599428..1b91887a26582bdbd4c530b48a472e2a3aab7682 100755 (executable)
--- a/config.go
+++ b/config.go
@@ -439,8 +439,11 @@ func (t *Back) SwapSign(logger Logger) {
        t.AlwaysUp = len(t.route.Backs) == 1 || t.AlwaysUp
 }
 
-func (t *Back) Splicing() int {
-       return t.route.Splicing
+func (t *Back) getSplicing() int {
+       if t.Splicing == 0 {
+               return t.route.Splicing
+       }
+       return t.Splicing
 }
 func (t *Back) PathAdd() bool {
        return t.route.PathAdd
diff --git a/http.go b/http.go
index b3b880803efffa53af0f1efdb17a814404f4fa9d..dcbca5ea79e52ffdea0924908190ea929a02fea7 100644 (file)
--- a/http.go
+++ b/http.go
@@ -123,11 +123,11 @@ func (httpDealer) Deal(ctx context.Context, w http.ResponseWriter, r *http.Reque
                defer chosenBack.ed()
        }
 
-       if chosenBack.Splicing() != 0 {
+       if chosenBack.getSplicing() != 0 {
                cookie := &http.Cookie{
                        Name:   "_psign_" + cookie,
                        Value:  chosenBack.Id(),
-                       MaxAge: chosenBack.Splicing(),
+                       MaxAge: chosenBack.getSplicing(),
                        Path:   "/",
                }
                if utils.ValidCookieDomain(r.Host) {
diff --git a/ws.go b/ws.go
index 2ddebcd294c0f5fed00b1a4ea090b2fbb82c7586..388019265915d8e731e7f683c320bc8a35c4646a 100644 (file)
--- a/ws.go
+++ b/ws.go
@@ -105,11 +105,11 @@ func (wsDealer) Deal(ctx context.Context, w http.ResponseWriter, r *http.Request
                defer chosenBack.ed()
        }
 
-       if chosenBack.Splicing() != 0 {
+       if chosenBack.getSplicing() != 0 {
                cookie := &http.Cookie{
                        Name:   "_psign_" + cookie,
                        Value:  chosenBack.Id(),
-                       MaxAge: chosenBack.Splicing(),
+                       MaxAge: chosenBack.getSplicing(),
                        Path:   "/",
                }
                if utils.ValidCookieDomain(r.Host) {