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);
}
/// 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;
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;
// 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);
}
#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);
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 */
}
}
+ 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;
}
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();