aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/portsnap
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2005-11-17 11:01:32 +0000
committerColin Percival <cperciva@FreeBSD.org>2005-11-17 11:01:32 +0000
commit5c67112b9ec631072cb1487c3a57ecd6935af1f5 (patch)
tree48b0fe55f2836addcf7ce524a657f6369e84d123 /usr.sbin/portsnap
parent7f4f47d3fa1a6b13c05a13a0a0ea8ede15796f4d (diff)
downloadsrc-5c67112b9ec631072cb1487c3a57ecd6935af1f5.tar.gz
src-5c67112b9ec631072cb1487c3a57ecd6935af1f5.zip
Correctly handle a TCP connection being shutdown by the server while
we're reading response headers. (Handle it as a connection-killing error, rather than entering an infinite loop reading zero bytes.) Reported by: simon Discovered thanks to: A not-very-transparent transparent HTTP proxy. MFC after: 3 days
Notes
Notes: svn path=/head/; revision=152546
Diffstat (limited to 'usr.sbin/portsnap')
-rw-r--r--usr.sbin/portsnap/phttpget/phttpget.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/portsnap/phttpget/phttpget.c b/usr.sbin/portsnap/phttpget/phttpget.c
index 91f2e614071b..e45ab83616e6 100644
--- a/usr.sbin/portsnap/phttpget/phttpget.c
+++ b/usr.sbin/portsnap/phttpget/phttpget.c
@@ -223,7 +223,8 @@ readln(int sd, char * resbuf, int * resbuflen, int * resbufpos)
/* Read more data into the buffer */
len = recv(sd, resbuf + *resbuflen, BUFSIZ - *resbuflen, 0);
- if ((len == -1) && (errno != EINTR))
+ if ((len == 0) ||
+ ((len == -1) && (errno != EINTR)))
return -1;
if (len != -1)