cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_SCOPE

From: Phil Blundell <pb_at_reciva.com>
Date: Mon, 11 Aug 2008 08:51:06 +0100

On Mon, 2008-08-11 at 11:41 +0530, Pramod Sharma wrote:
> Daniel ,
> I have two question regarding this CURLOPT_SCOPE/CURLOPT_ADDRESS_SCOPE.
> 1. Why it have to be only long ? Can't user give interface name and we
> change it internally to id , like eth0 can be changed to index id by
> some system api's or I am missing something here ?

(I'm not Daniel, but...)

A long is what's needed for the IPv6 socket APIs. If you have an
interface name and want to convert it to an integer then, as you say,
there are system APIs to do that. Using names for the libcurl API would
mean that curl always needed to perform this (fairly slow) conversion
internally; worse, any callers who think in terms of integers would need
to convert their ints to strings for libcurl, only to have it convert
them right back again.

In particular, the specific use-case that CURLOPT_SCOPE is intended to
support is where you previously received a message (e.g. a SUBSCRIBE
request) from some other host and you now want to make a new outgoing
connection to the originator of that initial message to deliver the
corresponding NOTIFY. In this situation the value you want to pass as
CURLOPT_SCOPE is what you retrieved from the ip6_pktinfo structure on
the original request, and this is a numeric value not a string.

> 2. What about the proxy address scope id ? We have to give it in url
> itself as there is no separate setopt for that ?

Right. There didn't seem any benefit in having a separate setopt for
the proxy address. I guess you are welcome to make the argument for
having one if you think it is important.

p.
Received on 2008-08-11