From: Francesco Chemolli Date: Mon, 3 Aug 2015 10:40:17 +0000 (+0200) Subject: Removed HttpHeaderFieldInfo and related methods X-Git-Tag: merge-candidate-3-v1~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b73241dd2910714b1e84bf32de745ffac8ebde0;p=thirdparty%2Fsquid.git Removed HttpHeaderFieldInfo and related methods --- diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index bdf556cb01..9763f4c5c3 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -1726,23 +1726,6 @@ httpHeaderStoreReport(StoreEntry * e) storeAppendPrintf(e, "Hdr Fields Parsed: %d\n", HeaderEntryParsedCount); } -// (ab)used by other modules. -http_hdr_type -httpHeaderIdByName(const char *name, size_t name_len, const HttpHeaderFieldInfo * info, int end) -{ - if (name_len > 0) { - for (int i = 0; i < end; ++i) { - if (name_len != info[i].name.size()) - continue; - - if (!strncasecmp(name, info[i].name.rawBuf(), name_len)) - return info[i].id; - } - } - - return HDR_BAD_HDR; -} - http_hdr_type httpHeaderIdByNameDef(const SBuf &name) { diff --git a/src/HttpHeader.h b/src/HttpHeader.h index 5ac12e3e7f..a79467c06b 100644 --- a/src/HttpHeader.h +++ b/src/HttpHeader.h @@ -40,23 +40,6 @@ typedef enum { hoEnd } http_hdr_owner_type; -class HttpHeaderFieldAttrs -{ -public: - HttpHeaderFieldAttrs() : name(NULL), id(HDR_BAD_HDR), type(field_type::ftInvalid) {} - HttpHeaderFieldAttrs(const char *aName, http_hdr_type anId, field_type aType = field_type::ftInvalid) : name(aName), id(anId), type(aType) {} -#if __cplusplus >= 201103L - HttpHeaderFieldAttrs(const HttpHeaderFieldAttrs &) = default; - HttpHeaderFieldAttrs(HttpHeaderFieldAttrs &&) = default; -#endif - // nothing to do as name is a pointer to global const string - ~HttpHeaderFieldAttrs() {} - - const char *name; - http_hdr_type id; - field_type type; -}; - /** Iteration for headers; use HttpHeaderPos as opaque type, do not interpret */ typedef ssize_t HttpHeaderPos; diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 1083bdfb49..f5a97998f9 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -39,44 +39,6 @@ static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs); -HttpHeaderFieldInfo * -httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count) -{ - int i; - HttpHeaderFieldInfo *table = NULL; - assert(attrs && count); - - /* allocate space */ - table = new HttpHeaderFieldInfo[count]; - - for (i = 0; i < count; ++i) { - const http_hdr_type id = attrs[i].id; - HttpHeaderFieldInfo *info = table + id; - /* sanity checks */ - assert(id >= 0 && id < count); - assert(attrs[i].name); - assert(info->id == HDR_ACCEPT && info->type == field_type::ftInvalid); /* was not set before */ - /* copy and init fields */ - info->id = id; - info->type = attrs[i].type; - info->name = attrs[i].name; - assert(info->name.size()); - } - - return table; -} - -void -httpHeaderDestroyFieldsInfo(HttpHeaderFieldInfo * table, int count) -{ - int i; - - for (i = 0; i < count; ++i) - table[i].name.clean(); - - delete [] table; -} - void httpHeaderMaskInit(HttpHeaderMask * mask, int value) { diff --git a/src/HttpHeaderTools.h b/src/HttpHeaderTools.h index a12d9ca1bd..94a253d210 100644 --- a/src/HttpHeaderTools.h +++ b/src/HttpHeaderTools.h @@ -115,9 +115,6 @@ public: int httpHeaderParseOffset(const char *start, int64_t * off); -HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count); -void httpHeaderDestroyFieldsInfo(HttpHeaderFieldInfo * info, int count); -http_hdr_type httpHeaderIdByName(const char *name, size_t name_len, const HttpHeaderFieldInfo * attrs, int end); http_hdr_type httpHeaderIdByNameDef(const SBuf &name); http_hdr_type httpHeaderIdByNameDef(const char *name, int name_len); int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive);