git-svn: trunk@3941
Tomasz Kojm authored on 2008/07/14 17:58:40... | ... |
@@ -186,6 +186,7 @@ static int wwwconnect(const char *server, const char *proxy, int pport, char *ip |
186 | 186 |
int socketfd, port, ret; |
187 | 187 |
#ifdef SUPPORT_IPv6 |
188 | 188 |
struct addrinfo hints, *res = NULL, *rp; |
189 |
+ char port_s[6]; |
|
189 | 190 |
#else |
190 | 191 |
struct sockaddr_in name; |
191 | 192 |
struct hostent *host; |
... | ... |
@@ -227,7 +228,9 @@ static int wwwconnect(const char *server, const char *proxy, int pport, char *ip |
227 | 227 |
memset(&hints, 0, sizeof(hints)); |
228 | 228 |
hints.ai_family = AF_UNSPEC; |
229 | 229 |
hints.ai_socktype = SOCK_STREAM; |
230 |
- ret = getaddrinfo(hostpt, "80", &hints, &res); |
|
230 |
+ snprintf(port_s, sizeof(port_s), "%d", port); |
|
231 |
+ port_s[sizeof(port_s) - 1] = 0; |
|
232 |
+ ret = getaddrinfo(hostpt, port_s, &hints, &res); |
|
231 | 233 |
if(ret) { |
232 | 234 |
logg("%cCan't get information about %s: %s\n", logerr ? '!' : '^', hostpt, gai_strerror(ret)); |
233 | 235 |
return -1; |