cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: help -- a problem with cookie

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Wed, 14 Apr 2010 02:48:31 -0400

On Wed, Apr 14, 2010 at 2:26 AM, Basil Su <hityourface_at_gmail.com> wrote:

> hi,
> i have two programs each running on a computer. program1 sends the http
> information like url, cookie and referrer to program2. program2 is a program
> using libcurl-7.19 on linux. now the problem is the program2 can not
> download the right file the url gives. it downloads a site which is a login
> website. so i guess the cookie and referrer is wrong. but it is very odd
> that if run the 2 programs on a same computer, and it can download right. so
> the cookie and referrer is right. the only difference is ip. when 2
> programs run on different computers, the ip is different, and it download a
> loging website. when the 2 progrmas run on a same computer, the ip is the
> same, and it've got right.
>
> i only useurl_easy_setopt(_curl, CURLOPT_COOKIE, _cookie.c_str()) to set
> cookie. is there anything else i should use?
>

It sounds like maybe the web server is loading the cookie with info about
the originating system. If so, it's probably a security measure designed to
prevent exactly what you're trying to do. The server doesn't know you own
both computers, it just sees that your second computer is apparently trying
to hijack the session started by your first computer.

Is there a good reason for not running both programs on the same computer??

I think you could probably get the right result if you set up your own proxy
and route all the requests through it. It wouldn't matter how many machines
were requesting pages, because the requests would all appear to originate at
the proxy system.

Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-14