--------------------- PatchSet 2989 Date: 2001/09/09 12:17:06 Author: serassio Branch: nt-2_3-tolsty Tag: (none) Log: Fixed indent problems Members: src/HttpHdrCc.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/HttpHdrContRange.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/HttpHdrExtField.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/HttpHdrRange.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/HttpHeader.c:1.1.1.3.4.2.2.1.2.1->1.1.1.3.4.2.2.1.2.2 src/HttpHeaderTools.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/HttpMsg.c:1.1.1.1.4.1.2.1.2.1->1.1.1.1.4.1.2.1.2.2 src/HttpReply.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/HttpRequest.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/HttpStatusLine.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/internal.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 Index: squid/src/HttpHdrCc.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrCc.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpHdrCc.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpHdrCc.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpHdrCc.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpHdrCc.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 65 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -35,7 +36,8 @@ #include "squid.h" /* this table is used for parsing cache control header */ -static const HttpHeaderFieldAttrs CcAttrs[CC_ENUM_END] = { +static const HttpHeaderFieldAttrs CcAttrs[CC_ENUM_END] = +{ {"public", CC_PUBLIC}, {"private", CC_PRIVATE}, {"no-cache", CC_NO_CACHE}, @@ -108,20 +110,15 @@ if ((p = strchr(item, '=')) && (p - item < ilen)) ilen = p++ - item; /* find type */ - type = httpHeaderIdByName(item, ilen, CcFieldsInfo, CC_ENUM_END); + type = httpHeaderIdByName(item, ilen, + CcFieldsInfo, CC_ENUM_END); if (type < 0) { - debug(65, - 2) ("hdr cc: unknown cache-directive: near '%s' in '%s'\n", - item, strBuf(*str)); + debug(65, 2) ("hdr cc: unknown cache-directive: near '%s' in '%s'\n", item, strBuf(*str)); type = CC_OTHER; } if (EBIT_TEST(cc->mask, type)) { if (type != CC_OTHER) - debug(65, 2) - - - ("hdr cc: ignoring duplicate cache-directive: near '%s' in '%s'\n", - item, strBuf(*str)); + debug(65, 2) ("hdr cc: ignoring duplicate cache-directive: near '%s' in '%s'\n", item, strBuf(*str)); CcFieldsInfo[type].stat.repCount++; continue; } @@ -180,8 +177,7 @@ if (EBIT_TEST(cc->mask, flag) && flag != CC_OTHER) { /* print option name */ - packerPrintf(p, (pcount ? ", %s" : "%s"), - strBuf(CcFieldsInfo[flag].name)); + packerPrintf(p, (pcount ? ", %s" : "%s"), strBuf(CcFieldsInfo[flag].name)); /* handle options with values */ if (flag == CC_MAX_AGE) @@ -241,8 +237,7 @@ } void -httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, - int count) +httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count) { extern const HttpHeaderStat *dump_stat; /* argh! */ const int id = (int) val; Index: squid/src/HttpHdrContRange.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrContRange.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpHdrContRange.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpHdrContRange.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpHdrContRange.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpHdrContRange.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 68 HTTP Content-Range Header * AUTHOR: Alex Rousskov @@ -59,8 +60,7 @@ /* parses range-resp-spec and inits spec, returns true on success */ static int -httpHdrRangeRespSpecParseInit(HttpHdrRangeSpec * spec, const char *field, - int flen) +httpHdrRangeRespSpecParseInit(HttpHdrRangeSpec * spec, const char *field, int flen) { const char *p; assert(spec); @@ -88,8 +88,7 @@ } /* we managed to parse, check if the result makes sence */ if (known_spec(spec->length) && !spec->length) { - debug(68, - 2) ("invalid range (%d += %d) in resp-range-spec near: '%s'\n", + debug(68, 2) ("invalid range (%d += %d) in resp-range-spec near: '%s'\n", spec->offset, spec->length, field); return 0; } @@ -188,8 +187,7 @@ } void -httpHdrContRangeSet(HttpHdrContRange * cr, HttpHdrRangeSpec spec, - ssize_t ent_len) +httpHdrContRangeSet(HttpHdrContRange * cr, HttpHdrRangeSpec spec, ssize_t ent_len) { assert(cr && ent_len >= 0); cr->spec = spec; Index: squid/src/HttpHdrExtField.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrExtField.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpHdrExtField.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpHdrExtField.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpHdrExtField.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpHdrExtField.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 69 HTTP Header: Extension Field * AUTHOR: Alex Rousskov @@ -35,8 +36,7 @@ #include "squid.h" /* local prototypes */ -static HttpHdrExtField *httpHdrExtFieldDoCreate(const char *name, int name_len, - const char *value, int val_len); +static HttpHdrExtField *httpHdrExtFieldDoCreate(const char *name, int name_len, const char *value, int val_len); /* implementation */ @@ -54,7 +54,9 @@ HttpHdrExtField * httpHdrExtFieldCreate(const char *name, const char *value) { - return httpHdrExtFieldDoCreate(name, strlen(name), value, strlen(value)); + return httpHdrExtFieldDoCreate( + name, strlen(name), + value, strlen(value)); } /* parses ext field; returns fresh ext field on success and NULL on failure */ @@ -74,7 +76,8 @@ while (value_start < field_end && xisspace(*value_start)) value_start++; - return httpHdrExtFieldDoCreate(field_start, name_end - field_start, + return httpHdrExtFieldDoCreate( + field_start, name_end - field_start, value_start, field_end - value_start); } @@ -91,6 +94,7 @@ httpHdrExtFieldDup(HttpHdrExtField * f) { assert(f); - return httpHdrExtFieldDoCreate(strBuf(f->name), strLen(f->name), + return httpHdrExtFieldDoCreate( + strBuf(f->name), strLen(f->name), strBuf(f->value), strLen(f->value)); } Index: squid/src/HttpHdrRange.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrRange.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpHdrRange.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpHdrRange.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpHdrRange.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpHdrRange.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -81,7 +82,8 @@ static HttpHdrRangeSpec * httpHdrRangeSpecParseCreate(const char *field, int flen) { - HttpHdrRangeSpec spec = { range_spec_unknown, range_spec_unknown }; + HttpHdrRangeSpec spec = + {range_spec_unknown, range_spec_unknown}; const char *p; if (flen < 2) return NULL; @@ -92,8 +94,7 @@ } else /* must have a '-' somewhere in _this_ field */ if (!((p = strchr(field, '-')) || (p - field >= flen))) { - debug(64, 2) ("ignoring invalid (missing '-') range-spec near: '%s'\n", - field); + debug(64, 2) ("ignoring invalid (missing '-') range-spec near: '%s'\n", field); return NULL; } else { if (!httpHeaderParseSize(field, &spec.offset)) @@ -109,8 +110,7 @@ } /* we managed to parse, check if the result makes sence */ if (known_spec(spec.length) && !spec.length) { - debug(64, 2) ("ignoring invalid (zero length) range-spec near: '%s'\n", - field); + debug(64, 2) ("ignoring invalid (zero length) range-spec near: '%s'\n", field); return NULL; } return httpHdrRangeSpecDup(&spec); @@ -137,10 +137,11 @@ { if (!known_spec(spec->offset)) /* suffix */ packerPrintf(p, "-%d", spec->length); - else if (!known_spec(spec->length)) /* trailer */ + else if (!known_spec(spec->length)) /* trailer */ packerPrintf(p, "%d-", spec->offset); else /* range */ - packerPrintf(p, "%d-%d", spec->offset, spec->offset + spec->length - 1); + packerPrintf(p, "%d-%d", + spec->offset, spec->offset + spec->length - 1); } /* fills "absent" positions in range specification based on response body size @@ -154,7 +155,7 @@ spec->offset, spec->offset + spec->length, spec->length); if (!known_spec(spec->offset)) /* suffix */ spec->offset = size_diff(clen, spec->length); - else if (!known_spec(spec->length)) /* trailer */ + else if (!known_spec(spec->length)) /* trailer */ spec->length = size_diff(clen, spec->offset); /* we have a "range" now, adjust length if needed */ assert(known_spec(spec->length)); @@ -169,13 +170,12 @@ /* merges recepient with donor if possible; returns true on success * both specs must be canonized prior to merger, of course */ static int -httpHdrRangeSpecMergeWith(HttpHdrRangeSpec * recep, - const HttpHdrRangeSpec * donor) +httpHdrRangeSpecMergeWith(HttpHdrRangeSpec * recep, const HttpHdrRangeSpec * donor) { int merged = 0; #if MERGING_BREAKS_NOTHING /* Note: this code works, but some clients may not like its effects */ - size_t rhs = recep->offset + recep->length; /* no -1 ! */ + size_t rhs = recep->offset + recep->length; /* no -1 ! */ const size_t donor_rhs = donor->offset + donor->length; /* no -1 ! */ assert(known_spec(recep->offset)); assert(known_spec(donor->offset)); @@ -197,7 +197,8 @@ recep->length = rhs - recep->offset; } else { /* does recepient contain donor? */ - merged = recep->offset <= donor->offset && donor->offset < rhs; + merged = + recep->offset <= donor->offset && donor->offset < rhs; } #endif return merged; @@ -311,8 +312,7 @@ assert(range); assert(clen >= 0); stackInit(&goods); - debug(64, 3) ("httpHdrRangeCanonize: started with %d specs, clen: %d\n", - range->specs.count, clen); + debug(64, 3) ("httpHdrRangeCanonize: started with %d specs, clen: %d\n", range->specs.count, clen); /* canonize each entry and destroy bad ones if any */ while ((spec = httpHdrRangeGetSpec(range, &pos))) { @@ -415,7 +415,8 @@ * Returns lowest known offset in range spec(s), or range_spec_unknown * this is used for size limiting */ -ssize_t httpHdrRangeFirstOffset(const HttpHdrRange * range) +ssize_t +httpHdrRangeFirstOffset(const HttpHdrRange * range) { ssize_t offset = range_spec_unknown; HttpHdrRangePos pos = HttpHdrRangeInitPos; @@ -434,7 +435,8 @@ * ranges are combined into one, for example FTP REST. * Use 0 for size if unknown */ -ssize_t httpHdrRangeLowestOffset(const HttpHdrRange * range, ssize_t size) +ssize_t +httpHdrRangeLowestOffset(const HttpHdrRange * range, ssize_t size) { ssize_t offset = range_spec_unknown; ssize_t current; @@ -457,7 +459,8 @@ /* generates a "unique" boundary string for multipart responses * the caller is responsible for cleaning the string */ -String httpHdrRangeBoundaryStr(clientHttpRequest * http) +String +httpHdrRangeBoundaryStr(clientHttpRequest * http) { const char *key; String b = StringNull; Index: squid/src/HttpHeader.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeader.c,v retrieving revision 1.1.1.3.4.2.2.1.2.1 retrieving revision 1.1.1.3.4.2.2.1.2.2 diff -u -r1.1.1.3.4.2.2.1.2.1 -r1.1.1.3.4.2.2.1.2.2 --- squid/src/HttpHeader.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.2.2.1.2.1 +++ squid/src/HttpHeader.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.2.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpHeader.c,v 1.1.1.3.4.2.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpHeader.c,v 1.1.1.3.4.2.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -63,7 +64,8 @@ * We calculate name lengths and reorganize this array on start up. * After reorganization, field id can be used as an index to the table. */ -static const HttpHeaderFieldAttrs HeadersAttrs[] = { +static const HttpHeaderFieldAttrs HeadersAttrs[] = +{ {"Accept", HDR_ACCEPT, ftStr}, {"Accept-Charset", HDR_ACCEPT_CHARSET, ftStr}, {"Accept-Encoding", HDR_ACCEPT_ENCODING, ftStr}, @@ -129,7 +131,8 @@ * Headers that are currently not recognized, are commented out. */ static HttpHeaderMask ListHeadersMask; /* set run-time using ListHeadersArr */ -static http_hdr_type ListHeadersArr[] = { +static http_hdr_type ListHeadersArr[] = +{ HDR_ACCEPT, HDR_ACCEPT_CHARSET, HDR_ACCEPT_ENCODING, HDR_ACCEPT_LANGUAGE, HDR_ACCEPT_RANGES, HDR_ALLOW, @@ -151,7 +154,8 @@ }; /* general-headers */ -static http_hdr_type GeneralHeadersArr[] = { +static http_hdr_type GeneralHeadersArr[] = +{ HDR_CACHE_CONTROL, HDR_CONNECTION, HDR_DATE, HDR_PRAGMA, /* HDR_TRANSFER_ENCODING, */ HDR_UPGRADE, @@ -160,16 +164,17 @@ }; /* entity-headers */ -static http_hdr_type EntityHeadersArr[] = { +static http_hdr_type EntityHeadersArr[] = +{ HDR_ALLOW, HDR_CONTENT_BASE, HDR_CONTENT_ENCODING, HDR_CONTENT_LANGUAGE, HDR_CONTENT_LENGTH, HDR_CONTENT_LOCATION, HDR_CONTENT_MD5, - HDR_CONTENT_RANGE, HDR_CONTENT_TYPE, HDR_ETAG, HDR_EXPIRES, - HDR_LAST_MODIFIED, HDR_LINK, + HDR_CONTENT_RANGE, HDR_CONTENT_TYPE, HDR_ETAG, HDR_EXPIRES, HDR_LAST_MODIFIED, HDR_LINK, HDR_OTHER }; -static HttpHeaderMask ReplyHeadersMask; /* set run-time using ReplyHeaders */ -static http_hdr_type ReplyHeadersArr[] = { +static HttpHeaderMask ReplyHeadersMask; /* set run-time using ReplyHeaders */ +static http_hdr_type ReplyHeadersArr[] = +{ HDR_ACCEPT, HDR_ACCEPT_CHARSET, HDR_ACCEPT_ENCODING, HDR_ACCEPT_LANGUAGE, HDR_ACCEPT_RANGES, HDR_AGE, HDR_LOCATION, HDR_MAX_FORWARDS, @@ -182,7 +187,8 @@ }; static HttpHeaderMask RequestHeadersMask; /* set run-time using RequestHeaders */ -static http_hdr_type RequestHeadersArr[] = { +static http_hdr_type RequestHeadersArr[] = +{ HDR_AUTHORIZATION, HDR_FROM, HDR_HOST, HDR_IF_MATCH, HDR_IF_MODIFIED_SINCE, HDR_IF_NONE_MATCH, HDR_IF_RANGE, HDR_MAX_FORWARDS, HDR_PROXY_CONNECTION, @@ -191,7 +197,8 @@ }; /* header accounting */ -static HttpHeaderStat HttpHeaderStats[] = { +static HttpHeaderStat HttpHeaderStats[] = +{ {"all"}, #if USE_HTCP {"HTCP reply"}, @@ -209,13 +216,10 @@ #define assert_eid(id) assert((id) >= 0 && (id) < HDR_ENUM_END) -static HttpHeaderEntry *httpHeaderEntryCreate(http_hdr_type id, - const char *name, const char *value); +static HttpHeaderEntry *httpHeaderEntryCreate(http_hdr_type id, const char *name, const char *value); static void httpHeaderEntryDestroy(HttpHeaderEntry * e); -static HttpHeaderEntry *httpHeaderEntryParseCreate(const char *field_start, - const char *field_end); -static void httpHeaderNoteParsedEntry(http_hdr_type id, String value, - int error); +static HttpHeaderEntry *httpHeaderEntryParseCreate(const char *field_start, const char *field_end); +static void httpHeaderNoteParsedEntry(http_hdr_type id, String value, int error); static void httpHeaderStatInit(HttpHeaderStat * hs, const char *label); static void httpHeaderStatDump(const HttpHeaderStat * hs, StoreEntry * e); @@ -236,22 +240,15 @@ Headers = httpHeaderBuildFieldsInfo(HeadersAttrs, HDR_ENUM_END); /* create masks */ httpHeaderMaskInit(&ListHeadersMask, 0); - httpHeaderCalcMask(&ListHeadersMask, (const int *) ListHeadersArr, - countof(ListHeadersArr)); + httpHeaderCalcMask(&ListHeadersMask, (const int *) ListHeadersArr, countof(ListHeadersArr)); httpHeaderMaskInit(&ReplyHeadersMask, 0); - httpHeaderCalcMask(&ReplyHeadersMask, (const int *) ReplyHeadersArr, - countof(ReplyHeadersArr)); - httpHeaderCalcMask(&ReplyHeadersMask, (const int *) GeneralHeadersArr, - countof(GeneralHeadersArr)); - httpHeaderCalcMask(&ReplyHeadersMask, (const int *) EntityHeadersArr, - countof(EntityHeadersArr)); + httpHeaderCalcMask(&ReplyHeadersMask, (const int *) ReplyHeadersArr, countof(ReplyHeadersArr)); + httpHeaderCalcMask(&ReplyHeadersMask, (const int *) GeneralHeadersArr, countof(GeneralHeadersArr)); + httpHeaderCalcMask(&ReplyHeadersMask, (const int *) EntityHeadersArr, countof(EntityHeadersArr)); httpHeaderMaskInit(&RequestHeadersMask, 0); - httpHeaderCalcMask(&RequestHeadersMask, (const int *) RequestHeadersArr, - countof(RequestHeadersArr)); - httpHeaderCalcMask(&RequestHeadersMask, (const int *) GeneralHeadersArr, - countof(GeneralHeadersArr)); - httpHeaderCalcMask(&RequestHeadersMask, (const int *) EntityHeadersArr, - countof(EntityHeadersArr)); + httpHeaderCalcMask(&RequestHeadersMask, (const int *) RequestHeadersArr, countof(RequestHeadersArr)); + httpHeaderCalcMask(&RequestHeadersMask, (const int *) GeneralHeadersArr, countof(GeneralHeadersArr)); + httpHeaderCalcMask(&RequestHeadersMask, (const int *) EntityHeadersArr, countof(EntityHeadersArr)); /* init header stats */ assert(HttpHeaderStatCount == hoReply + 1); for (i = 0; i < HttpHeaderStatCount; i++) @@ -313,15 +310,13 @@ assert(hdr->owner > hoNone && hdr->owner <= hoReply); debug(55, 7) ("cleaning hdr: %p owner: %d\n", hdr, hdr->owner); - statHistCount(&HttpHeaderStats[hdr->owner].hdrUCountDistr, - hdr->entries.count); + statHistCount(&HttpHeaderStats[hdr->owner].hdrUCountDistr, hdr->entries.count); HttpHeaderStats[hdr->owner].destroyedCount++; HttpHeaderStats[hdr->owner].busyDestroyedCount += hdr->entries.count > 0; while ((e = httpHeaderGetEntry(hdr, &pos))) { /* tmp hack to try to avoid coredumps */ if (e->id < 0 || e->id >= HDR_ENUM_END) { - debug(55, 0) - ("httpHeaderClean BUG: entry[%d] is invalid (%d). Ignored.\n", + debug(55, 0) ("httpHeaderClean BUG: entry[%d] is invalid (%d). Ignored.\n", pos, e->id); } else { statHistCount(&HttpHeaderStats[hdr->owner].fieldTypeDistr, e->id); @@ -349,8 +344,7 @@ /* use fresh entries to replace old ones */ void -httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, - const HttpHeaderMask * denied_mask) +httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, const HttpHeaderMask * denied_mask) { const HttpHeaderEntry *e; HttpHeaderPos pos = HttpHeaderInitPos; @@ -380,16 +374,14 @@ } int -httpHeaderParse(HttpHeader * hdr, const char *header_start, - const char *header_end) +httpHeaderParse(HttpHeader * hdr, const char *header_start, const char *header_end) { const char *field_start = header_start; HttpHeaderEntry *e; assert(hdr); assert(header_start && header_end); - debug(55, 7) ("parsing hdr: (%p)\n%s\n", hdr, getStringPrefix(header_start, - header_end)); + debug(55, 7) ("parsing hdr: (%p)\n%s\n", hdr, getStringPrefix(header_start, header_end)); HttpHeaderStats[hdr->owner].parsedCount++; /* commonn format headers are ":[ws]" lines delimited by */ while (field_start < header_end) { @@ -409,8 +401,7 @@ if (e != NULL) httpHeaderAddEntry(hdr, e); else - debug(55, 2) - ("warning: ignoring unparseable http header field near '%s'\n", + debug(55, 2) ("warning: ignoring unparseable http header field near '%s'\n", getStringPrefix(field_start, field_end)); field_start = field_end; /* skip CRLF */ @@ -584,7 +575,8 @@ } /* return a list of entries with the same id separated by ',' and ws */ -String httpHeaderGetList(const HttpHeader * hdr, http_hdr_type id) +String +httpHeaderGetList(const HttpHeader * hdr, http_hdr_type id) { String s = StringNull; HttpHeaderEntry *e; @@ -605,8 +597,7 @@ assert(strBuf(s)); /* temporary warning: remove it! @?@ @?@ @?@ */ if (!strLen(s)) - debug(55, 3) ("empty list header: %s (%d)\n", strBuf(Headers[id].name), - id); + debug(55, 3) ("empty list header: %s (%d)\n", strBuf(Headers[id].name), id); debug(55, 6) ("%p: joined for id %d: %s\n", hdr, id, strBuf(s)); return s; } @@ -654,8 +645,7 @@ httpHeaderPutAuth(HttpHeader * hdr, const char *authScheme, const char *realm) { assert(hdr && authScheme && realm); - httpHeaderPutStrf(hdr, HDR_WWW_AUTHENTICATE, "%s realm=\"%s\"", authScheme, - realm); + httpHeaderPutStrf(hdr, HDR_WWW_AUTHENTICATE, "%s realm=\"%s\"", authScheme, realm); } void @@ -671,8 +661,7 @@ packerToMemInit(&p, &mb); httpHdrCcPackInto(cc, &p); /* put */ - httpHeaderAddEntry(hdr, httpHeaderEntryCreate(HDR_CACHE_CONTROL, NULL, - mb.buf)); + httpHeaderAddEntry(hdr, httpHeaderEntryCreate(HDR_CACHE_CONTROL, NULL, mb.buf)); /* cleanup */ packerClean(&p); memBufClean(&mb); @@ -691,8 +680,7 @@ packerToMemInit(&p, &mb); httpHdrContRangePackInto(cr, &p); /* put */ - httpHeaderAddEntry(hdr, httpHeaderEntryCreate(HDR_CONTENT_RANGE, NULL, - mb.buf)); + httpHeaderAddEntry(hdr, httpHeaderEntryCreate(HDR_CONTENT_RANGE, NULL, mb.buf)); /* cleanup */ packerClean(&p); memBufClean(&mb); @@ -741,7 +729,8 @@ return value; } -time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id) +time_t +httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id) { HttpHeaderEntry *e; time_t value = -1; @@ -829,8 +818,7 @@ } const char * -httpHeaderGetAuth(const HttpHeader * hdr, http_hdr_type id, - const char *authScheme) +httpHeaderGetAuth(const HttpHeader * hdr, http_hdr_type id, const char *authScheme) { const char *field; int l; @@ -851,17 +839,20 @@ return base64_decode(field); } -ETag httpHeaderGetETag(const HttpHeader * hdr, http_hdr_type id) +ETag +httpHeaderGetETag(const HttpHeader * hdr, http_hdr_type id) { - ETag etag = { NULL, -1 }; + ETag etag = + {NULL, -1}; HttpHeaderEntry *e; - assert(Headers[id].type == ftETag); /* must be of an appropriate type */ + assert(Headers[id].type == ftETag); /* must be of an appropriate type */ if ((e = httpHeaderFindEntry(hdr, id))) etagParseInit(&etag, strBuf(e->value)); return etag; } -TimeOrTag httpHeaderGetTimeOrTag(const HttpHeader * hdr, http_hdr_type id) +TimeOrTag +httpHeaderGetTimeOrTag(const HttpHeader * hdr, http_hdr_type id) { TimeOrTag tot; HttpHeaderEntry *e; @@ -901,8 +892,7 @@ stringInit(&e->name, name); stringInit(&e->value, value); Headers[id].stat.aliveCount++; - debug(55, 9) ("created entry %p: '%s: %s'\n", e, strBuf(e->name), - strBuf(e->value)); + debug(55, 9) ("created entry %p: '%s: %s'\n", e, strBuf(e->name), strBuf(e->value)); return e; } @@ -911,8 +901,7 @@ { assert(e); assert_eid(e->id); - debug(55, 9) ("destroying entry %p: '%s: %s'\n", e, strBuf(e->name), - strBuf(e->value)); + debug(55, 9) ("destroying entry %p: '%s: %s'\n", e, strBuf(e->name), strBuf(e->value)); /* clean name if needed */ if (e->id == HDR_OTHER) stringClean(&e->name); @@ -947,8 +936,7 @@ } /* now we know we can parse it */ e = memAllocate(MEM_HTTP_HDR_ENTRY); - debug(55, 9) ("creating entry %p: near '%s'\n", e, - getStringPrefix(field_start, field_end)); + debug(55, 9) ("creating entry %p: near '%s'\n", e, getStringPrefix(field_start, field_end)); /* is it a "known" field? */ id = httpHeaderIdByName(field_start, name_len, Headers, HDR_ENUM_END); if (id < 0) @@ -976,8 +964,7 @@ stringLimitInit(&e->value, value_start, field_end - value_start); Headers[id].stat.seenCount++; Headers[id].stat.aliveCount++; - debug(55, 9) ("created entry %p: '%s: %s'\n", e, strBuf(e->name), - strBuf(e->value)); + debug(55, 9) ("created entry %p: '%s: %s'\n", e, strBuf(e->name), strBuf(e->value)); return e; } @@ -1013,12 +1000,11 @@ */ /* tmp variable used to pass stat info to dumpers */ -extern const HttpHeaderStat *dump_stat; /* argh! */ +extern const HttpHeaderStat *dump_stat; /* argh! */ const HttpHeaderStat *dump_stat = NULL; static void -httpHeaderFieldStatDumper(StoreEntry * sentry, int idx, double val, double size, - int count) +httpHeaderFieldStatDumper(StoreEntry * sentry, int idx, double val, double size, int count) { const int id = (int) val; const int valid_id = id >= 0 && id < HDR_ENUM_END; @@ -1033,12 +1019,12 @@ } static void -httpHeaderFldsPerHdrDumper(StoreEntry * sentry, int idx, double val, - double size, int count) +httpHeaderFldsPerHdrDumper(StoreEntry * sentry, int idx, double val, double size, int count) { if (count) storeAppendPrintf(sentry, "%2d\t %5d\t %5d\t %6.2f\n", - idx, (int) val, count, xpercent(count, dump_stat->destroyedCount)); + idx, (int) val, count, + xpercent(count, dump_stat->destroyedCount)); } @@ -1072,17 +1058,13 @@ assert(e); HttpHeaderStats[0].parsedCount = - HttpHeaderStats[hoRequest].parsedCount + - HttpHeaderStats[hoReply].parsedCount; + HttpHeaderStats[hoRequest].parsedCount + HttpHeaderStats[hoReply].parsedCount; HttpHeaderStats[0].ccParsedCount = - HttpHeaderStats[hoRequest].ccParsedCount + - HttpHeaderStats[hoReply].ccParsedCount; + HttpHeaderStats[hoRequest].ccParsedCount + HttpHeaderStats[hoReply].ccParsedCount; HttpHeaderStats[0].destroyedCount = - HttpHeaderStats[hoRequest].destroyedCount + - HttpHeaderStats[hoReply].destroyedCount; + HttpHeaderStats[hoRequest].destroyedCount + HttpHeaderStats[hoReply].destroyedCount; HttpHeaderStats[0].busyDestroyedCount = - HttpHeaderStats[hoRequest].busyDestroyedCount + - HttpHeaderStats[hoReply].busyDestroyedCount; + HttpHeaderStats[hoRequest].busyDestroyedCount + HttpHeaderStats[hoReply].busyDestroyedCount; for (i = 1; i < HttpHeaderStatCount; i++) { httpHeaderStatDump(HttpHeaderStats + i, e); @@ -1101,13 +1083,13 @@ } storeAppendPrintf(e, "Headers Parsed: %d + %d = %d\n", HttpHeaderStats[hoRequest].parsedCount, - HttpHeaderStats[hoReply].parsedCount, HttpHeaderStats[0].parsedCount); + HttpHeaderStats[hoReply].parsedCount, + HttpHeaderStats[0].parsedCount); storeAppendPrintf(e, "Hdr Fields Parsed: %d\n", HeaderEntryParsedCount); } int -httpHeaderIdByName(const char *name, int name_len, - const HttpHeaderFieldInfo * info, int end) +httpHeaderIdByName(const char *name, int name_len, const HttpHeaderFieldInfo * info, int end) { int i; for (i = 0; i < end; ++i) { Index: squid/src/HttpHeaderTools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeaderTools.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpHeaderTools.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpHeaderTools.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpHeaderTools.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpHeaderTools.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -35,8 +36,7 @@ #include "squid.h" static int httpHeaderStrCmp(const char *h1, const char *h2, int len); -static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, - const char *fmt, va_list vargs); +static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs); HttpHeaderFieldInfo * @@ -99,7 +99,7 @@ /* same as httpHeaderPutStr, but formats the string using snprintf first */ void #if STDC_HEADERS -httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, const char *fmt, ...) +httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, const char *fmt,...) #else httpHeaderPutStrf(va_alist) va_dcl @@ -124,8 +124,7 @@ /* used by httpHeaderPutStrf */ static void -httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, - va_list vargs) +httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs) { MemBuf mb; memBufDefInit(&mb); @@ -240,8 +239,7 @@ * init pos with NULL to start iteration. */ int -strListGetItem(const String * str, char del, const char **item, int *ilen, - const char **pos) +strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos) { size_t len; assert(str && item && pos); @@ -348,8 +346,7 @@ parse_success = httpHeaderParse(&hdr, hstr, hstr + hstr_len); /* debugLevels[55] = 2; */ if (!parse_success) { - debug(66, 2) ("TEST (%d): failed to parsed a header: {\n%s}\n", - bug_count, hstr); + debug(66, 2) ("TEST (%d): failed to parsed a header: {\n%s}\n", bug_count, hstr); return; } /* we think that we parsed it, veryfy */ @@ -358,10 +355,7 @@ httpHeaderPackInto(&hdr, &p); if ((pos = abs(httpHeaderStrCmp(hstr, mb.buf, hstr_len)))) { bug_count++; - debug(66, 2) - - - ("TEST (%d): hdr parsing bug (pos: %d near '%s'): expected: {\n%s} got: {\n%s}\n", + debug(66, 2) ("TEST (%d): hdr parsing bug (pos: %d near '%s'): expected: {\n%s} got: {\n%s}\n", bug_count, pos, hstr + pos, hstr, mb.buf); } httpHeaderClean(&hdr); Index: squid/src/HttpMsg.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpMsg.c,v retrieving revision 1.1.1.1.4.1.2.1.2.1 retrieving revision 1.1.1.1.4.1.2.1.2.2 diff -u -r1.1.1.1.4.1.2.1.2.1 -r1.1.1.1.4.1.2.1.2.2 --- squid/src/HttpMsg.c 27 Aug 2001 21:48:18 -0000 1.1.1.1.4.1.2.1.2.1 +++ squid/src/HttpMsg.c 9 Sep 2001 12:17:06 -0000 1.1.1.1.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpMsg.c,v 1.1.1.1.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpMsg.c,v 1.1.1.1.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 74 HTTP Message * AUTHOR: Alex Rousskov @@ -37,8 +38,7 @@ /* find end of headers */ int -httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, - const char **blk_end) +httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end) { /* * parse_start points to the first line of HTTP message *headers*, Index: squid/src/HttpReply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpReply.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpReply.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpReply.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpReply.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpReply.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -39,7 +40,8 @@ /* these entity-headers must be ignored if a bogus server sends them in 304 */ static HttpHeaderMask Denied304HeadersMask; -static http_hdr_type Denied304HeadersArr[] = { +static http_hdr_type Denied304HeadersArr[] = +{ HDR_ALLOW, HDR_CONTENT_ENCODING, HDR_CONTENT_LANGUAGE, HDR_CONTENT_LENGTH, HDR_CONTENT_LOCATION, HDR_CONTENT_RANGE, HDR_LAST_MODIFIED, HDR_LINK, HDR_OTHER @@ -51,11 +53,9 @@ static void httpReplyDoDestroy(HttpReply * rep); static void httpReplyHdrCacheInit(HttpReply * rep); static void httpReplyHdrCacheClean(HttpReply * rep); -static int httpReplyParseStep(HttpReply * rep, const char *parse_start, - int atEnd); +static int httpReplyParseStep(HttpReply * rep, const char *parse_start, int atEnd); static int httpReplyParseError(HttpReply * rep); -static int httpReplyIsolateStart(const char **parse_start, - const char **blk_start, const char **blk_end); +static int httpReplyIsolateStart(const char **parse_start, const char **blk_start, const char **blk_end); static time_t httpReplyHdrExpirationTime(const HttpReply * rep); @@ -64,8 +64,7 @@ httpReplyInitModule(void) { httpHeaderMaskInit(&Denied304HeadersMask, 0); - httpHeaderCalcMask(&Denied304HeadersMask, (const int *) Denied304HeadersArr, - countof(Denied304HeadersArr)); + httpHeaderCalcMask(&Denied304HeadersMask, (const int *) Denied304HeadersArr, countof(Denied304HeadersArr)); } @@ -168,7 +167,8 @@ } /* create memBuf, create mem-based packer, pack, destroy packer, return MemBuf */ -MemBuf httpReplyPack(const HttpReply * rep) +MemBuf +httpReplyPack(const HttpReply * rep) { MemBuf mb; Packer p; @@ -195,7 +195,7 @@ MemBuf httpPackedReply(double ver, http_status status, const char *ctype, -int clen, time_t lmt, time_t expires) + int clen, time_t lmt, time_t expires) { HttpReply *rep = httpReplyCreate(); MemBuf mb; @@ -205,12 +205,11 @@ return mb; } -MemBuf httpPacked304Reply(const HttpReply * rep) +MemBuf +httpPacked304Reply(const HttpReply * rep) { static const http_hdr_type ImsEntries[] = - { HDR_DATE, HDR_CONTENT_TYPE, HDR_EXPIRES, HDR_LAST_MODIFIED, /* eof */ - HDR_OTHER - }; + {HDR_DATE, HDR_CONTENT_TYPE, HDR_EXPIRES, HDR_LAST_MODIFIED, /* eof */ HDR_OTHER}; int t; MemBuf mb; Packer p; @@ -229,8 +228,8 @@ } void -httpReplySetHeaders(HttpReply * reply, double ver, http_status status, - const char *reason, const char *ctype, int clen, time_t lmt, time_t expires) +httpReplySetHeaders(HttpReply * reply, double ver, http_status status, const char *reason, + const char *ctype, int clen, time_t lmt, time_t expires) { HttpHeader *hdr; assert(reply); @@ -390,8 +389,7 @@ if (rep->pstate == psReadyToParseHeaders) { if (!httpMsgIsolateHeaders(&parse_start, &blk_start, &blk_end)) { if (atEnd) - blk_start = parse_start, blk_end = - blk_start + strlen(blk_start); + blk_start = parse_start, blk_end = blk_start + strlen(blk_start); else return 0; } @@ -421,8 +419,7 @@ /* find first CRLF */ static int -httpReplyIsolateStart(const char **parse_start, const char **blk_start, - const char **blk_end) +httpReplyIsolateStart(const char **parse_start, const char **blk_start, const char **blk_end) { int slen = strcspn(*parse_start, "\r\n"); if (!(*parse_start)[slen]) /* no CRLF found */ Index: squid/src/HttpRequest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpRequest.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpRequest.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpRequest.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpRequest.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpRequest.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -120,8 +121,7 @@ #if UNUSED_CODE void -httpRequestSetHeaders(request_t * req, method_t method, const char *uri, - const char *header_str) +httpRequestSetHeaders(request_t * req, method_t method, const char *uri, const char *header_str) { assert(req && uri && header_str); assert(!req->header.len); @@ -136,7 +136,9 @@ { assert(req); return strlen(RequestMethodStr[req->method]) + 1 + - strLen(req->urlpath) + 1 + 4 + 1 + 3 + 2 + req->header.len + 2; + strLen(req->urlpath) + 1 + + 4 + 1 + 3 + 2 + + req->header.len + 2; } /* returns true if header is allowed to be passed on */ Index: squid/src/HttpStatusLine.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpStatusLine.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/HttpStatusLine.c 27 Aug 2001 21:48:18 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/HttpStatusLine.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: HttpStatusLine.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:18 tolsty Exp $ + * $Id: HttpStatusLine.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 57 HTTP Status-line * AUTHOR: Alex Rousskov @@ -52,8 +53,7 @@ /* set values */ void -httpStatusLineSet(HttpStatusLine * sline, double version, http_status status, - const char *reason) +httpStatusLineSet(HttpStatusLine * sline, double version, http_status status, const char *reason) { assert(sline); sline->version = version; Index: squid/src/internal.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/internal.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/internal.c 27 Aug 2001 21:48:21 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/internal.c 9 Sep 2001 12:17:06 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: internal.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:21 tolsty Exp $ + * $Id: internal.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 12:17:06 serassio Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -56,7 +57,11 @@ httpReplySetHeaders(entry->mem_obj->reply, 1.0, HTTP_NOT_FOUND, - "Not Found", "text/plain", strlen(msgbuf), squid_curtime, -2); + "Not Found", + "text/plain", + strlen(msgbuf), + squid_curtime, + -2); httpReplySwapOut(entry->mem_obj->reply, entry); storeAppend(entry, msgbuf, strlen(msgbuf)); storeComplete(entry); @@ -85,8 +90,7 @@ * makes internal url with a given host and port (remote internal url) */ char * -internalRemoteUri(const char *host, u_short port, const char *dir, - const char *name) +internalRemoteUri(const char *host, u_short port, const char *dir, const char *name) { static MemBuf mb = MemBufNULL; static char lc_host[SQUIDHOSTNAMELEN];