jsonrpc2: fix Content-Length header parsing to be case-insensitive
This commit is contained in:
parent
67bd3f2e2b
commit
23ab1bfd26
1 changed files with 2 additions and 2 deletions
|
|
@ -163,8 +163,8 @@ func (r *headerReader) Read(ctx context.Context) (Message, error) {
|
||||||
return nil, fmt.Errorf("invalid header line %q", line)
|
return nil, fmt.Errorf("invalid header line %q", line)
|
||||||
}
|
}
|
||||||
name, value := line[:colon], strings.TrimSpace(line[colon+1:])
|
name, value := line[:colon], strings.TrimSpace(line[colon+1:])
|
||||||
switch name {
|
switch {
|
||||||
case "Content-Length":
|
case strings.EqualFold(name, "Content-Length"):
|
||||||
if contentLength, err = strconv.ParseInt(value, 10, 32); err != nil {
|
if contentLength, err = strconv.ParseInt(value, 10, 32); err != nil {
|
||||||
return nil, fmt.Errorf("failed parsing Content-Length: %v", value)
|
return nil, fmt.Errorf("failed parsing Content-Length: %v", value)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue