changeset 635:43eee625021a

Fixes in proxy usage.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Jun 2014 06:19:45 +0300
parents 5269a8cdbd96
children 6273c4ea6e51
files main.c
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Sun Jun 22 03:32:39 2014 +0300
+++ b/main.c	Sun Jun 22 06:19:45 2014 +0300
@@ -2229,24 +2229,18 @@
         if (th_conn_set_proxy(conn, optProxyType, optProxyPort, optProxyServer, optProxyAuthType) != THERR_OK ||
             th_conn_set_proxy_auth_user(conn, optProxyUserID, optProxyPassword) != THERR_OK ||
             th_conn_set_proxy_mode(conn, TH_PROXY_CMD_CONNECT) != THERR_OK ||
-            th_conn_set_proxy_addr_type(conn, optProxyAddrType))
+            th_conn_set_proxy_addr_type(conn, optProxyAddrType) != THERR_OK)
         {
             errorMsg("Error setting proxy information.\n");
             goto err_exit;
         }
     }
 
-    // Okay, try to resolve the hostname
-    conn->host = th_strdup(optServer);
-    conn->hst = th_resolve_host(conn, optServer);
-    if (conn->hst == NULL)
-        goto err_exit;
-
 #ifdef FINAL_BUILD
     /* To emulate the official client, we first make a request for
      * policy file, even though we don't use it for anything...
      */
-    if (th_conn_open(conn, 843, NULL) != 0)
+    if (th_conn_open(conn, 843, optServer) != 0)
     {
         errorMsg("Policy file request connection setup failed!\n");
         goto err_exit;
@@ -2274,7 +2268,7 @@
 #endif
 
     // Okay, now do the proper connection ...
-    if (th_conn_open(conn, optPort, NULL) != 0)
+    if (th_conn_open(conn, optPort, optServer) != 0)
     {
         errorMsg("Main connection setup failed!\n");
         goto err_exit;