Skip to content

armgit / hey

Public Imported from GitHub
0

HTTP load generator, ApacheBench (ab) replacement

Go

fix auth RE to allow meta characters

Garrett Squireebe6ef6f479d
diff --git a/boom.go b/boom.go
index 6601f76..4ab339a 100644
--- a/boom.go
+++ b/boom.go
@@ -28,8 +28,8 @@ import (
)
const (
- headerRegexp = "^([\\w-]+):\\s*(.+)"
- authRegexp = "^([\\w-\\.]+):(.+)"
+ headerRegexp = `^([\w-]+):\s*(.+)`
+ authRegexp = `^(.+):([^\s].+)`
)
var (
diff --git a/boom_test.go b/boom_test.go
index d025e05..3c101c7 100644
--- a/boom_test.go
+++ b/boom_test.go
@@ -51,3 +51,10 @@ func TestParseInvalidAuthFlag(t *testing.T) {
t.Errorf("An invalid header passed parsing")
}
}
+
+func TestParseAuthMetaCharacters(t *testing.T) {
+ _, err := parseInputWithRegexp("plus+$*{:boom", authRegexp)
+ if err != nil {
+ t.Errorf("Could not parse an auth header with a plus sign in the user name")
+ }
+}