allow space-delimited application-provided user agent
This commit is contained in:
@ -62,7 +62,7 @@ var (
|
|||||||
"key1": "value1",
|
"key1": "value1",
|
||||||
"key2": "value2",
|
"key2": "value2",
|
||||||
}
|
}
|
||||||
testAppUA = "myApp/1.0"
|
testAppUA = "myApp1/1.0 myApp2/0.9"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testServer struct {
|
type testServer struct {
|
||||||
|
@ -164,13 +164,13 @@ func newHPACKDecoder() *hpackDecoder {
|
|||||||
default:
|
default:
|
||||||
if !isReservedHeader(f.Name) {
|
if !isReservedHeader(f.Name) {
|
||||||
if f.Name == "user-agent" {
|
if f.Name == "user-agent" {
|
||||||
str := strings.Split(f.Value, " ")
|
ind := strings.LastIndex(f.Value, " ")
|
||||||
if len(str) <= 1 {
|
if ind == -1 {
|
||||||
// There is no application user agent string being set.
|
// There is no application user agent string being set.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Extract the application user agent string.
|
// Extract the application user agent string.
|
||||||
f.Value = str[0]
|
f.Value = f.Value[:ind]
|
||||||
}
|
}
|
||||||
if d.state.mdata == nil {
|
if d.state.mdata == nil {
|
||||||
d.state.mdata = make(map[string]string)
|
d.state.mdata = make(map[string]string)
|
||||||
|
Reference in New Issue
Block a user