138
)
139
if userAgent, ok := header[headerUserAgent]; ok {
140
>
// Use SplitN for efficiency but enforce exactly one delimiter to preserve the
nexus_handler.go
141
>
// original (pre-SplitN) strictness where additional delimiters cause us to ignore
142
>
// the header instead of coalescing trailing data into the version string.
143
>
if strings.Count(userAgent, clientNameVersionDelim) == 1 { // exact single occurrence
144
>
parts := strings.SplitN(userAgent, clientNameVersionDelim, 2)
145
>
if len(parts) == 2 { // always true given Count==1, kept for defensive clarity
146
>
mdIncoming, ok := metadata.FromIncomingContext(ctx)
147
>
if !ok {
148
mdIncoming = metadata.MD{}
149
}
151
>
mdIncoming.Set(headers.ClientVersionHeaderName, parts[1])
152
>
ctx = metadata.NewIncomingContext(ctx, mdIncoming)
153
}
154
}