Skip to content

Commit 23ab1bf

Browse files
nithinputhenveettilmaciej-kisiel
authored andcommitted
jsonrpc2: fix Content-Length header parsing to be case-insensitive
1 parent 67bd3f2 commit 23ab1bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/jsonrpc2/frame.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ func (r *headerReader) Read(ctx context.Context) (Message, error) {
163163
return nil, fmt.Errorf("invalid header line %q", line)
164164
}
165165
name, value := line[:colon], strings.TrimSpace(line[colon+1:])
166-
switch name {
167-
case "Content-Length":
166+
switch {
167+
case strings.EqualFold(name, "Content-Length"):
168168
if contentLength, err = strconv.ParseInt(value, 10, 32); err != nil {
169169
return nil, fmt.Errorf("failed parsing Content-Length: %v", value)
170170
}

0 commit comments

Comments
 (0)