curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Bug: CURLINFO_PRIMARY_IP is empty

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 2 May 2017 14:11:24 +0200 (CEST)

On Tue, 2 May 2017, D M via curl-library wrote:

> If request wasn't successful CURLINFO_PRIMARY_IP is empty in new versions of
> curl (in versions of curl several years ago it wasn't empty).

> Why new versions of curl have empty value in CURLINFO_PRIMARY_IP if request
> wasn't successful?

Because it stores that info only after a successful connect. I think because
it also extracts and stores information about port numbers from the connection
and they are of course absent if the connection failed.

In general we focus on making sure we return proper info for successful
transfers.

> Is it a bug?

I don't think it is. The exact wording in the documentation for
CURLINFO_PRIMARY_IP is:

   receive the pointer to a zero-terminated string holding the IP address of
   the most recent connection done with this curl handle

So if there was no connection made, there's not necessarily any information
given - but it would also be complicated to document when it provides the
information if it also would do it for *some* errors.

I wouldn't be totally against allowing it to return the information for this
sort of timeouts.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-05-02