diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-11-26 01:39:07 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-11-26 01:39:07 +0000 |
commit | a03a1d3847ddbc5687f4d3cf8568ecd8444d527f (patch) | |
tree | 8b4ceaf0c66380ca9321890f97853c80f880da98 | |
parent | 4a1b2d534a24b7845d5adabe8c14e5509a0a35b1 (diff) | |
download | tinyproxy-a03a1d3847ddbc5687f4d3cf8568ecd8444d527f.tar.gz tinyproxy-a03a1d3847ddbc5687f4d3cf8568ecd8444d527f.zip |
Fixed a problem with not buffering more than 2K (which is obviously a
problem. :)
Diffstat (limited to '')
-rw-r--r-- | src/buffer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c index faf871d..f60d5a2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.17 2001-11-25 22:05:42 rjkaes Exp $ +/* $Id: buffer.c,v 1.18 2001-11-26 01:39:07 rjkaes Exp $ * * The buffer used in each connection is a linked list of lines. As the lines * are read in and written out the buffer expands and contracts. Basically, @@ -197,10 +197,13 @@ read_buffer(int fd, struct buffer_s * buffptr) assert(fd >= 0); assert(buffptr != NULL); - if (BUFFER_SIZE(buffptr) >= READ_BUFFER_SIZE) + /* + * Don't allow the buffer to grow larger than MAXBUFFSIZE + */ + if (BUFFER_SIZE(buffptr) >= MAXBUFFSIZE) return 0; - bytesin = read(fd, buffer, READ_BUFFER_SIZE - BUFFER_SIZE(buffptr)); + bytesin = read(fd, buffer, READ_BUFFER_SIZE); if (bytesin > 0) { if (add_to_buffer(buffptr, buffer, bytesin) < 0) { |