mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 01:08:47 +02:00
fix(cookie): net/http: invalid Cookie.Domain .0.0.1:3000
This commit is contained in:
@@ -59,6 +59,17 @@ func cookieDomain(r *http.Request) string {
|
|||||||
return ".local"
|
return ".local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the host is an IP address, return an empty string
|
||||||
|
{
|
||||||
|
host, _, err := net.SplitHostPort(reqHost)
|
||||||
|
if err != nil {
|
||||||
|
host = reqHost
|
||||||
|
}
|
||||||
|
if net.ParseIP(host) != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parts := strutils.SplitRune(reqHost, '.')
|
parts := strutils.SplitRune(reqHost, '.')
|
||||||
if len(parts) < 2 {
|
if len(parts) < 2 {
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user