Mapping between chrome cookie and netscape cookie used by curl/wget?

Viewed 126

https://developer.chrome.com/docs/extensions/reference/cookies/

chrome cookie is defined above. Namely, there are the following cookie fields.

  • domain
  • expirationDate
  • hostOnly
  • httpOnly
  • name
  • path
  • sameSite
  • secure
  • session
  • storeId
  • value

https://curl.se/docs/http-cookies.html

Here lists the netscape cookie fields.

  1. string example.com - the domain name
  2. boolean FALSE - include subdomains
  3. string /foobar/ - path
  4. boolean TRUE - send/receive over HTTPS only
  5. number 1462299217 - expires at - seconds since Jan 1st 1970, or 0
  6. string person - name of the cookie
  7. string daniel - value of the cookie

I want to know the mapping from the netscape cookie fields to the chrome cookie fields. Some are obvious.

  • 0 -> domain
  • 2 -> path
  • 4 -> expirationDate
  • 5 -> name
  • 6 -> value

But the rest 1 and 3 are not clear to me. Could anybody show me what they map to?

Also, why the other chrome cookie fields are not available in netscape cookie fields? Thanks.

1 Answers

You may want to read more about Netscape Cookies and The Unofficial Cookie FAQ.

  • Include subdomains

The domain that created AND that can read the variable.

That means if the cookie is set by www.example.com and the domain attribute is specified as example.com and this field is TRUE, the cookie will be sent to other.example.com too.

  • Secure

A TRUE/FALSE value indicating if a secure connection with the domain is needed to access the variable. SECURE specifies that the cookie is transmitted only if the communications channel with the host is a secure. Only HTTPS (HTTP over SSL) servers are currently secure. If SECURE is not specified, the cookie is considered sent over any channel.

That means SECURE must be TRUE for URLs with secure protocol (https), FALSE otherwise (e.g. http).

Could anybody show me what they map to?

0 - domain
1 - inverse of hostOnly
2 - path
3 - secure
4 - expirationDate
5 - name
6 - value

Why the other chrome cookie fields are not available in netscape cookie fields?

Well, history.

In June 1994 Louis J. "Lou" Montulli at Netscape Communications Corporation invented the HTTP cookie together with John Giannandrea, Montulli wrote the initial Netscape cookie specification the same year. Version 0.9beta of Mosaic Netscape, released on October 13, 1994, supported cookies. The first actual use of cookies (out of the labs) was made for checking whether visitors to the Netscape Web site had already visited the site.

Related