#include "HttpHdrCc.h"
#include "StatHist.h"
#include "Store.h"
+#include "StrList.h"
#include "protos.h"
#if HAVE_MAP
#include "HttpHeaderRange.h"
#include "client_side_request.h"
#include "HttpReply.h"
+#include "StrList.h"
#include "protos.h"
/*
#include "HttpHeaderStat.h"
#include "HttpHeaderTools.h"
#include "Store.h"
+#include "StrList.h"
#include "protos.h"
#if HAVE_MAP
#include "rfc1123.h"
#include "StatHist.h"
#include "Store.h"
+#include "StrList.h"
#include "TimeOrTag.h"
/*
#include "MemBuf.h"
#include "protos.h"
#include "Store.h"
+#include "StrList.h"
#if USE_SSL
#include "ssl/support.h"
return res;
}
-/** returns true iff "m" is a member of the list */
-int
-strListIsMember(const String * list, const char *m, char del)
-{
- const char *pos = NULL;
- const char *item;
- int ilen = 0;
- int mlen;
- assert(list && m);
- mlen = strlen(m);
-
- while (strListGetItem(list, del, &item, &ilen, &pos)) {
- if (mlen == ilen && !strncasecmp(item, m, ilen))
- return 1;
- }
-
- return 0;
-}
-
-/** returns true iff "s" is a substring of a member of the list */
-int
-strListIsSubstr(const String * list, const char *s, char del)
-{
- assert(list && del);
- return (list->find(s) != String::npos);
-
- /** \note
- * Note: the original code with a loop is broken because it uses strstr()
- * instead of strnstr(). If 's' contains a 'del', strListIsSubstr() may
- * return true when it should not. If 's' does not contain a 'del', the
- * implementaion is equavalent to strstr()! Thus, we replace the loop with
- * strstr() above until strnstr() is available.
- */
-}
-
-/** appends an item to the list */
-void
-strListAdd(String * str, const char *item, char del)
-{
- assert(str && item);
-
- if (str->size()) {
- char buf[3];
- buf[0] = del;
- buf[1] = ' ';
- buf[2] = '\0';
- str->append(buf, 2);
- }
-
- str->append(item, strlen(item));
-}
-/**
- * iterates through a 0-terminated string of items separated by 'del's.
- * white space around 'del' is considered to be a part of 'del'
- * like strtok, but preserves the source, and can iterate several strings at once
- *
- * returns true if next item is found.
- * init pos with NULL to start iteration.
- */
-int
-strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos)
-{
- size_t len;
- /* ',' is always enabled as field delimiter as this is required for
- * processing merged header values properly, even if Cookie normally
- * uses ';' as delimiter.
- */
- static char delim[3][8] = {
- "\"?,",
- "\"\\",
- " ?,\t\r\n"
- };
- int quoted = 0;
- assert(str && item && pos);
-
- delim[0][1] = del;
- delim[2][1] = del;
-
- if (!*pos) {
- *pos = str->termedBuf();
-
- if (!*pos)
- return 0;
- }
-
- /* skip leading whitespace and delimiters */
- *pos += strspn(*pos, delim[2]);
-
- *item = *pos; /* remember item's start */
-
- /* find next delimiter */
- do {
- *pos += strcspn(*pos, delim[quoted]);
- if (**pos == '"') {
- quoted = !quoted;
- *pos += 1;
- } else if (quoted && **pos == '\\') {
- *pos += 1;
- if (**pos)
- *pos += 1;
- } else {
- break; /* Delimiter found, marking the end of this value */
- }
- } while (**pos);
-
- len = *pos - *item; /* *pos points to del or '\0' */
-
- /* rtrim */
- while (len > 0 && xisspace((*item)[len - 1]))
- --len;
-
- if (ilen)
- *ilen = len;
-
- return len > 0;
-}
/** handy to printf prefixes of potentially very long buffers */
const char *
#include "protos.h"
#include "SquidTime.h"
#include "Store.h"
+#include "StrList.h"
/* local constants */
StatHist.h \
StatHist.cc \
String.cc \
+ StrList.h \
+ StrList.cc \
stmem.cc \
stmem.h \
store.cc \
SquidString.h \
SquidTime.h \
String.cc \
+ StrList.h \
+ StrList.cc \
log/access_log.h \
tests/stub_access_log.cc \
cache_cf.h \
StatCounters.cc \
StatCounters.h \
StatHist.h \
+ StrList.h \
+ StrList.cc \
tests/stub_StatHist.cc \
stmem.cc \
String.cc \
StatCounters.h \
StatCounters.cc \
StatHist.h \
+ StrList.h \
+ StrList.cc \
tests/stub_StatHist.cc \
stmem.cc \
store.cc \
store_swapmeta.cc \
store.cc \
String.cc \
+ StrList.h \
+ StrList.cc \
SwapDir.cc \
log/access_log.h \
tests/stub_access_log.cc \
refresh.cc \
RemovalPolicy.cc \
Server.cc \
+ StrList.h \
+ StrList.cc \
$(SNMP_SOURCE) \
SquidMath.cc \
SquidMath.h \
StoreMetaVary.cc \
StoreSwapLogData.cc \
String.cc \
+ StrList.h \
+ StrList.cc \
SwapDir.cc \
tests/testEventLoop.cc \
tests/testEventLoop.h \
StoreMetaVary.cc \
StoreSwapLogData.cc \
String.cc \
+ StrList.h \
+ StrList.cc \
SwapDir.cc \
tests/test_http_range.cc \
tests/stub_ipc_Forwarder.cc \
StoreMetaURL.cc \
StoreMetaVary.cc \
StoreSwapLogData.cc \
+ StrList.h \
+ StrList.cc \
event.cc \
tools.h \
tools.cc \
store_key_md5.h \
store_key_md5.cc \
String.cc \
+ StrList.h \
+ StrList.cc \
SwapDir.cc \
tests/CapturingStoreEntry.h \
log/access_log.h \
StatCounters.cc \
StatHist.h \
StatHist.cc \
+ StrList.h \
+ StrList.cc \
HttpHdrRange.cc \
ETag.cc \
tests/stub_errorpage.cc \
store_swapmeta.cc \
store_swapout.cc \
String.cc \
+ StrList.h \
+ StrList.cc \
SwapDir.cc \
tests/testRock.cc \
tests/testMain.cc \
StoreMetaVary.cc \
StoreSwapLogData.cc \
String.cc \
+ StrList.h \
+ StrList.cc \
SwapDir.cc \
MemStore.cc \
tests/stub_debug.cc \
--- /dev/null
+/*
+ * DEBUG: section 66 HTTP Header Tools
+ * AUTHOR: Alex Rousskov
+ *
+ * SQUID Web Proxy Cache http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ * Squid is the result of efforts by numerous individuals from
+ * the Internet community; see the CONTRIBUTORS file for full
+ * details. Many organizations have provided support for Squid's
+ * development; see the SPONSORS file for full details. Squid is
+ * Copyrighted (C) 2001 by the Regents of the University of
+ * California; see the COPYRIGHT file for full details. Squid
+ * incorporates software developed and/or copyrighted by other
+ * sources; see the CREDITS file for full details.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "squid.h"
+#include "SquidString.h"
+#include "StrList.h"
+
+/** appends an item to the list */
+void
+strListAdd(String * str, const char *item, char del)
+{
+ assert(str && item);
+ if (str->size()) {
+ char buf[3];
+ buf[0] = del;
+ buf[1] = ' ';
+ buf[2] = '\0';
+ str->append(buf, 2);
+ }
+ str->append(item, strlen(item));
+}
+
+/** returns true iff "m" is a member of the list */
+int
+strListIsMember(const String * list, const char *m, char del)
+{
+ const char *pos = NULL;
+ const char *item;
+ int ilen = 0;
+ int mlen;
+
+ assert(list && m);
+ mlen = strlen(m);
+ while (strListGetItem(list, del, &item, &ilen, &pos)) {
+ if (mlen == ilen && !strncasecmp(item, m, ilen))
+ return 1;
+ }
+ return 0;
+}
+
+/** returns true iff "s" is a substring of a member of the list */
+int
+strListIsSubstr(const String * list, const char *s, char del)
+{
+ assert(list && del);
+ return (list->find(s) != String::npos);
+
+ /** \note
+ * Note: the original code with a loop is broken because it uses strstr()
+ * instead of strnstr(). If 's' contains a 'del', strListIsSubstr() may
+ * return true when it should not. If 's' does not contain a 'del', the
+ * implementaion is equavalent to strstr()! Thus, we replace the loop with
+ * strstr() above until strnstr() is available.
+ */
+}
+
+/**
+ * iterates through a 0-terminated string of items separated by 'del's.
+ * white space around 'del' is considered to be a part of 'del'
+ * like strtok, but preserves the source, and can iterate several strings at once
+ *
+ * returns true if next item is found.
+ * init pos with NULL to start iteration.
+ */
+int
+strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos)
+{
+ size_t len;
+ /* ',' is always enabled as field delimiter as this is required for
+ * processing merged header values properly, even if Cookie normally
+ * uses ';' as delimiter.
+ */
+ static char delim[3][8] = {
+ "\"?,",
+ "\"\\",
+ " ?,\t\r\n"
+ };
+ int quoted = 0;
+ assert(str && item && pos);
+
+ delim[0][1] = del;
+ delim[2][1] = del;
+
+ if (!*pos) {
+ *pos = str->termedBuf();
+
+ if (!*pos)
+ return 0;
+ }
+
+ /* skip leading whitespace and delimiters */
+ *pos += strspn(*pos, delim[2]);
+
+ *item = *pos; /* remember item's start */
+
+ /* find next delimiter */
+ do {
+ *pos += strcspn(*pos, delim[quoted]);
+ if (**pos == '"') {
+ quoted = !quoted;
+ *pos += 1;
+ } else if (quoted && **pos == '\\') {
+ *pos += 1;
+ if (**pos)
+ *pos += 1;
+ } else {
+ break; /* Delimiter found, marking the end of this value */
+ }
+ } while (**pos);
+
+ len = *pos - *item; /* *pos points to del or '\0' */
+
+ /* rtrim */
+ while (len > 0 && xisspace((*item)[len - 1]))
+ --len;
+
+ if (ilen)
+ *ilen = len;
+
+ return len > 0;
+}
+
--- /dev/null
+/*
+ * DEBUG: section 66 HTTP Header Tools
+ * AUTHOR: Alex Rousskov
+ *
+ * SQUID Web Proxy Cache http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ * Squid is the result of efforts by numerous individuals from
+ * the Internet community; see the CONTRIBUTORS file for full
+ * details. Many organizations have provided support for Squid's
+ * development; see the SPONSORS file for full details. Squid is
+ * Copyrighted (C) 2001 by the Regents of the University of
+ * California; see the COPYRIGHT file for full details. Squid
+ * incorporates software developed and/or copyrighted by other
+ * sources; see the CREDITS file for full details.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#ifndef SQUID_STRLIST_H_
+#define SQUID_STRLIST_H_
+
+class String;
+
+extern void strListAdd(String * str, const char *item, char del);
+extern int strListIsMember(const String * str, const char *item, char del);
+extern int strListIsSubstr(const String * list, const char *s, char del);
+extern int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos);
+
+#endif /* SQUID_STRLIST_H_ */
#include "ConfigParser.h"
#include "Debug.h"
#include "protos.h"
+#include "StrList.h"
#include "wordlist.h"
Adaptation::ServiceGroup::ServiceGroup(const String &aKind, bool allSame):
#include "HttpReply.h"
#include "protos.h"
#include "SquidTime.h"
+#include "StrList.h"
#include "wordlist.h"
Adaptation::Icap::Options::Options(): error("unconfigured"),
#include "protos.h"
#include "wordlist.h"
#include "SquidTime.h"
+#include "StrList.h"
/* Digest Scheme */
#include "SquidTime.h"
#include "Store.h"
#include "StoreClient.h"
+#include "StrList.h"
#include "tools.h"
#include "URL.h"
#if USE_AUTH
#include "protos.h"
#include "SquidTime.h"
#include "Store.h"
+#include "StrList.h"
#include "tools.h"
#include "URL.h"
#include "wordlist.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
+#include "StrList.h"
#include "tools.h"
#include "URL.h"
}
// if no external user credentials are available to fake authentication with PASS acts like PASSTHRU
if (strcmp(request->peer_login, "PASS") == 0)
- continue;
+ return;
/* Kerberos login to peer */
#if HAVE_AUTH_MODULE_NEGOTIATE && HAVE_KRB5 && HAVE_GSSAPI
class HttpRequest;
class HttpReply;
-/* TODO: move to StrList.h */
-SQUIDCEXTERN void strListAdd(String * str, const char *item, char del);
-SQUIDCEXTERN int strListIsMember(const String * str, const char *item, char del);
-SQUIDCEXTERN int strListIsSubstr(const String * list, const char *s, char del);
-SQUIDCEXTERN int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos);
extern const char *getStringPrefix(const char *str, const char *end);
#include "store_key_md5.h"
#include "StoreIOState.h"
#include "StoreMeta.h"
+#include "StrList.h"
#include "store_key_md5.h"
#include "SwapDir.h"
#include "swap_log_op.h"