Revision: 14811
Author: adrian.chadd
Date: Wed Oct 20 21:23:48 2010
Log: Merged r14769:14810 from /branches/LUSCA_HEAD


http://code.google.com/p/lusca-cache/source/detail?r=14811

Modified:
 /playpen/LUSCA_HEAD_ipv6/libhttp/HttpHeaderParse.c
 /playpen/LUSCA_HEAD_ipv6/src/cf.data.pre
 /playpen/LUSCA_HEAD_ipv6/src/client_side_body.c
 /playpen/LUSCA_HEAD_ipv6/src/external_acl.c
 /playpen/LUSCA_HEAD_ipv6/src/store_vary.c
 /playpen/LUSCA_HEAD_ipv6/src/structs.h
 /playpen/LUSCA_HEAD_ipv6/test-suite/atf/libhttp.c

=======================================
--- /playpen/LUSCA_HEAD_ipv6/libhttp/HttpHeaderParse.c Sun Jul 11 02:51:11 2010 +++ /playpen/LUSCA_HEAD_ipv6/libhttp/HttpHeaderParse.c Wed Oct 20 21:23:48 2010
@@ -327,7 +327,7 @@

     *value = strtol_n(start, len, &end, 10);
     if (start == end || errno != 0) {
- debug(66, 2) ("httpHeaderParseSize2: failed to parse a size/offset header field near '%s'\n", start); + debug(55, 2) ("httpHeaderParseSize2: failed to parse a size/offset header field near '%s'\n", start);
         *value = -1;
         return 0;
     }
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/cf.data.pre    Sat Sep  4 05:33:15 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/cf.data.pre    Wed Oct 20 21:23:48 2010
@@ -395,6 +395,20 @@
-----------------------------------------------------------------------------
 COMMENT_END

+NAME: external_acl_maxqueue
+TYPE: int
+LOC: Config.externalAclMaxQueue
+DEFAULT: 0
+DOC_START
+       By default, the maximum queue depth for the external ACL helpers
+       is the number of helper processes. This may not be useful in larger
+       installations where multiple requests are queued to the helpers
+       before the helper can receive and service requests.
+
+       By changing it to a non-zero value, the maximum queue depth will
+       be fixed to this value, regardless of the number of helper processes.
+DOC_END
+
 NAME: external_acl_type
 TYPE: externalAclHelper
 LOC: Config.externalAclHelperList
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/client_side_body.c     Tue Aug 31 09:02:21 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/client_side_body.c     Wed Oct 20 21:23:48 2010
@@ -10,20 +10,25 @@
     if (buf && size < 0) {
        return;                 /* Aborted, don't care */
     }
-    if (conn->body.size_left > 0) {
+    if (conn->in.offset > 0 && conn->body.size_left > 0) {
        conn->body.callback = clientEatRequestBodyHandler;
        conn->body.cbdata = http;
        cbdataLock(conn->body.cbdata);
        conn->body.buf = NULL;
        conn->body.bufsize = SQUID_TCP_SO_RCVBUF;
        clientProcessBody(conn);
+        return;
+    }
+
+    if (conn->in.offset == 0 && conn->body.size_left != 0) {
+ debug(1, 1) ("clientEatRequestBodyHandler: FD %d: no more data left in socket; but request header says there should be; aborting for now\n", conn->fd);
+        return;
+    }
+    if (http->request->flags.proxy_keepalive) {
+ debug(33, 5) ("clientEatRequestBodyHandler: FD %d Keeping Alive\n", conn->fd);
+        clientKeepaliveNextRequest(http);
     } else {
-       if (http->request->flags.proxy_keepalive) {
- debug(33, 5) ("clientEatRequestBodyHandler: FD %d Keeping Alive\n", conn->fd);
-           clientKeepaliveNextRequest(http);
-       } else {
-           comm_close(conn->fd);
-       }
+        comm_close(conn->fd);
     }
 }

@@ -95,6 +100,16 @@
     request_t *request = conn->body.request;
     /* Note: request is null while eating "aborted" transfers */
debug(33, 2) ("clientProcessBody: start fd=%d body_size=%lu in.offset=%ld cb=%p req=%p\n", conn->fd, (unsigned long int) conn->body.size_left, (long int) conn->in.offset, callback, request);
+#if 0
+    if (conn->in.offset == 0) {
+ /* This typically will only occur when some recursive call through the body eating path has occured -adrian */ + /* XXX so no need atm to call the callback handler; the original code didn't! -adrian */ + debug(33, 1) ("clientProcessBody: cbdata %p: would've leaked; conn->in.offset=0 here\n", cbdata);
+       cbdataUnlock(conn->body.cbdata);
+       conn->body.cbdata = conn->body.callback = NULL;
+       return;
+    }
+#endif
     if (conn->in.offset) {
        int valid = cbdataValid(conn->body.cbdata);
        if (!valid) {
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/external_acl.c Mon Sep  6 22:29:42 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/external_acl.c Wed Oct 20 21:23:48 2010
@@ -498,6 +498,8 @@
 static inline int
 externalAclOverload(external_acl * def)
 {
+    if (Config.externalAclMaxQueue > 0)
+        return def->helper->stats.queue_size > Config.externalAclMaxQueue;
     return def->helper->stats.queue_size > def->helper->n_running;
 }

@@ -743,6 +745,7 @@
                    stringAppend(&sb, quoted, strlen(quoted));
                } else {
                    static MemBuf mb2 = MemBufNULL;
+                   memBufReset(&mb2);
                    strwordquote(&mb2, arg->key);
                    stringAppend(&sb, mb2.buf, mb2.size);
                    memBufClean(&mb2);
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/store_vary.c   Tue Aug 31 09:02:21 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/store_vary.c   Wed Oct 20 21:23:48 2010
@@ -586,8 +586,10 @@
     state->seen_offset = offset;
if (!strLen2(e->mem_obj->reply->content_type) || strCmp(e->mem_obj->reply->content_type, "x-squid-internal/vary") != 0) {
        /* This is not our Vary marker object. Bail out. */
- debug(33, 1) ("storeLocateVary: Not our vary marker object, %s = '%s', vary_data='%s' ; accept_encoding='%.*s'\n", + debug(33, 1) ("storeLocateVary: Not our vary marker object, %s = '%s', vary_data='%s' ; content-type: '%.*s' ; accept_encoding='%.*s'\n",
            storeKeyText(e->hash.key), e->mem_obj->url, vary_data,
+ strLen2(e->mem_obj->reply->content_type) ? strLen2(e->mem_obj->reply->content_type) : 1, + strBuf2(e->mem_obj->reply->content_type) ? strBuf2(e->mem_obj->reply->content_type) : "-",
            strLen2(accept_encoding) ? strLen2(accept_encoding) : 1,
            strBuf2(accept_encoding) ? strBuf2(accept_encoding) : "-");

=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/structs.h      Tue Sep  7 00:31:56 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/structs.h      Wed Oct 20 21:23:48 2010
@@ -792,6 +792,7 @@
     char *store_dir_select_algorithm;
     int sleep_after_fork;      /* microseconds */
     time_t minimum_expiry_time;        /* seconds */
+    int externalAclMaxQueue;
     external_acl *externalAclHelperList;
     enum zph_mode {
        ZPH_OFF = 0,
=======================================
--- /playpen/LUSCA_HEAD_ipv6/test-suite/atf/libhttp.c Sun Jul 4 06:56:53 2010 +++ /playpen/LUSCA_HEAD_ipv6/test-suite/atf/libhttp.c Wed Oct 20 21:23:48 2010
@@ -114,7 +114,15 @@

 /* ** */

-extern int hh_check_content_length(HttpHeader *hdr, const char *val, int vlen);
+/* XXX should be in an include file from libhttp! */
+typedef enum {
+        PR_NONE,
+        PR_ERROR,
+        PR_IGNORE,
+        PR_WARN,
+        PR_OK
+} parse_retval_t;
+extern parse_retval_t hh_check_content_length(HttpHeader *hdr, const char *val, int vlen);

 static int
 test_core_parse_header(HttpHeader *hdr, const char *hdrs)
@@ -151,7 +159,7 @@
        httpHeaderClean(&hdr);
 }

-static int
+static parse_retval_t
 test_http_content_length(HttpHeader *hdr, const char *str)
 {
        int r;
@@ -254,10 +262,11 @@
         httpHeaderInitLibrary();
        httpHeaderInit(&hdr, hoRequest);

-       ATF_REQUIRE(test_http_content_length(&hdr, "12345") == 1);
-       ATF_REQUIRE(test_http_content_length(&hdr, "123b5") == 1);
-       ATF_REQUIRE(test_http_content_length(&hdr, "b1234") == -1);
-       ATF_REQUIRE(test_http_content_length(&hdr, "abcde") == -1);
+       ATF_REQUIRE(test_http_content_length(&hdr, "12345") == PR_OK);
+       ATF_REQUIRE(test_http_content_length(&hdr, "123b5") == PR_OK);
+       ATF_REQUIRE(test_http_content_length(&hdr, "b1234") == PR_ERROR);
+       ATF_REQUIRE(test_http_content_length(&hdr, "abcde") == PR_ERROR);
+       ATF_REQUIRE(test_http_content_length(&hdr, "4790023270") == PR_OK);

        /* Clean up */
        httpHeaderClean(&hdr);
@@ -277,6 +286,7 @@
libhttp_test_content_length_parser("Content-Length: 12345\r\nContent-Length: 23456\r\n", "23456"); libhttp_test_content_length_parser("Content-Length: 23456\r\nContent-Length: 12345\r\n", "23456"); libhttp_test_content_length_parser("Content-Length: 23456\r\nContent-Length: 12345\r\nContent-Length: 23456\r\n", "23456"); + libhttp_test_content_length_parser("Content-Length: 4790023270\r\n", "4790023270");
 }

 ATF_TC(libhttp_parser_other_whitespace_1);

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to