Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
url: fix port type to int (ports above 32766), use AI_NUMERICSERV in …
…tcp and udp, fixes #2369
  • Loading branch information
perexg committed Oct 14, 2014
1 parent 73bf840 commit cc27626
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/tcp.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/udp.c
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/url.h
Expand Up @@ -29,7 +29,7 @@ typedef struct url
char *user;
char *pass;
char *host;
short port;
int port;
char *path;
char *query;
char *frag;
Expand Down

0 comments on commit cc27626

Please sign in to comment.