Unknown cookie field: SameSite

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
jrm
Reply | Threaded
Open this post in threaded view
|

Unknown cookie field: SameSite

jrm
This message is showing up in Transcript. It originates in #WebCookie readFrom: .
I tried to add sameSite to the method, but my naive attempt did not work. I also added getter and setter for the new cookie.

It originates from a device called HDHomeRun CONNECT on my local network which I access via HTTP.

There is some information available that describes it.

The incoming text appears to be '__cfduid=de417e50c7d97807e66b4a536a928eade1577808700; expires=Thu, 30-Jan-20 16:11:40 GMT; path=/; domain=.hdhomerun.com; HttpOnly; SameSite=Lax'

'From Squeak5.2 of 13 December 2018 [latest update: #18229] on 31 December 2019 at 9:18:36 am'!

!WebCookie methodsFor: 'initialize' stamp: 'jrm 12/31/2019 09:18'!
readFrom: aStream
"Read a cookie from the given stream"

| keyval key val |
aStream skipSeparators.
self halt.
name := (aStream upTo: $=) withBlanksTrimmed.
value := (aStream upTo: $;) withBlanksTrimmed.
[aStream atEnd] whileFalse:[
keyval := aStream upTo: $;.
key := (keyval copyUpTo: $=) withBlanksTrimmed.
val := (keyval copyAfter: $=) withBlanksTrimmed.
key asLowercase caseOf: {
['expires'] -> [self expiry: (self readExpiryFrom: val)].
['path'] -> [self path: (WebUtils unquote: val)].
['domain'] -> [self domain: (WebUtils unquote: val)].
['secure'] -> [self secure: true].
['version'] -> [self version: val].
['httponly'] -> [self httpOnly: true].
['comment'] ->[self comment: val].
['max-age'] ->[self expirySeconds: val asNumber].
['SameSite'] ->  [self sameSite: val].
} otherwise:[Transcript show: 'Unknown cookie field: ', key].
].! !


any suggestions?

--
John-Reed Maffeo


Reply | Threaded
Open this post in threaded view
|

Re: Unknown cookie field: SameSite

Levente Uzonyi


On Tue, 31 Dec 2019, John-Reed Maffeo wrote:

> This message is showing up in Transcript. It originates in #WebCookie readFrom: .
> I tried to add sameSite to the method, but my naive attempt did not work. I also added getter and setter for the new cookie.
>
> It originates from a device called HDHomeRun CONNECT on my local network which I access via HTTP.
>
> There is some information available that describes it.
>
> The incoming text appears to be '__cfduid=de417e50c7d97807e66b4a536a928eade1577808700; expires=Thu, 30-Jan-20 16:11:40 GMT; path=/; domain=.hdhomerun.com; HttpOnly; SameSite=Lax'
>
> 'From Squeak5.2 of 13 December 2018 [latest update: #18229] on 31 December 2019 at 9:18:36 am'!
>
> !WebCookie methodsFor: 'initialize' stamp: 'jrm 12/31/2019 09:18'!
> readFrom: aStream
> "Read a cookie from the given stream"
>
> | keyval key val |
> aStream skipSeparators.
> self halt.
> name := (aStream upTo: $=) withBlanksTrimmed.
> value := (aStream upTo: $;) withBlanksTrimmed.
> [aStream atEnd] whileFalse:[
> keyval := aStream upTo: $;.
> key := (keyval copyUpTo: $=) withBlanksTrimmed.
> val := (keyval copyAfter: $=) withBlanksTrimmed.
> key asLowercase caseOf: {
> ['expires'] -> [self expiry: (self readExpiryFrom: val)].
> ['path'] -> [self path: (WebUtils unquote: val)].
> ['domain'] -> [self domain: (WebUtils unquote: val)].
> ['secure'] -> [self secure: true].
> ['version'] -> [self version: val].
> ['httponly'] -> [self httpOnly: true].
> ['comment'] ->[self comment: val].
> ['max-age'] ->[self expirySeconds: val asNumber].
> ['SameSite'] ->  [self sameSite: val].
The above line must contain a lowercase string as the receiver of
#caseOf:otherwise: is a lowercase string.
So, the line should be:

['samesite'] -> [self sameSite: val].


Levente

> } otherwise:[Transcript show: 'Unknown cookie field: ', key].
> ].! !
>
>
> any suggestions?
>
> --
> John-Reed Maffeo
>
>

jrm
Reply | Threaded
Open this post in threaded view
|

Re: Unknown cookie field: SameSite

jrm
Levente,
Thank you for your guidance. I used lowercase for the value and the method . Testing has revealed no issues so I think my problem is resolved.
jrm

On Tue, Dec 31, 2019 at 10:51 AM Levente Uzonyi <[hidden email]> wrote:


On Tue, 31 Dec 2019, John-Reed Maffeo wrote:

> This message is showing up in Transcript. It originates in #WebCookie readFrom: .
> I tried to add sameSite to the method, but my naive attempt did not work. I also added getter and setter for the new cookie.
>
> It originates from a device called HDHomeRun CONNECT on my local network which I access via HTTP.
>
> There is some information available that describes it.
>
> The incoming text appears to be '__cfduid=de417e50c7d97807e66b4a536a928eade1577808700; expires=Thu, 30-Jan-20 16:11:40 GMT; path=/; domain=.hdhomerun.com; HttpOnly; SameSite=Lax'
>
> 'From Squeak5.2 of 13 December 2018 [latest update: #18229] on 31 December 2019 at 9:18:36 am'!
>
> !WebCookie methodsFor: 'initialize' stamp: 'jrm 12/31/2019 09:18'!
> readFrom: aStream
> "Read a cookie from the given stream"
>
> | keyval key val |
> aStream skipSeparators.
> self halt.
> name := (aStream upTo: $=) withBlanksTrimmed.
> value := (aStream upTo: $;) withBlanksTrimmed.
> [aStream atEnd] whileFalse:[
> keyval := aStream upTo: $;.
> key := (keyval copyUpTo: $=) withBlanksTrimmed.
> val := (keyval copyAfter: $=) withBlanksTrimmed.
> key asLowercase caseOf: {
> ['expires'] -> [self expiry: (self readExpiryFrom: val)].
> ['path'] -> [self path: (WebUtils unquote: val)].
> ['domain'] -> [self domain: (WebUtils unquote: val)].
> ['secure'] -> [self secure: true].
> ['version'] -> [self version: val].
> ['httponly'] -> [self httpOnly: true].
> ['comment'] ->[self comment: val].
> ['max-age'] ->[self expirySeconds: val asNumber].
> ['SameSite'] ->  [self sameSite: val].

The above line must contain a lowercase string as the receiver of
#caseOf:otherwise: is a lowercase string.
So, the line should be:

['samesite'] -> [self sameSite: val].


Levente

> } otherwise:[Transcript show: 'Unknown cookie field: ', key].
> ].! !
>
>
> any suggestions?
>
> --
> John-Reed Maffeo
>
>


--
John-Reed Maffeo