X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=tests%2Fclient.c;h=c11684d2e19bd57d7a60f422601b8aefe7386a8e;hb=da1b95a8ded80fb5dc07e93a3a7538d39b59740e;hp=f98711fa02ffbf09afbafad2ed6a9577b152984c;hpb=058678e898268c214fa135a3f6fb7b049f912fc2;p=tlsproxy%2Ftlsproxy.git diff --git a/tests/client.c b/tests/client.c index f98711f..c11684d 100644 --- a/tests/client.c +++ b/tests/client.c @@ -185,7 +185,12 @@ static int connect_to_host(const char *hostname, const char *port) { | AI_V4MAPPED; /* support IPv4 through IPv6 */ gai_return = getaddrinfo(hostname, port, &gai_hints, &gai_result); if (gai_return != 0) { - perror("connect_to_host(): getaddrinfo()"); + if (gai_return == EAI_SYSTEM) { + perror("connect_to_host(): getaddrinfo()"); + } else { + fprintf(stderr, "connect_to_host(): getaddrinfo(): %s", + gai_strerror(gai_return)); + } return -1; } @@ -226,11 +231,11 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) { perror("read_http_request(): fgets()"); return -1; } - + /* EOF */ return -2; } - while (fgets(buffer, MAX_REQUEST_LINE, client_fd) != NULL) { + while (fgets(buffer, sizeof(buffer), client_fd) != NULL) { /* End of header. */ if (!strcmp(buffer, "\n") || !strcmp(buffer, "\r\n")) { break;