mirror of
https://github.com/mpolden/echoip.git
synced 2025-07-17 14:33:30 +02:00
Handle more invalid user agents
This commit is contained in:
@ -15,7 +15,7 @@ func Parse(s string) UserAgent {
|
||||
var version, comment string
|
||||
if len(parts) > 1 {
|
||||
// If first character is a number, treat it as version
|
||||
if parts[1][0] >= 48 && parts[1][0] <= 57 {
|
||||
if len(parts[1]) > 0 && parts[1][0] >= 48 && parts[1][0] <= 57 {
|
||||
rest := strings.SplitN(parts[1], " ", 2)
|
||||
version = rest[0]
|
||||
if len(rest) > 1 {
|
||||
|
Reference in New Issue
Block a user