From f260181f3e34fb25a7392ddfc132936d8090fbbb Mon Sep 17 00:00:00 2001 From: Stephane Bortzmeyer Date: Wed, 12 Jul 2000 20:35:37 +0000 Subject: [PATCH] An error when reading a HTTP answer is no longer fatal. --- SRC/echoping.c | 5 ++++- SRC/http.c | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/SRC/echoping.c b/SRC/echoping.c index 5e56d74..f928b54 100644 --- a/SRC/echoping.c +++ b/SRC/echoping.c @@ -597,7 +597,7 @@ main (argc, argv) if ((sigaction (SIGALRM, &mysigaction, NULL)) < 0) err_sys ("Cannot set signal handler"); #else - signal (SIGALRM, to_alarm); +« signal (SIGALRM, to_alarm); #endif timeout_flag = 0; /* for signal handler */ alarm (timeout); @@ -672,6 +672,9 @@ main (argc, argv) #endif continue; } + if (nr < 0) { + err_ret ("Error reading HTTP header"); + } } if (verbose) printf ("%d bytes read from server.\n", nr); diff --git a/SRC/http.c b/SRC/http.c index 06c8fa2..c3d5789 100644 --- a/SRC/http.c +++ b/SRC/http.c @@ -71,7 +71,9 @@ read_from_server (int fd) if ((nr < 1) && (errno == EINTR)) /* Probably a timeout */ return -1; if (nr < 1) - err_sys ("Error reading HTTP header"); + /* SourceForge bug #109385 */ + /* err_sys ("Error reading HTTP header"); */ + return -1; /* if ((int) big_recvline[nr-1] == 10) nr--; */ if (first_line) @@ -88,7 +90,8 @@ read_from_server (int fd) nr = readline (fd, big_recvline, MAXTOREAD, FALSE); if ((nr < 2) && (errno == EINTR)) /* Probably a timeout */ return -1; - if (nr < 2) /* Hmm, if the body is empty, we'll get a meaningless error message */ + if (nr < 2) /* Hmm, if the body is empty, we'll + get a meaningless error message */ err_sys ("Reading HTTP body"); total = total + nr; return total; /* How to do if we want only the body's size? */