url: fix port type to int (ports above 32766), use AI_NUMERICSERV in tcp and udp, fixes #2369

This commit is contained in:
Jaroslav Kysela 2014-10-14 09:12:56 +02:00
parent 73bf840f14
commit cc276263a3
3 changed files with 3 additions and 3 deletions

View file

@ -647,7 +647,7 @@ tcp_server_create
snprintf(port_buf, 6, "%d", port);
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = AI_PASSIVE;
hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV;
if (bindaddr != NULL)
hints.ai_flags |= AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;

View file

@ -48,7 +48,7 @@ udp_resolve( udp_connection_t *uc, int receiver )
snprintf(port_buf, 6, "%d", uc->port);
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = receiver ? AI_PASSIVE : 0;
hints.ai_flags = (receiver ? AI_PASSIVE : 0) | AI_NUMERICSERV;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;

View file

@ -29,7 +29,7 @@ typedef struct url
char *user;
char *pass;
char *host;
short port;
int port;
char *path;
char *query;
char *frag;