Commit 4b9f8e76 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Made host name and proxy name get stored in a 'struct hostname' and set

all things up to work with encoded host names internally, as well as keeping
'display names' to show in debug messages. IDN resolves work for me now using
ipv6, ipv4 and ares resolving. Even cookies on IDN sites seem to do right.
parent 96002646
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -479,7 +479,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
  else if(1 != rc) {
    int error = Curl_ourerrno();
    failf(data, "Failed connect to %s:%d; %s",
          conn->hostname, conn->port, Curl_strerror(conn,error));
          conn->host.name, conn->port, Curl_strerror(conn,error));
    return CURLE_COULDNT_CONNECT;
  }
  /*
@@ -576,7 +576,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
    }
  }

  hostname = data->change.proxy?conn->proxyhost:conn->hostname;
  hostname = data->change.proxy?conn->proxy.name:conn->host.name;
  infof(data, "About to connect() to %s port %d\n",
        hostname, port);

+3 −3
Original line number Diff line number Diff line
@@ -489,7 +489,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
  if (data->set.tunnel_thru_httpproxy) {
    /* We want "seamless" FTP operations through HTTP proxy tunnel */
    result = Curl_ConnectHTTPProxyTunnel(conn, FIRSTSOCKET,
                                         conn->hostname, conn->remote_port);
                                         conn->host.name, conn->remote_port);
    if(CURLE_OK != result)
      return result;
  }
@@ -1619,7 +1619,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
          newport = num;

          /* we should use the same host we already are connected to */
          newhostp = conn->hostname;
          newhostp = conn->host.name;
        }
      }                      
      else
@@ -1641,7 +1641,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
     * We don't want to rely on a former host lookup that might've expired
     * now, instead we remake the lookup here and now!
     */
    rc = Curl_resolv(conn, conn->proxyhost, conn->port, &addr);
    rc = Curl_resolv(conn, conn->proxy.name, conn->port, &addr);
    if(rc == CURLRESOLV_PENDING)
      rc = Curl_wait_for_resolv(conn, &addr);

+2 −2
Original line number Diff line number Diff line
@@ -233,11 +233,11 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
  if(!conn->async.dns) {
    /* a name was not resolved */
    if((timeout < 0) || (conn->async.status == ARES_ETIMEOUT)) {
      failf(data, "Resolving host timed out: %s", conn->hostname);
      failf(data, "Resolving host timed out: %s", conn->host.name);
      rc = CURLE_OPERATION_TIMEDOUT;
    }
    else if(conn->async.done) {
      failf(data, "Could not resolve host: %s (%s)", conn->hostname,
      failf(data, "Could not resolve host: %s (%s)", conn->host.name,
            ares_strerror(conn->async.status));
      rc = CURLE_COULDNT_RESOLVE_HOST;
    }
+2 −2
Original line number Diff line number Diff line
@@ -375,12 +375,12 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
  if (!conn->async.dns) {
    /* a name was not resolved */
    if (td->thread_status == (DWORD)-1 || conn->async.status == NO_DATA) {
      failf(data, "Resolving host timed out: %s", conn->hostname);
      failf(data, "Resolving host timed out: %s", conn->host.name);
      rc = CURLE_OPERATION_TIMEDOUT;
    }
    else if(conn->async.done) {
      failf(data, "Could not resolve host: %s; %s",
            conn->hostname, Curl_strerror(conn,conn->async.status));
            conn->host.name, Curl_strerror(conn,conn->async.status));
      rc = CURLE_COULDNT_RESOLVE_HOST;
    }
    else
+5 −4
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ static CURLcode http_auth_headers(struct connectdata *conn,
     host due to a location-follow, we do some weirdo checks here */
  if(!data->state.this_is_a_follow ||
     !data->state.auth_host ||
     curl_strequal(data->state.auth_host, TRUE_HOSTNAME(conn)) ||
     curl_strequal(data->state.auth_host, conn->host.name) ||
     data->set.http_disable_hostname_check_before_authentication) {

  /* Send proxy authentication header if needed */
@@ -1113,7 +1113,8 @@ CURLcode Curl_http_connect(struct connectdata *conn)

    /* either HTTPS over proxy, OR explicitly asked for a tunnel */
    result = Curl_ConnectHTTPProxyTunnel(conn, FIRSTSOCKET,
                                         TRUE_HOSTNAME(conn), conn->remote_port);
                                         conn->host.name,
                                         conn->remote_port);
    if(CURLE_OK != result)
      return result;
  }    
@@ -1132,7 +1133,7 @@ CURLcode Curl_http_connect(struct connectdata *conn)
      /* Free to avoid leaking memory on multiple requests*/
      free(data->state.auth_host);

    data->state.auth_host = strdup(TRUE_HOSTNAME(conn));
    data->state.auth_host = strdup(conn->host.name);
  }

  return CURLE_OK;
@@ -1219,7 +1220,7 @@ CURLcode Curl_http(struct connectdata *conn)
  struct HTTP *http;
  struct Cookie *co=NULL; /* no cookies from start */
  char *ppath = conn->path;
  char *host = TRUE_HOSTNAME(conn);
  char *host = conn->host.name;
  const char *te = ""; /* tranfer-encoding */
  char *ptr;
  char *request;
Loading