Changeset 5756890
- Timestamp:
- 2015-10-25T22:37:56Z (9 years ago)
- Branches:
- master
- Children:
- f710673
- Parents:
- e4c3041
- git-author:
- dequis <dx@…> (24-10-15 20:45:07)
- git-committer:
- dequis <dx@…> (25-10-15 22:37:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/proxy.c
re4c3041 r5756890 61 61 }; 62 62 63 typedef int (*proxy_connect_func)(const char *host, unsigned short port_, struct PHB *phb); 64 63 65 static int proxy_connect_none(const char *host, unsigned short port_, struct PHB *phb); 64 66 … … 502 504 } 503 505 506 static const proxy_connect_func proxy_connect_funcs_array[] = { 507 proxy_connect_none, /* PROXY_NONE */ 508 proxy_connect_http, /* PROXY_HTTP */ 509 proxy_connect_socks4, /* PROXY_SOCKS4 */ 510 proxy_connect_socks5, /* PROXY_SOCKS5 */ 511 proxy_connect_socks4, /* PROXY_SOCKS4A */ 512 }; 504 513 505 514 /* Export functions */ … … 508 517 { 509 518 struct PHB *phb; 519 proxy_connect_func fun; 510 520 511 521 if (!host || port <= 0 || !func || strlen(host) > 128) { … … 517 527 phb->data = data; 518 528 519 if (proxytype == PROXY_NONE || !proxyhost[0] || proxyport <= 0) { 520 return proxy_connect_none(host, port, phb); 521 } else if (proxytype == PROXY_HTTP) { 522 return proxy_connect_http(host, port, phb); 523 } else if (proxytype == PROXY_SOCKS4 || proxytype == PROXY_SOCKS4A) { 524 return proxy_connect_socks4(host, port, phb); 525 } else if (proxytype == PROXY_SOCKS5) { 526 return proxy_connect_socks5(host, port, phb); 527 } 528 529 g_free(phb); 530 return -1; 531 } 529 if (proxyhost[0] && proxyport > 0 && proxytype >= 0 && proxytype <= G_N_ELEMENTS(proxy_connect_funcs_array)) { 530 fun = proxy_connect_funcs_array[proxytype]; 531 } else { 532 fun = proxy_connect_none; 533 } 534 535 return fun(host, port, phb); 536 }
Note: See TracChangeset
for help on using the changeset viewer.