Only in squid-1.0.alpha9.henrik: build.log diff -c -r -x *.o -x *.orig -X exclude_files squid-1.0.alpha9/src/cache_cf.c squid-1.0.alpha9.henrik/src/cache_cf.c *** squid-1.0.alpha9/src/cache_cf.c Thu Apr 4 20:51:02 1996 --- squid-1.0.alpha9.henrik/src/cache_cf.c Fri Apr 5 20:15:31 1996 *************** *** 28,33 **** --- 28,34 ---- int ageMaxDefault; int cleanRate; int dnsChildren; + int maxRequestSize; double hotVmFactor; struct { int ascii; *************** *** 92,97 **** --- 93,99 ---- #define DefaultCleanRate -1 /* disabled */ #define DefaultDnsChildren 5 /* 3 processes */ #define DefaultDnsChildrenMax 32 /* 32 processes */ + #define DefaultMaxRequestSize (102400) /* 100Kb */ #define DefaultHotVmFactor 0.0 /* disabled */ #define DefaultAsciiPortNum CACHE_HTTP_PORT *************** *** 177,184 **** struct in_addr address; ip_acl *list; { ! static struct in_addr localhost = ! {0}; ip_acl *p = NULL; struct in_addr naddr; /* network byte-order IP addr */ --- 179,185 ---- struct in_addr address; ip_acl *list; { ! static struct in_addr localhost = {}; /* Initialized to all zero */ ip_acl *p = NULL; struct in_addr naddr; /* network byte-order IP addr */ *************** *** 687,692 **** --- 688,702 ---- Config.dnsChildren = i; } + static void parseRequestSizeLine(line_in) + char *line_in; + { + char *token; + int i; + GetInteger(i); + Config.maxRequestSize = i * 1024; + } + static void parseMgrLine(line_in) char *line_in; { *************** *** 1285,1290 **** --- 1295,1304 ---- else if (!strcmp(token, "client_lifetime")) parseLifetimeLine(line_in); + /* Parse a request_size line */ + else if (!strcmp(token, "request_size")) + parseRequestSizeLine(line_in); + /* Parse a connect_timeout line */ else if (!strcmp(token, "connect_timeout")) parseConnectTimeout(line_in); *************** *** 1504,1509 **** --- 1518,1527 ---- { return Config.lifetimeDefault; } + int getMaxRequestSize() + { + return Config.maxRequestSize; + } int getConnectTimeout() { return Config.connectTimeout; *************** *** 1653,1658 **** --- 1671,1677 ---- Config.negativeTtl = DefaultNegativeTtl; Config.readTimeout = DefaultReadTimeout; Config.lifetimeDefault = DefaultLifetimeDefault; + Config.maxRequestSize = DefaultMaxRequestSize; Config.connectTimeout = DefaultConnectTimeout; Config.ageMaxDefault = DefaultDefaultAgeMax; Config.cleanRate = DefaultCleanRate; diff -c -r -x *.o -x *.orig -X exclude_files squid-1.0.alpha9/src/cache_cf.h squid-1.0.alpha9.henrik/src/cache_cf.h *** squid-1.0.alpha9/src/cache_cf.h Thu Apr 4 19:46:02 1996 --- squid-1.0.alpha9.henrik/src/cache_cf.h Fri Apr 5 20:14:40 1996 *************** *** 69,74 **** --- 69,75 ---- extern int getCleanRate _PARAMS((void)); extern int getClientLifetime _PARAMS((void)); extern int getDnSChildren _PARAMS((void)); + extern int getMaxRequestSize _PARAMS((void)); extern int getFtpMax _PARAMS((void)); extern int getFtpTTL _PARAMS((void)); extern int getGopherMax _PARAMS((void)); diff -c -r -x *.o -x *.orig -X exclude_files squid-1.0.alpha9/src/cached.conf squid-1.0.alpha9.henrik/src/cached.conf *** squid-1.0.alpha9/src/cached.conf Thu Apr 4 07:06:37 1996 --- squid-1.0.alpha9.henrik/src/cached.conf Fri Apr 5 20:08:04 1996 *************** *** 740,742 **** --- 740,748 ---- # (for example perl.com). # ftp_user Harvest@ + + # Maximum allowed request size in kilobyte. If people are using + # POST file upload set this to largest filesize + a few kb. + # + request_size 100 + diff -c -r -x *.o -x *.orig -X exclude_files squid-1.0.alpha9/src/icp.c squid-1.0.alpha9.henrik/src/icp.c *** squid-1.0.alpha9/src/icp.c Thu Apr 4 23:34:25 1996 --- squid-1.0.alpha9.henrik/src/icp.c Fri Apr 5 19:33:21 1996 *************** *** 54,59 **** --- 54,60 ---- #endif char *url; char *inbuf; + int inbufsize; int method; /* GET, POST, ... */ char *mime_hdr; /* Mime header */ int html_request; *************** *** 1454,1460 **** ! #define ASCII_INBUF_SIZE 4096 /* * asciiProcessInput() * --- 1455,1461 ---- ! #define ASCII_INBUF_BLOCKSIZE 4096 /* * asciiProcessInput() * *************** *** 1486,1502 **** icpCloseAndFree(fd, astm, __LINE__); return; } ! if (astm->offset + size >= ASCII_INBUF_SIZE) { ! debug(12, 0, "asciiProcessInput: Request won't fit in buffer.\n"); ! debug(12, 0, "--> ASCII_INBUF_SIZE = %d\n", ASCII_INBUF_SIZE); ! debug(12, 0, "--> astm->offset = %d\n", astm->offset); ! debug(12, 0, "--> size = %d\n", size); ! astm->buf = NULL; ! astm->ptr_to_4k_page = NULL; ! icpSendERROR(fd, ICP_ERROR_INTERNAL, "error reading request", astm); ! icpCloseAndFree(fd, astm, __LINE__); ! /* XXX should use icpWrite as below ... */ ! return; } astm->offset += size; --- 1487,1516 ---- icpCloseAndFree(fd, astm, __LINE__); return; } ! if (astm->offset + size >= astm->inbufsize) { ! if (astm->offset + size >= getMaxRequestSize()) { ! /* The request is to large to handle */ ! debug(12, 0, "asciiProcessInput: Request won't fit in buffer.\n"); ! debug(12, 0, "--> max size = %d\n", getMaxRequestSize()); ! debug(12, 0, "--> astm->offset = %d\n", astm->offset); ! debug(12, 0, "--> size = %d\n", size); ! astm->buf = NULL; ! astm->ptr_to_4k_page = NULL; ! icpSendERROR(fd, ICP_ERROR_INTERNAL, "error reading request", astm); ! icpCloseAndFree(fd, astm, __LINE__); ! /* XXX should use icpWrite as below ... */ ! return; ! } else { ! /* Grow the request memory area to accomodate for a large request */ ! char *inbuf; ! inbuf=xmalloc(astm->inbufsize + ASCII_INBUF_BLOCKSIZE); ! memcpy(inbuf,astm->inbuf,astm->inbufsize); ! safe_free(astm->inbuf); ! astm->inbuf=inbuf; ! astm->inbufsize+=ASCII_INBUF_BLOCKSIZE; ! debug(12, 2, "Handling a large request, inbufsize=%d\n", ! astm->inbufsize); ! } } astm->offset += size; *************** *** 1563,1569 **** * Partial request received; reschedule until parseAsciiUrl() * is happy with the input */ ! k = ASCII_INBUF_SIZE - 1 - astm->offset; if (0 < astm->bytes_needed && astm->bytes_needed < k) k = astm->bytes_needed; icpRead(fd, --- 1577,1583 ---- * Partial request received; reschedule until parseAsciiUrl() * is happy with the input */ ! k = astm->inbufsize - 1 - astm->offset; if (0 < astm->bytes_needed && astm->bytes_needed < k) k = astm->bytes_needed; icpRead(fd, *************** *** 1703,1709 **** icpSendERRORComplete, (caddr_t) astm); } else { ! astm->inbuf = (char *) xcalloc(ASCII_INBUF_SIZE, 1); astm->header.shostid = htonl(peer.sin_addr.s_addr); astm->peer = peer; astm->me = me; --- 1717,1724 ---- icpSendERRORComplete, (caddr_t) astm); } else { ! astm->inbufsize = ASCII_INBUF_BLOCKSIZE; ! astm->inbuf = (char *) xcalloc(astm->inbufsize, 1); astm->header.shostid = htonl(peer.sin_addr.s_addr); astm->peer = peer; astm->me = me; *************** *** 1714,1720 **** icpRead(fd, FALSE, astm->inbuf, ! ASCII_INBUF_SIZE - 1, 30, asciiProcessInput, (caddr_t) astm); --- 1729,1735 ---- icpRead(fd, FALSE, astm->inbuf, ! astm->inbufsize - 1, 30, asciiProcessInput, (caddr_t) astm);