When re-using a connection, make sure that we use the current host name as
we might actually re-use a connection to a different host, when using proxies!
This was what bug report #558888 was all about.
diff --git a/lib/url.c b/lib/url.c
index 8ea4b7c..62e727e 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2129,6 +2129,10 @@
free(old_conn->proxyhost);
conn = conn_temp; /* use this connection from now on */
+ /* If we speak over a proxy, we need to copy the host name too, as it
+ might be another remote host even when re-using a connection */
+ strcpy(conn->gname, old_conn->gname); /* safe strcpy() */
+
/* we need these pointers if we speak over a proxy */
conn->hostname = conn->gname;
conn->name = &conn->gname[old_conn->name - old_conn->gname];