Hi,

I have a cookie file. I'd like to override an entity in it or specific
an extra cookie entry with -H.

But it seems that wget just ignore what is in the cookie file if -H
"cookie: xxx" is specified. Is there a way to override entries in the
cookie file? Thanks.


$ wget --load-cookies cookie.txt --keep-session-cookies --save-cookies
cookie.txt -qO- -o /dev/null 'http://httpbin.org/cookies/set?A=1'
{
  "cookies": {
    "A": "1"
  }
}
$ cat cookie.txt
# HTTP cookie file.
# Generated by Wget on 2020-02-15 11:44:52.
# Edit at your own risk.

httpbin.org     FALSE   /       FALSE   0       A       1
$ wget --load-cookies cookie.txt --keep-session-cookies --save-cookies
cookie.txt -qO- -o /dev/null http://httpbin.org/cookies
{
  "cookies": {
    "A": "1"
  }
}
$ cat cookie.txt
# HTTP cookie file.
# Generated by Wget on 2020-02-15 11:44:53.
# Edit at your own risk.

httpbin.org     FALSE   /       FALSE   0       A       1
$ wget --header 'cookie: B=2' --load-cookies cookie.txt
--keep-session-cookies --save-cookies cookie.txt -qO- -o /dev/null
http://httpbin.org/cookies
{
  "cookies": {
    "B": "2"
  }
}
$ cat cookie.txt
# HTTP cookie file.
# Generated by Wget on 2020-02-15 11:44:53.
# Edit at your own risk.

httpbin.org     FALSE   /       FALSE   0       A       1
$ rm cookie.txt


-- 
Regards,
Peng

Reply via email to