]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/connection.c
verify.c: Increase buffer size for server certificates.
[tlsproxy/tlsproxy.git] / src / connection.c
index e053df2ee23e187a9399acc39c4cc403149c01a8..82b13bf0d04f5a316968bb18577378a2d47f8c47 100644 (file)
@@ -164,6 +164,7 @@ void handle_connection(int client_socket) {
     if (global_proxy_host != NULL && global_proxy_port != NULL) {
         fprintf(server_fd, "CONNECT %s:%s HTTP/1.0\r\n", host, port);
         fprintf(server_fd, "\r\n");
+        fflush(server_fd);
 
         /* Read response line from proxy server. */
         result = read_http_request(server_fd, buffer, sizeof(buffer));
@@ -524,6 +525,7 @@ static void send_bad_request(FILE *client_fd) {
     fprintf(client_fd, HTTP_RESPONSE_FORMAT,
                        RESPONSE_ERROR, RESPONSE_ERROR, RESPONSE_ERROR,
                        RESPONSE_MSG);
+    fflush(client_fd);
 #undef RESPONSE_ERROR
 #undef RESPONSE_MSG
 }
@@ -533,6 +535,7 @@ static void send_forwarding_failure(FILE *client_fd) {
     fprintf(client_fd, HTTP_RESPONSE_FORMAT,
                        RESPONSE_ERROR, RESPONSE_ERROR, RESPONSE_ERROR,
                        RESPONSE_MSG);
+    fflush(client_fd);
 #undef RESPONSE_ERROR
 #undef RESPONSE_MSG
 }
@@ -625,9 +628,8 @@ static int read_from_write_to(int from, int to) {
     if (size_read < 0) {
         LOG_PERROR(LOG_WARNING, "read_from_write_to(): read()");
         return -1;
-    }
     /* EOF */
-    if (size_read == 0) {
+    } else if (size_read == 0) {
         return -1;
     }
 
@@ -722,9 +724,8 @@ static int read_from_write_to_tls(gnutls_session_t from,
         LOG(LOG_WARNING, "read_from_write_to_tls(): gnutls_record_recv(): %s",
                          gnutls_strerror((int)size_read));
         return -1;
-    }
     /* EOF */
-    if (size_read == 0) {
+    } else if (size_read == 0) {
         return -1;
     }