httpd: do not set alarm() timeout if we read cached header
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 19 Apr 2019 12:03:37 +0000 (14:03 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 19 Apr 2019 12:03:37 +0000 (14:03 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/httpd.c

index d06bc27762380db1af49e6717b3ff0fc715f30c5..aa8ce8dcb18507618036cf75216de43c64f4ba49 100644 (file)
@@ -1253,10 +1253,10 @@ static unsigned get_line(void)
        unsigned count;
        char c;
 
-       alarm(HEADER_READ_TIMEOUT);
        count = 0;
        while (1) {
                if (hdr_cnt <= 0) {
+                       alarm(HEADER_READ_TIMEOUT);
                        hdr_cnt = safe_read(STDIN_FILENO, hdr_buf, sizeof_hdr_buf);
                        if (hdr_cnt <= 0)
                                goto ret;