--------------------- PatchSet 10432 Date: 2008/01/25 08:34:11 Author: adri Branch: s27_adri Tag: (none) Log: Add in a c string version of the http header deletion function, used (atm) inside the NTLM authentication code. Members: src/HttpHeader.c:1.28.6.1.4.27->1.28.6.1.4.28 src/protos.h:1.146.2.4.4.42->1.146.2.4.4.43 Index: squid/src/HttpHeader.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeader.c,v retrieving revision 1.28.6.1.4.27 retrieving revision 1.28.6.1.4.28 diff -u -r1.28.6.1.4.27 -r1.28.6.1.4.28 --- squid/src/HttpHeader.c 21 Jan 2008 03:36:14 -0000 1.28.6.1.4.27 +++ squid/src/HttpHeader.c 25 Jan 2008 08:34:11 -0000 1.28.6.1.4.28 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.c,v 1.28.6.1.4.27 2008/01/21 03:36:14 adri Exp $ + * $Id: HttpHeader.c,v 1.28.6.1.4.28 2008/01/25 08:34:11 adri Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -661,6 +661,28 @@ return count; } +/* + * Deletes all fields with a given name if any, returns #fields deleted; + * XXX this should really be emerged with httpHeaderDelByName() + */ +int +httpHeaderDelByNameCstr(HttpHeader *hdr, const char *name) +{ + int count = 0; + HttpHeaderPos pos = HttpHeaderInitPos; + HttpHeaderEntry *e; + httpHeaderMaskInit(&hdr->mask, 0); /* temporal inconsistency */ + debug(55, 7) ("deleting '%s' fields in hdr %p\n", name, hdr); + while ((e = httpHeaderGetEntry(hdr, &pos))) { + if (!strCaseCmp(e->name, name)) { + httpHeaderDelAt(hdr, pos); + count++; + } else + CBIT_SET(hdr->mask, e->id); + } + return count; +} + /* deletes all entries with a given id, returns the #entries deleted */ int httpHeaderDelById(HttpHeader * hdr, http_hdr_type id) Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.146.2.4.4.42 retrieving revision 1.146.2.4.4.43 diff -u -r1.146.2.4.4.42 -r1.146.2.4.4.43 --- squid/src/protos.h 21 Jan 2008 12:53:46 -0000 1.146.2.4.4.42 +++ squid/src/protos.h 25 Jan 2008 08:34:11 -0000 1.146.2.4.4.43 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.146.2.4.4.42 2008/01/21 12:53:46 adri Exp $ + * $Id: protos.h,v 1.146.2.4.4.43 2008/01/25 08:34:11 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -457,6 +457,7 @@ extern String httpHeaderGetListMember(const HttpHeader * hdr, http_hdr_type id, const char *member, const char separator); extern String httpHeaderGetByNameListMember(const HttpHeader * hdr, const char *name, const char *member, const char separator); extern int httpHeaderDelByName(HttpHeader * hdr, String name); +extern int httpHeaderDelByNameCstr(HttpHeader *hdr, const char *name); extern int httpHeaderDelById(HttpHeader * hdr, http_hdr_type id); extern void httpHeaderDelAt(HttpHeader * hdr, HttpHeaderPos pos); extern void httpHeaderRefreshMask(HttpHeader * hdr); @@ -1446,5 +1447,6 @@ extern void stringDictInit(void); extern void stringDictAdd(int id, const char *str); extern String stringDictGet(int id); +extern void stringDictHostname(void); #endif /* SQUID_PROTOS_H */