Discussion:
Cookies from curl cmd not matching cookies from browser
bruce
2018-07-14 18:30:11 UTC
Permalink
Hi.

Trying to understand why I'm getting what appears to be different
values (for request cookies) from the browser (FF) and the cmdline
curl (centos).

I'm using the url
https://smccis.smc.edu/smcweb/f?p=118:1:1099677479717

In the browser, I examine the firebug network/cookies data and I get:
-ORA_WWV_APP_118:"ORA_WWV-jMu08G5jY_5pTpZnTfWHF7RX"
-ORA_WWV_USER_61917392119870:"ORA_WWV-IAmUD0LPRXrHnrE6LuZj7pJM"
-_ga:"GA1.2.1168176653.1531572004"
-_gid:"GA1.2.232116952.1531572004"


I then copy the "cURL" cmd from the firebug dialog, which results in:
curl 'https://smccis.smc.edu/smcweb/f?p=118:1:1099677479717' -H 'Host:
smccis.smc.edu' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:52.0) Gecko/20100101 Firefox/52.0' -H 'Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H
'Accept-Language: en-US,en;q=0.5' --compressed -H 'Cookie:
ORA_WWV_APP_118=ORA_WWV-jMu08G5jY_5pTpZnTfWHF7RX;
ORA_WWV_USER_61917392119870=ORA_WWV-IAmUD0LPRXrHnrE6LuZj7pJM;
_ga=GA1.2.1168176653.1531572004; _gid=GA1.2.232116952.1531572004' -H
'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1'

Running this curl cmd from the cmdline the resulting content is the
same as the browser source code.



However, when I change the curl cmd to use cookie/cookie-jar, I don't
get the same cookies!!!

curl -L 'https://smccis.smc.edu/smcweb/f?p=118:1:1099677479717' -H
'Host: smccis.smc.edu' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:52.0) Gecko/20100101 Firefox/52.0' -H 'Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H
'Accept-Language: en-US,en;q=0.5' --compressed --cookie-jar a.lwp
--cookie a.lwp -H 'Connection: keep-alive' -H
'Upgrade-Insecure-Requests: 1'

Given that this is the 1st url of the site, I would expect to get the
exact same request cookies.


So I'm trying to understand what's going on, and how I can generate
"both" cookies using the cmdline curl to have the same response
cookies as the browser.

My reason for trying to get the cookies in the external cookie file -
to be able to pass/use the cookies in subsequent "curl" cmds from the
cmdline.

thoughts/comments???

thanks!
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:
Jeremy Nicoll
2018-07-16 11:00:32 UTC
Permalink
Post by bruce
smccis.smc.edu' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64;
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H
ORA_WWV_APP_118=ORA_WWV-jMu08G5jY_5pTpZnTfWHF7RX;
ORA_WWV_USER_61917392119870=ORA_WWV-IAmUD0LPRXrHnrE6LuZj7pJM;
_ga=GA1.2.1168176653.1531572004; _gid=GA1.2.232116952.1531572004' -H
'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1'
So that supplies cookie data within the command line... but doesn't save
revised/new cookies anywhere...
Post by bruce
curl -L 'https://smccis.smc.edu/smcweb/f?p=118:1:1099677479717' -H
'Host: smccis.smc.edu' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64;
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H
'Accept-Language: en-US,en;q=0.5' --compressed --cookie-jar a.lwp
--cookie a.lwp -H 'Connection: keep-alive' -H
'Upgrade-Insecure-Requests: 1'
reads cookies from a file then writes revised/new ones to that
same file.

On the rare occasions I've experimented with something like this I
always used different files for supplying cookies to a curl command
and collected the resulting cookies, so I could rerun any particular
stage (of a series of curl commands) with the right input cookies. I
don't know if your use of the same file might have confused things.
--
Jeremy Nicoll - my opinions are my own.
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: ht
Loading...