From: Simon Ruderich Date: Sun, 28 Jul 2013 10:06:31 +0000 (+0200) Subject: Minor documentation updates. X-Git-Url: https://ruderich.org/simon/gitweb/?p=tlsproxy%2Ftlsproxy.git;a=commitdiff_plain;h=d0b5d139253e5c599c9e675fc0a5677bda5a5a29 Minor documentation updates. --- diff --git a/src/connection.c b/src/connection.c index f608339..e053df2 100644 --- a/src/connection.c +++ b/src/connection.c @@ -85,7 +85,7 @@ void handle_connection(int client_socket) { char host[MAX_REQUEST_LINE]; char port[5 + 1]; - int version_minor; /* HTTP/1.x */ + int version_minor; /* x in HTTP/1.x */ int result; /* client_x509_cred is used when talking to the client (acting as a TSL @@ -122,11 +122,9 @@ void handle_connection(int client_socket) { /* Read request line (CONNECT ..) and headers (they are discarded). */ result = read_http_request(client_fd, buffer, sizeof(buffer)); if (result == -1) { - /* Read error. */ LOG(LOG_WARNING, "read_http_request(): client read error"); goto out; } else if (result == -2) { - /* EOF */ LOG(LOG_WARNING, "read_http_request(): client EOF"); send_bad_request(client_fd); goto out; @@ -170,12 +168,10 @@ void handle_connection(int client_socket) { /* Read response line from proxy server. */ result = read_http_request(server_fd, buffer, sizeof(buffer)); if (result == -1) { - /* Read error. */ LOG(LOG_WARNING, "read_http_request(): proxy read error"); send_forwarding_failure(client_fd); goto out; } else if (result == -2) { - /* EOF */ LOG(LOG_WARNING, "read_http_request(): proxy EOF"); send_forwarding_failure(client_fd); goto out; @@ -247,7 +243,7 @@ void handle_connection(int client_socket) { /* Make sure the server certificate is valid and known. */ if (verify_tls_connection(server_session, host) != 0) { LOG(LOG_ERROR, "server certificate validation failed!"); - /* We send the error message over our TLS connection to the client, + /* We'll send the error message over our TLS connection to the client, * but with an invalid certificate. No data is transfered from/to the * target server. */ validation_failed = 1; @@ -504,7 +500,7 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) { LOG_PERROR(LOG_WARNING, "read_http_request(): fgets()"); return -1; } - + /* EOF */ return -2; } @@ -584,7 +580,7 @@ static void transfer_data(int client, int server) { fds[1].revents = 0; for (;;) { - int result = poll(fds, 2, -1 /* no timeout */); + int result = poll(fds, 2 /* fd count */, -1 /* no timeout */); if (result < 0) { LOG_PERROR(LOG_ERROR, "transfer_data(): poll()"); return; @@ -673,7 +669,7 @@ static void transfer_data_tls(int client, int server, (long int)buffer_size); for (;;) { - int result = poll(fds, 2, -1 /* no timeout */); + int result = poll(fds, 2 /* fd count */, -1 /* no timeout */); if (result < 0) { LOG_PERROR(LOG_ERROR, "transfer_data(): poll()"); return; diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 401553f..77c6d02 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -31,9 +31,8 @@ #include #include -/* For GnuTLS. */ +/* Necessary for GnuTLS when used with threads. */ #include - GCRY_THREAD_OPTION_PTHREAD_IMPL; diff --git a/src/tlsproxy.h b/src/tlsproxy.h index f23167e..23740a7 100644 --- a/src/tlsproxy.h +++ b/src/tlsproxy.h @@ -26,7 +26,6 @@ #include #include -/* GnuTLS */ #include #include "log.h" diff --git a/tests/client.c b/tests/client.c index d4edf7f..9bb23f3 100644 --- a/tests/client.c +++ b/tests/client.c @@ -231,7 +231,7 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) { perror("read_http_request(): fgets()"); return -1; } - + /* EOF */ return -2; }