diff --git a/httphead.c b/httphead.c index d3228e4..ce74e7c 100644 --- a/httphead.c +++ b/httphead.c @@ -240,9 +240,9 @@ remote_host_addr->sin_family = AF_INET; remote_host_addr->sin_addr = *((struct in_addr*) remote_hostent->h_addr); if ( port == NULL ) { - remote_host_addr->sin_port = 80; + remote_host_addr->sin_port = htons(80); } else { - remote_host_addr->sin_port = atoi(port); + remote_host_addr->sin_port = htons(atoi(port)); } if ( (sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1 ) {