]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
This patch to alpha9 allows for large requests by the
authorwessels <>
Sat, 6 Apr 1996 07:53:03 +0000 (07:53 +0000)
committerwessels <>
Sat, 6 Apr 1996 07:53:03 +0000 (07:53 +0000)
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

src/cache_cf.cc
src/errorpage.cc
src/neighbors.cc

index 7723d8aff25ab6be5c3dd3ac13e8839c6c6b4625..c7ea22d5cbae45e117103642282fe0162dab615b 100644 (file)
@@ -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;
index 28c2dac851560df692255c30c9de525141d8906d..663f13da8d619376e07e75a6a4de10673dc4098d 100644 (file)
@@ -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);
 }
 
 
index bc87591cdc80b5e7e6cff2bd2eafb29f120571f3..ac9b3f9665fd8aa006e9bd984e71afbeb7311c55 100644 (file)
@@ -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);