cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Use same handle for multiple urls

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 3 Jun 2009 15:45:21 +0200 (CEST)

On Wed, 3 Jun 2009, centrio_at_gmail.com wrote:

> I have one doubt about multi interface. If I want to use same easy handle
> and same multi handle for different URLs then what is the way to reset all
> the data associated with the old URL and start the fresh transfer for new
> URL?

Normally you don't need to reset anything, you just set the new URL. Bur sure,
if you want to you can reset it.

> 1. Use curl_easy_reset that will get the handle back to its original state
> of easy_init()

Correct.

> 2. Remove the easy handle from multi handle and set new url and add back the
> handle. This will start the new transfer.

Correct.

> Please let me know if my understanding of method 2 is correct.

Uh, even in method 1 you need to remove and re-add the easy handle and you
need to set the new URL. They're in fact not two different methods, it's just
that you can call curl_easy_reset() on the handle or you can skip it, it's up
to you.

> Also I would like to know the drawbacks/side effects of using method 2. I
> dont want to set same option on the easy handle for each URL. It will be
> redundant.

Then don't!

-- 
  / daniel.haxx.se
Received on 2009-06-03