fix connection with axis servers

This commit is contained in:
aler9
2020-06-15 10:57:23 +02:00
parent 1173d41d78
commit 202b8a27fc
2 changed files with 14 additions and 0 deletions

View File

@@ -24,6 +24,9 @@ func ReadHeaderSession(in string) (*HeaderSession, error) {
hs.Session, parts = parts[0], parts[1:]
for _, part := range parts {
// remove leading spaces
part = strings.TrimLeft(part, " ")
keyval := strings.Split(part, "=")
if len(keyval) != 2 {
return nil, fmt.Errorf("invalid value")

View File

@@ -29,6 +29,17 @@ var casesHeaderSession = []struct {
}(),
},
},
{
"with timeout and space",
`A3eqwsafq3rFASqew; timeout=47`,
&HeaderSession{
Session: "A3eqwsafq3rFASqew",
Timeout: func() *uint {
v := uint(47)
return &v
}(),
},
},
}
func TestHeaderSession(t *testing.T) {