comparison main.c @ 635:43eee625021a

Fixes in proxy usage.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Jun 2014 06:19:45 +0300
parents ce605ac8167a
children 6273c4ea6e51
comparison
equal deleted inserted replaced
634:5269a8cdbd96 635:43eee625021a
2227 optProxyUserID = "James Bond"; 2227 optProxyUserID = "James Bond";
2228 2228
2229 if (th_conn_set_proxy(conn, optProxyType, optProxyPort, optProxyServer, optProxyAuthType) != THERR_OK || 2229 if (th_conn_set_proxy(conn, optProxyType, optProxyPort, optProxyServer, optProxyAuthType) != THERR_OK ||
2230 th_conn_set_proxy_auth_user(conn, optProxyUserID, optProxyPassword) != THERR_OK || 2230 th_conn_set_proxy_auth_user(conn, optProxyUserID, optProxyPassword) != THERR_OK ||
2231 th_conn_set_proxy_mode(conn, TH_PROXY_CMD_CONNECT) != THERR_OK || 2231 th_conn_set_proxy_mode(conn, TH_PROXY_CMD_CONNECT) != THERR_OK ||
2232 th_conn_set_proxy_addr_type(conn, optProxyAddrType)) 2232 th_conn_set_proxy_addr_type(conn, optProxyAddrType) != THERR_OK)
2233 { 2233 {
2234 errorMsg("Error setting proxy information.\n"); 2234 errorMsg("Error setting proxy information.\n");
2235 goto err_exit; 2235 goto err_exit;
2236 } 2236 }
2237 } 2237 }
2238
2239 // Okay, try to resolve the hostname
2240 conn->host = th_strdup(optServer);
2241 conn->hst = th_resolve_host(conn, optServer);
2242 if (conn->hst == NULL)
2243 goto err_exit;
2244 2238
2245 #ifdef FINAL_BUILD 2239 #ifdef FINAL_BUILD
2246 /* To emulate the official client, we first make a request for 2240 /* To emulate the official client, we first make a request for
2247 * policy file, even though we don't use it for anything... 2241 * policy file, even though we don't use it for anything...
2248 */ 2242 */
2249 if (th_conn_open(conn, 843, NULL) != 0) 2243 if (th_conn_open(conn, 843, optServer) != 0)
2250 { 2244 {
2251 errorMsg("Policy file request connection setup failed!\n"); 2245 errorMsg("Policy file request connection setup failed!\n");
2252 goto err_exit; 2246 goto err_exit;
2253 } 2247 }
2254 2248
2272 } 2266 }
2273 th_conn_free(conn); 2267 th_conn_free(conn);
2274 #endif 2268 #endif
2275 2269
2276 // Okay, now do the proper connection ... 2270 // Okay, now do the proper connection ...
2277 if (th_conn_open(conn, optPort, NULL) != 0) 2271 if (th_conn_open(conn, optPort, optServer) != 0)
2278 { 2272 {
2279 errorMsg("Main connection setup failed!\n"); 2273 errorMsg("Main connection setup failed!\n");
2280 goto err_exit; 2274 goto err_exit;
2281 } 2275 }
2282 2276