cURL / Mailing Lists / curl-library / Single Mail

curl-library

host.name vs. host.dispname

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Wed, 06 Jun 2012 18:49:04 +0200

When running "curl --trace-ascii -", I see lots of such lines:

  == Info: Re-using existing connection! (#0) with host (nil)
  == Info: Connected to (nil) (194.103.154.240) port 443 (#0)

I mean, the "(nil)" looks ugly. So to give a nicer trace, when 'host.name' is
known, why not use that instead when 'host.dispname' is NULL?

What is the purpose of setting 'host.dispname' to NULL anyway? An
oversight? AFAICS there are 3 places that needs patching. In url.c at
Curl_verboseconnect() and the parts that says:
  infof(data, "Re-using existing connection! ...
  infof(data, "Connection #%ld to host %s left intact\n",

More places? Here is my suggestion:

--- ..\Git-latest\lib\url.c Tue Apr 24 09:42:46 2012
+++ url.c Wed Jun 06 18:46:13 2012
@@ -3328,7 +3328,8 @@
 {
   if(conn->data->set.verbose)
     infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n",
- conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname,
+ conn->bits.proxy ? conn->proxy.dispname :
+ conn->host.dispname ? conn->host.dispname : conn->host.name,
           conn->ip_addr_str, conn->port, conn->connectindex);
 }
 #endif
@@ -5137,7 +5138,8 @@
     *in_connect = conn;
     infof(data, "Re-using existing connection! (#%ld) with host %s\n",
           conn->connectindex,
- conn->proxy.name?conn->proxy.dispname:conn->host.dispname);
+ conn->proxy.name ? conn->proxy.dispname :
+ conn->host.dispname ? conn->host.dispname : conn->host.name);
   }
   else {
     /*
@@ -5421,7 +5423,8 @@

     infof(data, "Connection #%ld to host %s left intact\n",
           conn->connectindex,
- conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
+ conn->bits.httpproxy ? conn->proxy.dispname :
+ conn->host.dispname ? conn->host.dispname : conn->host.name);
   }

   *connp = NULL; /* to make the caller of this function better detect that

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-06