/*
- * $Id: HttpHeaderTools.cc,v 1.11 1998/05/11 18:44:27 rousskov Exp $
+ * $Id: HttpHeaderTools.cc,v 1.12 1998/05/21 00:57:35 rousskov Exp $
*
* DEBUG: section 66 HTTP Header Tools
* AUTHOR: Alex Rousskov
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)
+{
+ const char *pos = NULL;
+ const char *item;
+ assert(list && s);
+ while (strListGetItem(list, del, &item, NULL, &pos)) {
+ if (strstr(item, s))
+ return 1;
+ }
+ return 0;
+}
+
/* appends an item to the list */
void
strListAdd(String *str, const char *item, char del)
/*
- * $Id: client_side.cc,v 1.309 1998/05/20 22:07:08 wessels Exp $
+ * $Id: client_side.cc,v 1.310 1998/05/21 00:57:36 rousskov Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
#endif
if (httpHeaderHas(req_hdr, HDR_VIA)) {
String s = httpHeaderGetList(req_hdr, HDR_VIA);
- if (strListIsMember(&s, ThisCache, ',')) {
+ /* ThisCache cannot be a member of Via header, "1.0 ThisCache" can */
+ if (strListIsSubstr(&s, ThisCache, ',')) {
if (!http->flags.accel) {
debug(33, 1) ("WARNING: Forwarding loop detected for '%s'\n",
http->uri);