]> Cypherpunks repositories - gostls13.git/commit
net/http: trim cookie names
authordarmiel <71837281+darmiel@users.noreply.github.com>
Wed, 4 May 2022 12:39:49 +0000 (12:39 +0000)
committerDamien Neil <dneil@google.com>
Fri, 12 Aug 2022 16:22:39 +0000 (16:22 +0000)
commit2cf49a76b674ee5075f3ed6ff857c5b3e7a8109a
tree875cc8431a473556f6b1abe5ab1429aeb2ebffcc
parent57c1edcaec010874ed4a8491ca4ba3a2dda77339
net/http: trim cookie names

The current implementation ignores cookies where the
cookie name starts or ends with a space. For example,

name =value

is ignored.

I have come across pages that send cookies in this weird format.
I tested with the latest versions of Firefox, Safari and Chrome,
all of which accept cookies in this format.

To do this, I remove leading and trailing spaces from the
cookie name after cutting at '='.

Change-Id: I8fd0c37a2113b6ce75712dd43607d1ea55e86c68
GitHub-Last-Rev: 368f50fcb4c7537b90249c3c497e61dc81038f6e
GitHub-Pull-Request: golang/go#52121
Reviewed-on: https://go-review.googlesource.com/c/go/+/397734
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
src/net/http/cookie.go
src/net/http/cookie_test.go