From: wessels <> Date: Sat, 6 Apr 1996 07:53:03 +0000 (+0000) Subject: This patch to alpha9 allows for large requests by the X-Git-Tag: SQUID_3_0_PRE1~6269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa966b74ff55555a7032a0fbdd3315e53fa37b70;p=thirdparty%2Fsquid.git This patch to alpha9 allows for large requests by the clients (for example POST file upload) It adds the configuration directive request_size, which sets the maximum request size. The memory used for the request is grown in ASCII_REQUEST_BLOCKSIZE steps (8Kb). This patch is not very tested, but it should work... please test. There is also a small change in cache_cf.c, to remove a compiler warning when the in_addr localhost variable is initialized. (uninitialized members in a initialized structure is set to binary 0 by standard) /Henrik --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 7723d8aff2..c7ea22d5cb 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,4 +1,4 @@ -/* $Id: cache_cf.cc,v 1.19 1996/04/05 21:51:45 wessels Exp $ */ +/* $Id: cache_cf.cc,v 1.20 1996/04/06 00:53:03 wessels Exp $ */ /* DEBUG: Section 3 cache_cf: Configuration file parsing */ @@ -29,6 +29,7 @@ static struct { int ageMaxDefault; int cleanRate; int dnsChildren; + int maxRequestSize; double hotVmFactor; struct { int ascii; @@ -94,6 +95,7 @@ static struct { #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 @@ -180,7 +182,7 @@ ip_access_type ip_access_check(address, list) ip_acl *list; { static struct in_addr localhost = - {0}; + {}; /* Initialized to all zero */ ip_acl *p = NULL; struct in_addr naddr; /* network byte-order IP addr */ @@ -698,6 +700,15 @@ static void parseDnsChildrenLine(line_in) 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; { @@ -1300,6 +1311,10 @@ int parseConfigFile(file_name) 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); @@ -1523,6 +1538,10 @@ int getClientLifetime() { return Config.lifetimeDefault; } +int getMaxRequestSize() +{ + return Config.maxRequestSize; +} int getConnectTimeout() { return Config.connectTimeout; @@ -1672,6 +1691,7 @@ static void configSetFactoryDefaults() Config.negativeTtl = DefaultNegativeTtl; Config.readTimeout = DefaultReadTimeout; Config.lifetimeDefault = DefaultLifetimeDefault; + Config.maxRequestSize = DefaultMaxRequestSize; Config.connectTimeout = DefaultConnectTimeout; Config.ageMaxDefault = DefaultDefaultAgeMax; Config.cleanRate = DefaultCleanRate; diff --git a/src/errorpage.cc b/src/errorpage.cc index 28c2dac851..663f13da8d 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,4 +1,4 @@ -/* $Id: errorpage.cc,v 1.14 1996/04/05 23:21:11 wessels Exp $ */ +/* $Id: errorpage.cc,v 1.15 1996/04/06 00:53:05 wessels Exp $ */ /* DEBUG: Section 4 cached_error: Error printing routines */ @@ -105,9 +105,10 @@ static char *tbuf; int log_errors = 1; -void errorInitialize() { - tmp_error_buf = (char *) xmalloc(MAX_URL * 4); - tbuf = (char *) xmalloc(MAX_URL * 3); +void errorInitialize() +{ + tmp_error_buf = (char *) xmalloc(MAX_URL * 4); + tbuf = (char *) xmalloc(MAX_URL * 3); } diff --git a/src/neighbors.cc b/src/neighbors.cc index bc87591cdc..ac9b3f9665 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,4 +1,4 @@ -/* $Id: neighbors.cc,v 1.9 1996/04/04 01:30:49 wessels Exp $ */ +/* $Id: neighbors.cc,v 1.10 1996/04/06 00:53:06 wessels Exp $ */ /* * DEBUG: Section 15 neighbors: @@ -493,7 +493,9 @@ void neighborsUdpAck(fd, url, header, from, entry) header->opcode, header->version, header->shostid, header->length, header->reqnum); debug(15, 6, " from: fam=%d, port=%d, addr=0x%x\n", - from->sin_family, from->sin_port, from->sin_addr.s_addr); + ntohs(from->sin_family), + ntohs(from->sin_port), + ntohl(from->sin_addr.s_addr)); /* look up for neighbor/parent entry */ e = whichEdge(header, from);