/*
- * $Id: ETag.cc,v 1.2 1998/07/20 17:19:00 wessels Exp $
+ * $Id: ETag.cc,v 1.3 1998/07/21 17:26:11 wessels Exp $
*
* DEBUG: section 7? HTTP ETag
* AUTHOR: Alex Rousskov
/* parses a string as weak or strong entity-tag; returns true on success */
/* note: we do not duplicate "str"! */
int
-etagParseInit(ETag *etag, const char *str)
+etagParseInit(ETag * etag, const char *str)
{
int len;
assert(etag && str);
str += 2;
/* check format (quoted-string) */
len = strlen(str);
- if (len >= 2 && str[0] == '"' && str[len-1] == '"')
+ if (len >= 2 && str[0] == '"' && str[len - 1] == '"')
etag->str = str;
return etag->str != NULL;
}
/* returns true if etags are equal */
int
-etagIsEqual(const ETag *tag1, const ETag *tag2)
+etagIsEqual(const ETag * tag1, const ETag * tag2)
{
assert(tag1 && tag2);
- assert(!tag1->weak && !tag2->weak); /* weak comparison not implemented yet */
+ assert(!tag1->weak && !tag2->weak); /* weak comparison not implemented yet */
return !strcmp(tag1->str, tag2->str);
}
/*
- * $Id: HttpBody.cc,v 1.13 1998/07/20 17:19:01 wessels Exp $
+ * $Id: HttpBody.cc,v 1.14 1998/07/21 17:26:12 wessels Exp $
*
* DEBUG: section 56 HTTP Message Body
* AUTHOR: Alex Rousskov
/* set body by absorbing mb */
void
-httpBodySet(HttpBody * body, MemBuf *mb)
+httpBodySet(HttpBody * body, MemBuf * mb)
{
assert(body);
assert(memBufIsNull(&body->mb));
- body->mb = *mb; /* absorb */
+ body->mb = *mb; /* absorb */
}
void
/*
- * $Id: HttpHdrCc.cc,v 1.13 1998/07/20 17:19:02 wessels Exp $
+ * $Id: HttpHdrCc.cc,v 1.14 1998/07/21 17:26:13 wessels Exp $
*
* DEBUG: section 65 HTTP Cache Control Header
* AUTHOR: Alex Rousskov
void
httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count)
{
- extern const HttpHeaderStat *dump_stat; /* argh! */
+ extern const HttpHeaderStat *dump_stat; /* argh! */
const int id = (int) val;
const int valid_id = id >= 0 && id < CC_ENUM_END;
const char *name = valid_id ? strBuf(CcFieldsInfo[id].name) : "INVALID";
/*
- * $Id: HttpHdrContRange.cc,v 1.6 1998/07/20 17:19:02 wessels Exp $
+ * $Id: HttpHdrContRange.cc,v 1.7 1998/07/21 17:26:14 wessels Exp $
*
* DEBUG: section 68 HTTP Content-Range Header
* AUTHOR: Alex Rousskov
}
void
-httpHdrContRangeSet(HttpHdrContRange *cr, HttpHdrRangeSpec spec, size_t ent_len)
+httpHdrContRangeSet(HttpHdrContRange * cr, HttpHdrRangeSpec spec, size_t ent_len)
{
assert(cr && ent_len >= 0);
cr->spec = spec;
/*
- * $Id: HttpHdrRange.cc,v 1.11 1998/07/20 17:19:04 wessels Exp $
+ * $Id: HttpHdrRange.cc,v 1.12 1998/07/21 17:26:14 wessels Exp $
*
* DEBUG: section 64 HTTP Range Header
* AUTHOR: Alex Rousskov
httpHdrRangeSpecCanonize(HttpHdrRangeSpec * spec, size_t clen)
{
debug(64, 5) ("httpHdrRangeSpecCanonize: have: [%d, %d) len: %d\n",
- spec->offset, spec->offset+spec->length, spec->length);
+ 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 */
spec->length = size_min(size_diff(clen, spec->offset), spec->length);
/* check range validity */
debug(64, 5) ("httpHdrRangeSpecCanonize: done: [%d, %d) len: %d\n",
- spec->offset, spec->offset+spec->length, spec->length);
+ spec->offset, spec->offset + spec->length, spec->length);
return spec->length > 0;
}
httpHdrRangeSpecMergeWith(HttpHdrRangeSpec * recep, const HttpHdrRangeSpec * donor)
{
int merged = 0;
- size_t rhs = recep->offset + recep->length; /* no -1 ! */
- const size_t donor_rhs = donor->offset + donor->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));
assert(recep->length > 0);
assert(donor->length > 0);
/* do we have a left hand side overlap? */
if (donor->offset < recep->offset && recep->offset <= donor_rhs) {
- recep->offset = donor->offset; /* decrease left offset */
+ recep->offset = donor->offset; /* decrease left offset */
merged = 1;
}
/* do we have a right hand side overlap? */
if (donor->offset <= rhs && rhs < donor_rhs) {
- rhs = donor_rhs; /* increase right offset */
+ rhs = donor_rhs; /* increase right offset */
merged = 1;
}
/* adjust length if offsets have been changed */
/* merged with current so get rid of the prev one */
assert(prev_spec == stackPop(&range->specs));
httpHdrRangeSpecDestroy(prev_spec);
- continue; /* re-iterate */
+ continue; /* re-iterate */
}
}
stackPush(&range->specs, spec);
- i++; /* progress */
+ i++; /* progress */
}
- debug(64, 3) ("httpHdrRangeCanonize: merged %d specs\n",
+ debug(64, 3) ("httpHdrRangeCanonize: merged %d specs\n",
goods.count - range->specs.count);
stackClean(&goods);
debug(64, 3) ("httpHdrRangeCanonize: finished with %d specs\n",
/* searches for next range, returns true if found */
HttpHdrRangeSpec *
-httpHdrRangeGetSpec(const HttpHdrRange * range, HttpHdrRangePos *pos)
+httpHdrRangeGetSpec(const HttpHdrRange * range, HttpHdrRangePos * pos)
{
assert(range);
assert(pos && *pos >= -1 && *pos < range->specs.count);
/*
- * $Id: HttpHeader.cc,v 1.50 1998/07/20 20:20:50 wessels Exp $
+ * $Id: HttpHeader.cc,v 1.51 1998/07/21 17:26:15 wessels Exp $
*
* DEBUG: section 55 HTTP Header
* AUTHOR: Alex Rousskov
HDR_MIME_VERSION, HDR_PUBLIC, HDR_RETRY_AFTER, HDR_SERVER, HDR_SET_COOKIE,
HDR_VARY,
HDR_WARNING, HDR_PROXY_CONNECTION, HDR_X_CACHE,
- HDR_X_CACHE_LOOKUP,
+ HDR_X_CACHE_LOOKUP,
HDR_X_REQUEST_URI,
HDR_X_SQUID_ERROR
};
/* 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;
debug(55, 8) ("%p del-by-id %d\n", hdr, id);
assert(hdr);
assert_eid(id);
- assert_eid(id != HDR_OTHER); /* does not make sense */
+ assert_eid(id != HDR_OTHER); /* does not make sense */
if (!CBIT_TEST(hdr->mask, id))
return 0;
while ((e = httpHeaderGetEntry(hdr, &pos))) {
}
void
-httpHeaderPutContRange(HttpHeader * hdr, const HttpHdrContRange *cr)
+httpHeaderPutContRange(HttpHeader * hdr, const HttpHdrContRange * cr)
{
MemBuf mb;
Packer p;
}
void
-httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange *range)
+httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange * range)
{
MemBuf mb;
Packer p;
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 tot;
HttpHeaderEntry *e;
- assert(Headers[id].type == ftDate_1123_or_ETag); /* must be of an appropriate type */
+ assert(Headers[id].type == ftDate_1123_or_ETag); /* must be of an appropriate type */
memset(&tot, 0, sizeof(tot));
if ((e = httpHeaderFindEntry(hdr, id))) {
const char *str = strBuf(e->value);
tot.tag.str = NULL;
}
}
- assert(tot.time < 0 || !tot.tag.str); /* paranoid */
+ assert(tot.time < 0 || !tot.tag.str); /* paranoid */
return tot;
}
*/
/* 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
/*
- * $Id: HttpRequest.cc,v 1.12 1998/07/20 19:26:49 wessels Exp $
+ * $Id: HttpRequest.cc,v 1.13 1998/07/21 17:26:16 wessels Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
/* packs request-line and headers, appends <crlf> terminator */
void
-httpRequestPack(const request_t * req, Packer *p)
+httpRequestPack(const request_t * req, Packer * p)
{
assert(req && p);
/* pack request-line */
/*
- * $Id: MemBuf.cc,v 1.16 1998/07/20 17:19:10 wessels Exp $
+ * $Id: MemBuf.cc,v 1.17 1998/07/21 17:26:17 wessels Exp $
*
* DEBUG: section 59 auto-growing Memory Buffer with printf
* AUTHOR: Alex Rousskov
{
assert(mb);
if (!mb->buf && !mb->max_capacity && !mb->capacity && !mb->size)
- return 1; /* null, not initialized */
- assert(mb->buf && mb->max_capacity && mb->capacity); /* paranoid */
+ return 1; /* null, not initialized */
+ assert(mb->buf && mb->max_capacity && mb->capacity); /* paranoid */
return 0;
}
/*
- * $Id: asn.cc,v 1.43 1998/07/20 22:40:46 wessels Exp $
+ * $Id: asn.cc,v 1.44 1998/07/21 17:26:20 wessels Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
/* BEGIN of definitions for radix tree entries */
/* int in memory with length */
-typedef u_char m_int[1 + sizeof(unsigned int)];
+typedef u_char m_int[1 + sizeof(unsigned int)];
#define store_m_int(i, m) \
(i = htonl(i), m[0] = sizeof(m_int), xmemcpy(m+1, &i, sizeof(unsigned int)))
#define get_m_int(i, m) \
/*
- * $Id: cache_cf.cc,v 1.290 1998/07/20 20:20:52 wessels Exp $
+ * $Id: cache_cf.cc,v 1.291 1998/07/21 17:26:21 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
acl_list *l;
while (head != NULL) {
storeAppendPrintf(entry, "%s %s",
- name,
+ name,
head->allow ? "Allow" : "Deny");
for (l = head->acl_list; l != NULL; l = l->next) {
storeAppendPrintf(entry, " %s%s",
const char *
peer_type_str(const peer_t type)
{
- switch(type) {
+ switch (type) {
case PEER_PARENT:
return "parent";
break;
#if USE_CARP
} else if (!strncasecmp(token, "carp-load-factor=", 17)) {
if (p->type != PEER_PARENT)
- debug(3,0)("parse_peer: Ignoring carp-load-factor for non-parent %s/%d\n", p->host, p->http_port);
- else
- p->carp.load_factor = atof(token + 17);
+ debug(3, 0) ("parse_peer: Ignoring carp-load-factor for non-parent %s/%d\n", p->host, p->http_port);
+ else
+ p->carp.load_factor = atof(token + 17);
#endif
} else {
debug(3, 0) ("parse_peer: token='%s'\n", token);
p->tcp_up = PEER_TCP_MAGIC_COUNT;
#if USE_CARP
if (p->carp.load_factor) {
- /*
- * calculate this peers hash for use in CARP
- */
- p->carp.hash = 0;
- for (token = p->host; *token != 0;token++)
- p->carp.hash += (p->carp.hash << 19) + *token;
+ /*
+ * calculate this peers hash for use in CARP
+ */
+ p->carp.hash = 0;
+ for (token = p->host; *token != 0; token++)
+ p->carp.hash += (p->carp.hash << 19) + *token;
}
#endif
cbdataAdd(p, MEM_NONE);
peer *p;
if (!(host = strtok(NULL, w_space)))
self_destruct();
- if ((p = peerFindByName(host)) == NULL) {
- debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
- cfg_filename, config_lineno, host);
- return;
- }
+ if ((p = peerFindByName(host)) == NULL) {
+ debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
+ cfg_filename, config_lineno, host);
+ return;
+ }
aclParseAccessLine(&p->access);
}
/*
- * $Id: cache_manager.cc,v 1.15 1998/07/20 20:20:53 wessels Exp $
+ * $Id: cache_manager.cc,v 1.16 1998/07/21 17:26:23 wessels Exp $
*
* DEBUG: section 16 Cache Manager Objects
* AUTHOR: Duane Wessels
char *desc;
OBJH *handler;
struct {
- int pw_req:1;
- int atomic:1;
+ int pw_req:1;
+ int atomic:1;
} flags;
struct _action_table *next;
} action_table;
a = cachemgrFindAction(mgr->action);
assert(a != NULL);
if (a->flags.atomic)
- storeBuffer(entry);
+ storeBuffer(entry);
{
HttpReply *rep = entry->mem_obj->reply;
/* prove there are no previous reply headers around */
}
a->handler(entry);
if (a->flags.atomic) {
- storeBufferFlush(entry);
- storeComplete(entry);
+ storeBufferFlush(entry);
+ storeComplete(entry);
}
cachemgrStateFree(mgr);
}
/*
- * $Id: carp.cc,v 1.2 1998/07/20 17:19:24 wessels Exp $
+ * $Id: carp.cc,v 1.3 1998/07/21 17:26:23 wessels Exp $
*
* DEBUG: section 44 Cache Array Routing Protocol
* AUTHOR: Eric Stern
* 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"
a += p->carp.load_factor;
K++;
}
- if (a == 0.0)
+ if (a == 0.0)
/* CARP load factors not configured */
return;
/*
/* select peer */
for (tp = Config.peers; tp; tp = tp->next) {
if (p->carp.load_factor == 0.0)
- continue;
+ continue;
assert(p->type == PEER_PARENT);
combined_hash = (url_hash ^ tp->carp.hash);
combined_hash += combined_hash * 0x62531965;
combined_hash = combined_hash << 21;
combined_hash = combined_hash * tp->carp.load_multiplier;
debug(44, 3) ("carpSelectParent: %s combined_hash %d\n",
- tp->host, combined_hash);
+ tp->host, combined_hash);
if ((combined_hash > high_score) && neighborUp(tp)) {
p = tp;
high_score = combined_hash;
}
}
if (p)
- debug(44, 3) ("carpSelectParent: selected CARP %s\n", p->host);
+ debug(44, 3) ("carpSelectParent: selected CARP %s\n", p->host);
return p;
}
#endif
-
-
/*
- * $Id: client.cc,v 1.72 1998/07/20 17:19:26 wessels Exp $
+ * $Id: client.cc,v 1.73 1998/07/21 17:26:24 wessels Exp $
*
* DEBUG: section 0 WWW Client
* AUTHOR: Harvest Derived
/*
- * $Id: client_side.cc,v 1.361 1998/07/21 17:22:02 wessels Exp $
+ * $Id: client_side.cc,v 1.362 1998/07/21 17:26:26 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
debug(33, 3) ("modifiedSince: '%s'\n", storeUrl(entry));
if (mod_time < 0)
mod_time = entry->timestamp;
- debug(33,3)("modifiedSince: mod_time = %d\n", (int) mod_time);
+ debug(33, 3) ("modifiedSince: mod_time = %d\n", (int) mod_time);
if (mod_time < 0)
return 1;
/* Find size of the object */
{
/* We only require a content-length for "upload" methods */
if (!pumpMethod(r->method))
- return 1;
+ return 1;
if (httpHeaderGetInt(&r->header, HDR_CONTENT_LENGTH) < 0)
return 0;
return 1;
/*
* We hold a stale copy; it needs to be validated
*/
- if (e->lastmod < 0) {
- /*
+ if (e->lastmod < 0) {
+ /*
* Previous reply didn't have a Last-Modified header,
* we cannot revalidate it.
*/
REQ_REFRESH,
REQ_USED_PROXY_AUTH,
REQ_REDIRECTED,
- REQ_NOCACHE_HACK /* for changing no-cache requests into IMS */
+ REQ_NOCACHE_HACK /* for changing no-cache requests into IMS */
};
enum {
/*
- * $Id: forward.cc,v 1.18 1998/07/20 17:19:39 wessels Exp $
+ * $Id: forward.cc,v 1.19 1998/07/21 17:26:28 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
/*
* Check if this host is allowed to fetch MISSES from us (miss_access)
*/
- memset(&ch, '\0', sizeof(aclCheck_t));
+ memset(&ch, '\0', sizeof(aclCheck_t));
ch.src_addr = peer_addr;
ch.request = r;
answer = aclCheckFast(Config.accessList.miss, &ch);
if (answer == 0) {
- err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN);
- err->request = requestLink(r);
- err->src_addr = peer_addr;
- errorAppendEntry(e, err);
- return;
+ err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN);
+ err->request = requestLink(r);
+ err->src_addr = peer_addr;
+ errorAppendEntry(e, err);
+ return;
}
debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
e->mem_obj->request = requestLink(r);
e->mem_obj->fd = fd;
switch (r->protocol) {
- /*
- * Note, don't create fwdState for these requests
- */
+ /*
+ * Note, don't create fwdState for these requests
+ */
case PROTO_INTERNAL:
internalStart(r, e);
return;
/*
- * $Id: ftp.cc,v 1.239 1998/07/20 22:50:37 wessels Exp $
+ * $Id: ftp.cc,v 1.240 1998/07/21 17:26:29 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
LOCAL_ARRAY(char, html, 8192);
size_t width = Config.Ftp.list_width;
ftpListParts *parts;
- *icon=*href=*text=*size=*chdir=*view=*download=*link=*html='\0';
+ *icon = *href = *text = *size = *chdir = *view = *download = *link = *html = '\0';
if ((int) strlen(line) > 1024) {
snprintf(html, 8192, "%s\n", line);
return html;
strcpy(text, "Home Directory");
}
snprintf(html, 8192, "<A HREF=\"%s\">%s</A> <A HREF=\"%s\">%s</A> %s\n",
- href, icon, href, text, link);
+ href, icon, href, text, link);
return html;
}
if ((parts = ftpListParseParts(line, ftpState->flags)) == NULL) {
}
}
/* {icon} {text} . . . {date}{size}{chdir}{view}{download}{link}\n */
- xstrncpy(href,rfc1738_escape(parts->name),2048);
+ xstrncpy(href, rfc1738_escape(parts->name), 2048);
xstrncpy(text, parts->showname, 2048);
switch (parts->type) {
case 'd':
mimeGetIconURL(parts->name),
"[UNKNOWN]");
snprintf(chdir, 2048, " <A HREF=\"%s/;type=d\"><IMG BORDER=0 SRC=\"%s\" "
- "ALT=\"[DIR]\"></A>",
+ "ALT=\"[DIR]\"></A>",
rfc1738_escape(parts->name),
mimeGetIconURL("internal-dir"));
break;
if (parts->type != 'd') {
if (mimeGetViewOption(parts->name)) {
snprintf(view, 2048, " <A HREF=\"%s;type=a\"><IMG BORDER=0 SRC=\"%s\" "
- "ALT=\"[VIEW]\"></A>",
+ "ALT=\"[VIEW]\"></A>",
href, mimeGetIconURL("internal-view"));
}
if (mimeGetDownloadOption(parts->name)) {
snprintf(download, 2048, " <A HREF=\"%s;type=i\"><IMG BORDER=0 SRC=\"%s\" "
- "ALT=\"[DOWNLOAD]\"></A>",
+ "ALT=\"[DOWNLOAD]\"></A>",
href, mimeGetIconURL("internal-download"));
}
}
/* <A HREF="{href}">{icon}</A> <A HREF="{href}">{text}</A> . . . {date}{size}{chdir}{view}{download}{link}\n */
if (parts->type != '\0') {
snprintf(html, 8192, "<A HREF=\"%s\">%s</A> <A HREF=\"%s\">%s</A>%s "
- "%s%8s%s%s%s%s\n",
+ "%s%8s%s%s%s%s\n",
href, icon, href, text, dots_fill(strlen(text)),
parts->date, size, chdir, view, download, link);
} else {
/* Plain listing. {icon} {text} ... {chdir}{view}{download} */
snprintf(html, 8192, "<A HREF=\"%s\">%s</A> <A HREF=\"%s\">%s</A>%s "
- "%s%s%s%s\n",
+ "%s%s%s%s\n",
href, icon, href, text, dots_fill(strlen(text)),
chdir, view, download, link);
}
ErrorState *err;
debug(9, 3) ("ftpFail\n");
/* Try the / hack to support "Netscape" FTP URL's for retreiving files */
- if (!ftpState->flags.isdir && /* Not a directory */
- !ftpState->flags.try_slash_hack && /* Not in slash hack */
+ if (!ftpState->flags.isdir && /* Not a directory */
+ !ftpState->flags.try_slash_hack && /* Not in slash hack */
ftpState->mdtm <= 0 && ftpState->size < 0 && /* Not known as a file */
- !strNCaseCmp(ftpState->request->urlpath, "/%2f", 4)) { /* No slash encoded */
+ !strNCaseCmp(ftpState->request->urlpath, "/%2f", 4)) { /* No slash encoded */
switch (ftpState->state) {
case SENT_CWD:
case SENT_RETR:
/*
- * $Id: globals.h,v 1.60 1998/07/14 22:56:00 wessels Exp $
+ * $Id: globals.h,v 1.61 1998/07/21 17:26:30 wessels Exp $
*/
extern FILE *debug_log; /* NULL */
extern const char *StoreDigestUrlPath; /* "store_digest" */
extern const char *StoreDigestMimeStr; /* "application/cache-digest" */
extern const Version CacheDigestVer; /* { 3, 3 } */
-extern const char *MultipartMsgBoundaryStr; /* "Unique-Squid-Separator" */
-extern icpUdpData *IcpQueueHead; /* NULL */
+extern const char *MultipartMsgBoundaryStr; /* "Unique-Squid-Separator" */
+extern icpUdpData *IcpQueueHead; /* NULL */
ssize_t
htcpBuildTstOpData(char *buf, size_t buflen, htcpStuff * stuff)
{
- switch(stuff->rr) {
+ switch (stuff->rr) {
case RR_REQUEST:
- return htcpBuildSpecifier(buf, buflen, stuff);
+ return htcpBuildSpecifier(buf, buflen, stuff);
case RR_RESPONSE:
- return htcpBuildDetail(buf, buflen, stuff);
+ return htcpBuildDetail(buf, buflen, stuff);
default:
fatal_dump("htcpBuildTstOpData: bad RR value");
- }
- return 0;
+ }
+ return 0;
}
ssize_t
ssize_t pktlen;
char vbuf[32];
htcpStuff stuff;
- HttpHeader hdr;
- Packer pa;
+ HttpHeader hdr;
+ Packer pa;
MemBuf mb;
snprintf(vbuf, sizeof(vbuf), "%3.1f", req->http_ver);
stuff.op = HTCP_TST;
stuff.method = RequestMethodStr[req->method];
stuff.uri = storeUrl(e);
stuff.version = vbuf;
- httpBuildRequestHeader(req, req, e, &hdr, -1, 0);
- memBufDefInit(&mb);
- packerToMemInit(&pa, &mb);
- httpHeaderPackInto(&hdr, &pa);
- httpHeaderClean(&hdr);
- packerClean(&pa);
+ httpBuildRequestHeader(req, req, e, &hdr, -1, 0);
+ memBufDefInit(&mb);
+ packerToMemInit(&pa, &mb);
+ httpHeaderPackInto(&hdr, &pa);
+ httpHeaderClean(&hdr);
+ packerClean(&pa);
stuff.req_hdrs = mb.buf;
pkt = htcpBuildPacket(&stuff, &pktlen);
if (pkt == NULL) {
}
static void
-htcpHandleNop(char *buf, int sz, peer *p)
+htcpHandleNop(char *buf, int sz, peer * p)
{
debug(31, 1) ("htcpHandleNop: Unimplemented\n");
}
static void
-htcpHandleTst(char *buf, int sz, peer *p)
+htcpHandleTst(char *buf, int sz, peer * p)
{
/* buf should be a SPECIFIER */
htcpSpecifier *s = htcpUnpackSpecifier(buf, sz);
}
static void
-htcpTstReply(StoreEntry *e, htcpSpecifier *spec, peer *p)
+htcpTstReply(StoreEntry * e, htcpSpecifier * spec, peer * p)
{
htcpStuff stuff;
char *pkt;
}
static void
-htcpHandleMon(char *buf, int sz, peer *p)
+htcpHandleMon(char *buf, int sz, peer * p)
{
debug(31, 1) ("htcpHandleMon: Unimplemented\n");
}
static void
-htcpHandleSet(char *buf, int sz, peer *p)
+htcpHandleSet(char *buf, int sz, peer * p)
{
debug(31, 1) ("htcpHandleSet: Unimplemented\n");
}
static void
-htcpHandleData(char *buf, int sz, peer *p)
+htcpHandleData(char *buf, int sz, peer * p)
{
htcpDataHeader hdr;
if (sz < sizeof(htcpDataHeader)) {
peer *p;
p = whichPeer(from);
if (NULL == p) {
- debug(31,1)("htcpHandle: HTCP message from non-peer: %s:%d\n",
- inet_ntoa(from->sin_addr), (int) ntohs(from->sin_port));
+ debug(31, 1) ("htcpHandle: HTCP message from non-peer: %s:%d\n",
+ inet_ntoa(from->sin_addr), (int) ntohs(from->sin_port));
return;
}
if (sz < sizeof(htcpHeader)) {
/*
- * $Id: http.cc,v 1.297 1998/07/20 19:25:34 wessels Exp $
+ * $Id: http.cc,v 1.298 1998/07/21 17:26:33 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
/* NOTREACHED */
break;
/* Some responses can never be cached */
- case HTTP_PARTIAL_CONTENT: /* Not yet supported */
+ case HTTP_PARTIAL_CONTENT: /* Not yet supported */
case HTTP_SEE_OTHER:
case HTTP_NOT_MODIFIED:
case HTTP_UNAUTHORIZED:
case HTTP_PROXY_AUTHENTICATION_REQUIRED:
- case HTTP_INVALID_HEADER: /* Squid header parsing error */
+ case HTTP_INVALID_HEADER: /* Squid header parsing error */
default: /* Unknown status code */
return 0;
/* NOTREACHED */
}
if (reply->cache_control) {
if (EBIT_TEST(reply->cache_control->mask, CC_PROXY_REVALIDATE))
- EBIT_SET(entry->flag, ENTRY_REVALIDATE);
+ EBIT_SET(entry->flag, ENTRY_REVALIDATE);
else if (EBIT_TEST(reply->cache_control->mask, CC_MUST_REVALIDATE))
- EBIT_SET(entry->flag, ENTRY_REVALIDATE);
+ EBIT_SET(entry->flag, ENTRY_REVALIDATE);
}
if (EBIT_TEST(httpState->flags, HTTP_KEEPALIVE))
if (httpState->peer)
netdbBinaryExchange(entry);
else {
debug(0, 0) ("internalStart: unknown request '%s'\n", upath);
- debugObj(0,0, "internalStart: unknown request:\n", request, (ObjPackMethod)&httpRequestPack);
+ debugObj(0, 0, "internalStart: unknown request:\n", request, (ObjPackMethod) & httpRequestPack);
err = errorCon(ERR_INVALID_REQ, HTTP_NOT_FOUND);
err->request = requestLink(request);
errorAppendEntry(entry, err);
/*
- * $Id: mime.cc,v 1.71 1998/07/20 22:50:38 wessels Exp $
+ * $Id: mime.cc,v 1.72 1998/07/21 17:26:35 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
char *content_type;
char *content_encoding;
char transfer_mode;
- unsigned int view_option:1,download_option:1;
+ unsigned int view_option:1, download_option:1;
struct _mime_entry *next;
} mimeEntry;
mimeEntry *m;
char *t;
char *name = xstrdup(fn);
-try_again:
+ try_again:
for (m = MimeTable; m; m = m->next) {
if (regexec(&m->compiled_pattern, name, 0, 0, 0) == 0)
break;
goto try_again;
}
/* What? A encoding without a extension? */
- m=NULL;
+ m = NULL;
}
xfree(name);
return m;
debug(25, 1) ("mimeInit: parse error: '%s'\n", buf);
continue;
}
- download_option=0;
- view_option=0;
+ download_option = 0;
+ view_option = 0;
while ((option = strtok(NULL, w_space)) != NULL) {
- if (!strcmp(option,"+download"))
+ if (!strcmp(option, "+download"))
download_option = 1;
- else if (!strcmp(option,"+view"))
+ else if (!strcmp(option, "+view"))
view_option = 1;
- else
+ else
debug(25, 1) ("mimeInit: unknown option: '%s' (%s)\n", buf, option);
}
if (regcomp(&re, pattern, re_flags) != 0) {
/*
- * $Id: neighbors.cc,v 1.227 1998/07/20 20:21:04 wessels Exp $
+ * $Id: neighbors.cc,v 1.228 1998/07/21 17:26:36 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
peer *
-whichPeer(const struct sockaddr_in *from)
+whichPeer(const struct sockaddr_in * from)
{
int j;
u_short port = ntohs(from->sin_port);
/*
- * $Id: peer_select.cc,v 1.71 1998/07/20 17:19:59 wessels Exp $
+ * $Id: peer_select.cc,v 1.72 1998/07/21 17:26:38 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
requestUnlink(psstate->request);
psstate->request = NULL;
if (psstate->entry) {
- storeUnlockObject(psstate->entry);
- psstate->entry = NULL;
+ storeUnlockObject(psstate->entry);
+ psstate->entry = NULL;
}
cbdataFree(psstate);
}
request->hier.peer_select_start = current_time;
#endif
if (psstate->entry)
- storeLockObject(psstate->entry);
+ storeLockObject(psstate->entry);
cbdataLock(callback_data);
peerSelectFoo(psstate);
}
#endif
#if USE_CARP
} else if ((p = carpSelectParent(request))) {
- hierarchyNote(&request->hier, CARP, &psstate->icp, p->host);
- peerSelectCallback(psstate, p);
- return;
+ hierarchyNote(&request->hier, CARP, &psstate->icp, p->host);
+ peerSelectCallback(psstate, p);
+ return;
#endif
} else if ((p = netdbClosestParent(request))) {
request->hier.alg = PEER_SA_NETDB;
if (!cbdataValid(psstate->callback_data)) {
/* request aborted */
cbdataUnlock(psstate->callback_data);
- peerSelectStateFree(psstate);
+ peerSelectStateFree(psstate);
return;
}
if (entry)
extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, int, int);
/* ETag */
-extern int etagParseInit(ETag *etag, const char *str);
-extern int etagIsEqual(const ETag *tag1, const ETag *tag2);
+extern int etagParseInit(ETag * etag, const char *str);
+extern int etagIsEqual(const ETag * tag1, const ETag * tag2);
/* Http Status Line */
/* init/clean */
/* get body ptr (always use this) */
extern const char *httpBodyPtr(const HttpBody * body);
/* set body, does not clone mb so you should not reuse it */
-extern void httpBodySet(HttpBody * body, MemBuf *mb);
+extern void httpBodySet(HttpBody * body, MemBuf * mb);
/* pack */
extern void httpBodyPackInto(const HttpBody * body, Packer * p);
extern void httpHeaderPutStr(HttpHeader * hdr, http_hdr_type type, const char *str);
extern void httpHeaderPutAuth(HttpHeader * hdr, const char *authScheme, const char *realm);
extern void httpHeaderPutCc(HttpHeader * hdr, const HttpHdrCc * cc);
-extern void httpHeaderPutContRange(HttpHeader * hdr, const HttpHdrContRange *cr);
-extern void httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange *range);
+extern void httpHeaderPutContRange(HttpHeader * hdr, const HttpHdrContRange * cr);
+extern void httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange * range);
extern void httpHeaderPutExt(HttpHeader * hdr, const char *name, const char *value);
extern int httpHeaderGetInt(const HttpHeader * hdr, http_hdr_type id);
extern time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id);
extern void requestUnlink(request_t *);
extern int httpRequestParseHeader(request_t * req, const char *parse_start);
extern void httpRequestSwapOut(const request_t * req, StoreEntry * e);
-extern void httpRequestPack(const request_t * req, Packer *p);
+extern void httpRequestPack(const request_t * req, Packer * p);
extern int httpRequestPrefixLen(const request_t * req);
extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConnection);
#if USE_CARP
extern void carpInit(void);
-extern peer * carpSelectParent(request_t *);
+extern peer *carpSelectParent(request_t *);
#endif
/* packs, then prints an object using debug() */
/*
- * $Id: refresh.cc,v 1.26 1998/07/21 03:16:07 wessels Exp $
+ * $Id: refresh.cc,v 1.27 1998/07/21 17:26:40 wessels Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
#define REFRESH_DEFAULT_PCT 0.20
#define REFRESH_DEFAULT_MAX (time_t)259200
-static const refresh_t * refreshLimits(const char *);
+static const refresh_t *refreshLimits(const char *);
static const refresh_t *refreshUncompiledPattern(const char *);
static OBJH refreshStats;
/*
- * $Id: snmp_agent.cc,v 1.47 1998/07/20 22:40:47 wessels Exp $
+ * $Id: snmp_agent.cc,v 1.48 1998/07/21 17:26:41 wessels Exp $
*
* DEBUG: section 49 SNMP Interface
* AUTHOR: Kostas Anagnostakis
switch (Var->name[7]) {
case SYS_DESCR:
pp = SQUID_SYS_DESCR;
- Answer->type = ASN_OCTET_STR;
- Answer->val_len = strlen(pp);
- Answer->val.string = (u_char *) xstrdup(pp);
- break;
+ Answer->type = ASN_OCTET_STR;
+ Answer->val_len = strlen(pp);
+ Answer->val.string = (u_char *) xstrdup(pp);
+ break;
case SYS_OBJECT_ID:
pp = SQUID_VERSION;
Answer->type = ASN_OCTET_STR;
sc);
else {
if (sc->entry->swap_status == SWAPOUT_WRITING)
- assert(mem->swapout.done_offset > sc->copy_offset + mem->swap_hdr_sz);
+ assert(mem->swapout.done_offset > sc->copy_offset + mem->swap_hdr_sz);
file_read(sc->swapin_fd,
sc->copy_buf,
sc->copy_size,
-
-
-
struct _acl_ip_data {
struct in_addr addr1; /* if addr2 non-zero then its a range */
struct in_addr addr2;
FwdServer *servers;
int server_fd;
struct {
- int err_code;
- http_status http_code;
+ int err_code;
+ http_status http_code;
int xerrno;
} fail;
time_t start;
/*
- * $Id: tools.cc,v 1.162 1998/07/20 17:20:18 wessels Exp $
+ * $Id: tools.cc,v 1.163 1998/07/21 17:26:46 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
assert(label && obj && pm);
memBufDefInit(&mb);
packerToMemInit(&p, &mb);
- (*pm)(obj, &p);
+ (*pm) (obj, &p);
debug(section, level) ("%s%s", label, mb.buf);
packerClean(&p);
memBufClean(&mb);
typedef char HttpHeaderMask[8];
/* a common objPackInto interface; used by debugObj */
-typedef void (*ObjPackMethod)(void *obj, Packer *p);
+typedef void (*ObjPackMethod) (void *obj, Packer * p);
/*
- * $Id: whois.cc,v 1.3 1998/07/20 17:20:24 wessels Exp $
+ * $Id: whois.cc,v 1.4 1998/07/21 17:26:48 wessels Exp $
*
* DEBUG: section 75 WHOIS protocol
* AUTHOR: Duane Wessels, Kostas Anagnostakis
cbdataAdd(p, MEM_NONE);
storeLockObject(p->entry);
comm_add_close_handler(fd, whoisClose, p);
- l = strLen(p->request->urlpath)+3;
+ l = strLen(p->request->urlpath) + 3;
buf = xmalloc(l);
snprintf(buf, l, "%s\r\n", strBuf(p->request->urlpath) + 1);
comm_write(fd, buf, strlen(buf), NULL, p, xfree);