mirror of
https://github.com/gin-gonic/gin.git
synced 2026-07-12 05:51:12 +08:00
Compare commits
3 Commits
003bcb05b1
...
a31d256631
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a31d256631 | ||
|
|
e88fc8927a | ||
|
|
7303932ab2 |
5
.github/workflows/trivy-scan.yml
vendored
5
.github/workflows/trivy-scan.yml
vendored
@ -8,9 +8,8 @@ on:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
# Run every 3 months (quarterly) on the 1st day at 00:00 UTC
|
||||
# Months: January (1), April (4), July (7), October (10)
|
||||
- cron: '0 0 1 1,4,7,10 *'
|
||||
# Run daily at 00:00 UTC
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
permissions:
|
||||
|
||||
3
gin.go
3
gin.go
@ -9,6 +9,7 @@ import (
|
||||
"html/template"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@ -483,7 +484,7 @@ func (engine *Engine) validateHeader(header string) (clientIP string, valid bool
|
||||
}
|
||||
items := strings.Split(header, ",")
|
||||
for i := len(items) - 1; i >= 0; i-- {
|
||||
ipStr := strings.TrimSpace(items[i])
|
||||
ipStr := textproto.TrimString(items[i])
|
||||
ip := net.ParseIP(ipStr)
|
||||
if ip == nil {
|
||||
break
|
||||
|
||||
3
utils.go
3
utils.go
@ -7,6 +7,7 @@ package gin
|
||||
import (
|
||||
"encoding/xml"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
@ -107,7 +108,7 @@ func parseAccept(acceptHeader string) []string {
|
||||
if i := strings.IndexByte(part, ';'); i > 0 {
|
||||
part = part[:i]
|
||||
}
|
||||
if part = strings.TrimSpace(part); part != "" {
|
||||
if part = textproto.TrimString(part); part != "" {
|
||||
out = append(out, part)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user