cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Behavior of -D and -c options in curl

From: imran shaik <sk.imran_at_yahoo.com>
Date: Tue, 16 Jan 2007 07:20:17 -0800 (PST)

  Hm, am I correct in assuming that all you are trying to achieve is to
  see what cookie data is being written, and then what is being returned
  to the server, as per my suggestion a few days ago? Or is this a new
  problem?
  
  
  yeah man, its the same thing. On your suggestion, I was able to find that out using -trace-ascii option.
  It shows that in the older version of curl cookies were properly sent without using any -b option. I was using -D to get session cookies. The site actually redirects twice and sets few more cookies. During every redirection it still needs the session cookie.
  
  In older versions (7.9.8 on Solaris 8, SPARC machine)of curl i see i use only -D to dump headers , and proper session cookies were being sent. But in the newer version(7.14) the same command fails. From the trace I was able to find out that the session cookie was not being sent to the server. Once I added the -b option it worked fine. Else it worked fine with -c option on both the machines.
  
  The original problem was cookies being set to a 1970 expiry date and
  NULL value on one machine -- is this still the problem at hand? Since,
  while I don't use cURL, I find it rather confusing why something as
  simple as looking at what cookies were saved, and what cookies were
  returned to the server, is so complicated?
  
  I can understand that the cookie was being deleted coz proper session cookies are not sent as I mentioned above.
  
  If that is all you're trying to do, I can boot up my iMac and see how to
  do it on that (since cURL ships with OS X).
  
  Thanks Daniel, Earlier I got confused between two Daniels in the group. Even when you mentioned the other daniel, i thought of daniel from the bible. Not the one in the group. Sorry, Now I got.
  
  I got the solution to make both my machines(Sparc and Intel) work. But I still want to find out whetehr it was the version that caused the problem or was I wrong. Thats why I was posing questions to you guys.
  
  What I say is:
  
  Earlier cookie parsing was by default.
  Now its explicit.
  
  How correct I am? If not what could have been the problem.
    
  Otherwise, I am really lost as to what the problem is and what you are
    trying to achieve.

  
  
imran shaik <sk.imran_at_yahoo.com> wrote: Are you referring to the need to use -b (or -c) to activate cookie parsing on
  incoming headers? That was always the case and curl has never parsed cookies
  without you telling it to.
  -----yes,
   
  A small modification to my question:
  Does -D dumps cookies for each URL or at the end of handling all the URLs?
  What is the behavior of -c when writing cookies?
  
  curl -L -c "hello" http://foo.bar.com
  
  Suppose the above command follows 3 URLs seeing Location in header.
  
  I need a timeline status of the contents of "hello" file after each URL is followed.
  Are the cookies written as the URL is followed , or they are put to the cookie keeper and written at the end.
  
  Similarly the timeline status of the contents "hello" file after the above command with a -D. Here I am interested in cookies only, not headers.
  
  curl -L -D "hello" http://foo.bar.com
  
  
  thanks,
  Imran

Daniel Stenberg <daniel_at_haxx.se> wrote: On Tue, 16 Jan 2007, imran shaik wrote:

> I see that the older versions(7.9.8 the oldest one I have) of curl read from
> the headers file without -b .

Uhm, I think I don't understand. curl has never read from any headers file
without you telling it to.

> But the newer versions(7.14) do require -b. I observed this in case of 2 or
> 3 redirects.

Are you referring to the need to use -b (or -c) to activate cookie parsing on
incoming headers? That was always the case and curl has never parsed cookies
without you telling it to.

> Am I correct ?

Not if I understand you correctly.

> Can I know what is the additional information stored with -c?

Read the output file, it is in netscape/mozilla/firefox cookie jar format. It
contains for example host/domain and more that the headers do not
(necessarily) contain.

> Is only the additional information that makes -c more preferable than -D

"only" ? -c makes a perfect cookie jar of all existing known cookies
(including those that was read previously with -b), while -D is a "mere"
header dump. That's quite some difference. If managing cookies is your game,
then -c is a must and -D for the laymen. ;-)

> Also, in case of -L does -c forces all the cookies to be written at the end
> of all redirects?

No.

> Does -D dumps for each URL or at the end of handling all the URLs?

-D dumps all headers as they come in. If -L follows 488 redirects, you will
get 488 set of headers dumped to the file.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
     
---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
 	
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.
Received on 2007-01-16