From: Simon Ruderich <simon@ruderich.org>
Date: Fri, 9 Aug 2013 18:49:19 +0000 (+0200)
Subject: Check for EOF while reading the HTTP request.
X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=f012f75b2ed64fe9955b1dc2013c06e054bafd7f;p=tlsproxy%2Ftlsproxy.git

Check for EOF while reading the HTTP request.
---

diff --git a/src/connection.c b/src/connection.c
index 2b0f5d5..c91eae3 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -571,6 +571,8 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) {
     if (ferror(client_fd)) {
         LOG_PERROR(WARNING, "read_http_request(): fgets()");
         return -1;
+    } else if (feof(client_fd)) {
+        return -2;
     }
 
     if (global_http_digest_authorization != NULL && !found_proxy_authorization) {