]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Merged from trunk
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 23 Jul 2012 07:02:06 +0000 (09:02 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 23 Jul 2012 07:02:06 +0000 (09:02 +0200)
28 files changed:
1  2 
src/ConfigParser.cc
src/HttpHeaderTools.cc
src/HttpRequest.cc
src/cache_cf.cc
src/cbdata.cc
src/cf_gen.cc
src/client_side.cc
src/client_side_request.cc
src/errorpage.cc
src/format/Format.cc
src/format/Token.cc
src/forward.cc
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/ufscommon.cc
src/ftp.cc
src/gopher.cc
src/htcp.cc
src/http.cc
src/icp_v2.cc
src/log/access_log.cc
src/ssl/ErrorDetail.cc
src/ssl/certificate_db.cc
src/ssl/crtd_message.cc
src/ssl/ssl_crtd.cc
src/ssl/support.cc
src/store_rebuild.cc
src/tunnel.cc
src/wccp2.cc

Simple merge
Simple merge
Simple merge
diff --cc src/cache_cf.cc
Simple merge
diff --cc src/cbdata.cc
Simple merge
diff --cc src/cf_gen.cc
index fc82fb200c8caef1966ffe7dacb3b10c2e7c3447,e46fecaac7b9bcd869169aafe09c7cf2f8bbbb7c..5fdc4ad3966df7862fe67927feac9085cc26769c
@@@ -327,9 -306,82 +306,82 @@@ main(int argc, char *argv[]
                      exit(1);
                  }
  
-                 curr.loc = ptr;
-             } else if (!strncmp(buff, "TYPE:", 5)) {
-                 if ((ptr = strtok(buff + 5, WS)) == NULL) {
+                 break;
+             case s1: {
+                 Entry &curr = entries.back();
+                 if ((strlen(buff) == 0) || (!strncmp(buff, "#", 1))) {
+                     /* ignore empty and comment lines */
+                     (void) 0;
+                 } else if (!strncmp(buff, "COMMENT:", 8)) {
+                     ptr = buff + 8;
+                     while (isspace((unsigned char)*ptr))
 -                        ptr++;
++                        ++ptr;
+                     curr.comment = ptr;
+                 } else if (!strncmp(buff, "DEFAULT:", 8)) {
+                     ptr = buff + 8;
+                     while (isspace((unsigned char)*ptr))
 -                        ptr++;
++                        ++ptr;
+                     curr.defaults.preset.push_back(ptr);
+                 } else if (!strncmp(buff, "DEFAULT_IF_NONE:", 16)) {
+                     ptr = buff + 16;
+                     while (isspace((unsigned char)*ptr))
 -                        ptr++;
++                        ++ptr;
+                     curr.defaults.if_none.push_back(ptr);
+                 } else if (!strncmp(buff, "POSTSCRIPTUM:", 13)) {
+                     ptr = buff + 13;
+                     while (isspace((unsigned char)*ptr))
 -                        ptr++;
++                        ++ptr;
+                     curr.defaults.postscriptum.push_back(ptr);
+                 } else if (!strncmp(buff, "DEFAULT_DOC:", 12)) {
+                     ptr = buff + 12;
+                     while (isspace((unsigned char)*ptr))
 -                        ptr++;
++                        ++ptr;
+                     curr.defaults.docs.push_back(ptr);
+                 } else if (!strncmp(buff, "LOC:", 4)) {
+                     if ((ptr = strtok(buff + 4, WS)) == NULL) {
+                         std::cerr << "Error on line " << linenum << std::endl;
+                         exit(1);
+                     }
+                     curr.loc = ptr;
+                 } else if (!strncmp(buff, "TYPE:", 5)) {
+                     if ((ptr = strtok(buff + 5, WS)) == NULL) {
+                         std::cerr << "Error on line " << linenum << std::endl;
+                         exit(1);
+                     }
+                     /* hack to support arrays, rather than pointers */
+                     if (0 == strcmp(ptr + strlen(ptr) - 2, "[]")) {
+                         curr.array_flag = 1;
+                         *(ptr + strlen(ptr) - 2) = '\0';
+                     }
+                     checkDepend(curr.name, ptr, types, entries);
+                     curr.type = ptr;
+                 } else if (!strncmp(buff, "IFDEF:", 6)) {
+                     if ((ptr = strtok(buff + 6, WS)) == NULL) {
+                         std::cerr << "Error on line " << linenum << std::endl;
+                         exit(1);
+                     }
+                     curr.ifdef = ptr;
+                 } else if (!strcmp(buff, "DOC_START")) {
+                     state = sDOC;
+                 } else if (!strcmp(buff, "DOC_NONE")) {
+                     state = sSTART;
+                 } else {
                      std::cerr << "Error on line " << linenum << std::endl;
                      exit(1);
                  }
Simple merge
Simple merge
Simple merge
Simple merge
index 522914328b19d02cb6359c06e7ed657641fd2a98,c273a4f269038d1f685db9252953e1dc1de92e20..087a526ee1e9c910a5cc8ecfb4534bb6cbb1b22a
@@@ -207,10 -217,10 +217,10 @@@ Format::Token::Init(
  
  /// Scans a token table to see if the next token exists there
  /// returns a pointer to next unparsed byte and updates type member if found
- char *
- Format::Token::scanForToken(TokenTableEntry const table[], char *cur)
+ const char *
+ Format::Token::scanForToken(TokenTableEntry const table[], const char *cur)
  {
 -    for (TokenTableEntry const *lte = table; lte->configTag != NULL; lte++) {
 +    for (TokenTableEntry const *lte = table; lte->configTag != NULL; ++lte) {
          debugs(46, 8, HERE << "compare tokens '" << lte->configTag << "' with '" << cur << "'");
          if (strncmp(lte->configTag, cur, strlen(lte->configTag)) == 0) {
              type = lte->tokenType;
@@@ -315,14 -325,19 +325,19 @@@ Format::Token::parse(const char *def, Q
  
      if (*cur == '0') {
          zero = 1;
 -        cur++;
 +        ++cur;
      }
  
-     if (xisdigit(*cur))
-         widthMin = strtol(cur, &cur, 10);
+     char *endp;
+     if (xisdigit(*cur)) {
+         widthMin = strtol(cur, &endp, 10);
+         cur = endp;
+     }
  
-     if (*cur == '.' && xisdigit(*(++cur)))
-         widthMax = strtol(cur, &cur, 10);
+     if (*cur == '.' && xisdigit(*(++cur))) {
+         widthMax = strtol(cur, &endp, 10);
+         cur = endp;
+     }
  
      if (*cur == '{') {
          char *cp;
diff --cc src/forward.cc
index 9325c3d3eb9f3acbb0e10c93974eab18a88ad504,ee6191635028ceec58fc8205ef090c4617a54901..ccfab97e810f63515d7a17499912c189ce40bd21
@@@ -891,11 -996,12 +996,12 @@@ FwdState::connectStart(
      // if we found an open persistent connection to use. use it.
      if (openedPconn) {
          serverConn = temp;
+         flags.connected_okay = true;
          debugs(17, 3, HERE << "reusing pconn " << serverConnection());
 -        n_tries++;
 +        ++n_tries;
  
          if (!serverConnection()->getPeer())
 -            origin_tries++;
 +            ++origin_tries;
  
          comm_add_close_handler(serverConnection()->fd, fwdServerClosedWrapper, this);
  
@@@ -991,8 -1097,18 +1097,18 @@@ FwdState::dispatch(
      }
  #endif
  
+ #if USE_SSL
+     if (request->flags.sslPeek) {
+         CallJobHere1(17, 4, request->clientConnectionManager, ConnStateData,
+                      ConnStateData::httpsPeeked, serverConnection());
+         unregister(serverConn); // async call owns it now
+         complete(); // destroys us
+         return;
+     }
+ #endif
      if (serverConnection()->getPeer() != NULL) {
 -        serverConnection()->getPeer()->stats.fetches++;
 +        ++ serverConnection()->getPeer()->stats.fetches;
          request->peer_login = serverConnection()->getPeer()->login;
          request->peer_domain = serverConnection()->getPeer()->domain;
          httpStart(this);
Simple merge
index b329f96cc67b5d1b818661b90f77562ef3eea34c,821806fa0a0cbc83f5e6862190754889f75babc4..c4af21183affba4d1c43c03285d6f8aa56f90deb
@@@ -567,27 -567,9 +567,9 @@@ RebuildState::rebuildFromSwapLog(
          currentEntry (Store::Root().get(swapData.key));
  
          if (currentEntry() != NULL && swapData.lastref >= e->lastref) {
-             /*
-              * Make sure we don't unlink the file, it might be
-              * in use by a subsequent entry.  Also note that
-              * we don't have to subtract from cur_size because
-              * adding to cur_size happens in the cleanup procedure.
-              */
-             currentEntry()->expireNow();
-             currentEntry()->releaseRequest();
-             if (currentEntry()->swap_filen > -1) {
-                 UFSSwapDir *sdForThisEntry = dynamic_cast<UFSSwapDir *>(INDEXSD(currentEntry()->swap_dirn));
-                 assert (sdForThisEntry);
-                 sdForThisEntry->replacementRemove(currentEntry());
-                 sdForThisEntry->mapBitReset(currentEntry()->swap_filen);
-                 currentEntry()->swap_filen = -1;
-                 currentEntry()->swap_dirn = -1;
-             }
-             currentEntry()->release();
+             undoAdd();
 -            counts.objcount--;
 -            counts.cancelcount++;
 +            --counts.objcount;
 +            ++counts.cancelcount;
          }
          return;
      } else {
      } else if (currentEntry()) {
          /* key already exists, this swapfile not being used */
          /* junk old, load new */
-         currentEntry()->expireNow();
-         currentEntry()->releaseRequest();
-         if (currentEntry()->swap_filen > -1) {
-             UFSSwapDir *sdForThisEntry = dynamic_cast<UFSSwapDir *>(INDEXSD(currentEntry()->swap_dirn));
-             sdForThisEntry->replacementRemove(currentEntry());
-             /* Make sure we don't actually unlink the file */
-             sdForThisEntry->mapBitReset(currentEntry()->swap_filen);
-             currentEntry()->swap_filen = -1;
-             currentEntry()->swap_dirn = -1;
-         }
-         currentEntry()->release();
+         undoAdd();
 -        counts.objcount--;
 -        counts.dupcount++;
++        --counts.objcount;
 +        ++counts.dupcount;
      } else {
          /* URL doesnt exist, swapfile not in use */
          /* load new */
diff --cc src/ftp.cc
Simple merge
diff --cc src/gopher.cc
Simple merge
diff --cc src/htcp.cc
Simple merge
diff --cc src/http.cc
Simple merge
diff --cc src/icp_v2.cc
Simple merge
Simple merge
index 8bf515f75b0485d9f74c362c7a60f5003208c077,c02c5dde52c30ee9bf0ee50a60a10b1f2c824dba..4b6cc06d153bb64a7b68f12ceb1918b86f3deb0a
@@@ -96,10 -137,16 +137,17 @@@ static void loadSslErrorMap(
      }
  }
  
+ static void loadSslErrorShortcutsMap()
+ {
+     assert(TheSslErrorShortcuts.empty());
+     for (int i = 0; TheSslErrorShortcutsArray[i].name; i++)
+         TheSslErrorShortcuts[TheSslErrorShortcutsArray[i].name] = TheSslErrorShortcutsArray[i].errors;
+ }
  Ssl::ssl_error_t Ssl::GetErrorCode(const char *name)
  {
 -    for (int i = 0; TheSslErrorArray[i].name != NULL; i++) {
 +    //TODO: use a std::map?
 +    for (int i = 0; TheSslErrorArray[i].name != NULL; ++i) {
          if (strcmp(name, TheSslErrorArray[i].name) == 0)
              return TheSslErrorArray[i].value;
      }
Simple merge
Simple merge
Simple merge
Simple merge
index 509f5ae71bc93488208e851f433ad4d6bb61b9f4,3f49a355a08c4c281b98c4ba4371cf28f0098895..8d35bc405933f7822c225aca38cfad8855da402f
@@@ -109,11 -110,15 +110,15 @@@ storeCleanup(void *datanotused
          debugs(20, 1, "  Completed Validation Procedure");
          debugs(20, 1, "  Validated " << validated << " Entries");
          debugs(20, 1, "  store_swap_size = " << Store::Root().currentSize() / 1024.0 << " KB");
 -        StoreController::store_dirs_rebuilding--;
 +        --StoreController::store_dirs_rebuilding;
          assert(0 == StoreController::store_dirs_rebuilding);
  
-         if (opt_store_doublecheck)
-             assert(store_errors == 0);
+         if (opt_store_doublecheck && store_errors) {
+             fatalf("Quitting after finding %d cache index inconsistencies. " \
+                    "Removing cache index will force its slow rebuild. " \
+                    "Removing -S will let Squid start with an inconsistent " \
+                    "cache index (at your own risk).\n", store_errors);
+         }
  
          if (store_digest)
              storeDigestNoteStoreReady();
diff --cc src/tunnel.cc
Simple merge
diff --cc src/wccp2.cc
Simple merge