ldap_set_option(ld, LDAP_OPT_REFERRALS, value);
}
static void
-squid_ldap_set_timelimit(LDAP * ld, int timelimit)
+squid_ldap_set_timelimit(LDAP * ld, int aTimeLimit)
{
- ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit);
+ ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit);
}
static void
-squid_ldap_set_connect_timeout(LDAP * ld, int timelimit)
+squid_ldap_set_connect_timeout(LDAP * ld, int aTimeLimit)
{
#if defined(LDAP_OPT_NETWORK_TIMEOUT)
struct timeval tv;
- tv.tv_sec = timelimit;
+ tv.tv_sec = aTimeLimit;
tv.tv_usec = 0;
ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv);
#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT)
- timelimit *= 1000;
- ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit);
+ aTimeLimit *= 1000;
+ ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit);
#endif
}
static void
/* Disconnect the TCP connection to the server */
int
-RFCNB_Close(int socket)
+RFCNB_Close(int aSocket)
{
- close(socket);
+ close(aSocket);
/* If we want to do error recovery, here is where we put it */
int
Valid_User(char *USERNAME, char *PASSWORD, char *SERVER, char *BACKUP, char *DOMAIN)
{
- const char *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0",
- "MICROSOFT NETWORKS 1.03",
- "MICROSOFT NETWORKS 3.0",
- "LANMAN1.0",
- "LM1.2X002",
- "Samba",
- "NT LM 0.12",
- "NT LANMAN 1.0",
- NULL
- };
+ const char *supportedDialects[] = {"PC NETWORK PROGRAM 1.0",
+ "MICROSOFT NETWORKS 1.03",
+ "MICROSOFT NETWORKS 3.0",
+ "LANMAN1.0",
+ "LM1.2X002",
+ "Samba",
+ "NT LM 0.12",
+ "NT LANMAN 1.0",
+ NULL
+ };
void *con;
SMB_Init();
return (NTV_SERVER_ERROR);
}
}
- if (SMB_Negotiate(con, SMB_Prots) < 0) { /* An error */
+ if (SMB_Negotiate(con, supportedDialects) < 0) { /* An error */
SMB_Discon(con, 0);
return (NTV_PROTOCOL_ERROR);
}
* Generate a random vector.
*/
static void
-random_vector(char *vector)
+random_vector(char *aVector)
{
int randno;
int i;
srand((time(0) ^ rand()) + rand());
for (i = 0; i < AUTH_VECTOR_LEN;) {
randno = rand();
- memcpy(vector, &randno, sizeof(int));
- vector += sizeof(int);
+ memcpy(aVector, &randno, sizeof(int));
+ aVector += sizeof(int);
i += sizeof(int);
}
}
}
static int
-authenticate(int sockfd, const char *username, const char *passwd)
+authenticate(int socket_fd, const char *username, const char *passwd)
{
AUTH_HDR *auth;
u_short total_length;
* Send the request we've built.
*/
gettimeofday(&sent, NULL);
- send(sockfd, (char *) auth, total_length, 0);
+ send(socket_fd, (char *) auth, total_length, 0);
while ((time_spent = time_since(&sent)) < 1000000) {
struct timeval tv;
int rc, len;
tv.tv_usec = 1000000 - time_spent;
}
FD_ZERO(&readfds);
- FD_SET(sockfd, &readfds);
- if (select(sockfd + 1, &readfds, NULL, NULL, &tv) == 0) /* Select timeout */
+ FD_SET(socket_fd, &readfds);
+ if (select(socket_fd + 1, &readfds, NULL, NULL, &tv) == 0) /* Select timeout */
break;
salen = sizeof(saremote);
- len = recvfrom(sockfd, recv_buffer, sizeof(i_recv_buffer),
+ len = recvfrom(socket_fd, recv_buffer, sizeof(i_recv_buffer),
0, (struct sockaddr *) &saremote, &salen);
if (len < 0)
ldap_set_option(ld, LDAP_OPT_REFERRALS, value);
}
static void
-squid_ldap_set_timelimit(int timelimit)
+squid_ldap_set_timelimit(int aTimeLimit)
{
- ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit);
+ ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit);
}
static void
-squid_ldap_set_connect_timeout(int timelimit)
+squid_ldap_set_connect_timeout(int aTimeLimit)
{
#if defined(LDAP_OPT_NETWORK_TIMEOUT)
struct timeval tv;
- tv.tv_sec = timelimit;
+ tv.tv_sec = aTimeLimit;
tv.tv_usec = 0;
ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv);
#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT)
- timelimit *= 1000;
- ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit);
+ aTimeLimit *= 1000;
+ ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit);
#endif
}
ld->ld_options &= ~LDAP_OPT_REFERRALS;
}
static void
-squid_ldap_set_timelimit(int timelimit)
+squid_ldap_set_timelimit(int aTimeLimit)
{
- ld->ld_timelimit = timelimit;
+ ld->ld_timelimit = aTimeLimit;
}
static void
-squid_ldap_set_connect_timeout(int timelimit)
+squid_ldap_set_connect_timeout(int aTimeLimit)
{
fprintf(stderr, "Connect timeouts not supported in your LDAP library\n");
}
ldap_set_option(ld, LDAP_OPT_REFERRALS, value);
}
static void
-squid_ldap_set_timelimit(int timelimit)
+squid_ldap_set_timelimit(int aTimeLimit)
{
- ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit);
+ ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit);
}
static void
-squid_ldap_set_connect_timeout(int timelimit)
+squid_ldap_set_connect_timeout(int aTimeLimit)
{
#if defined(LDAP_OPT_NETWORK_TIMEOUT)
struct timeval tv;
- tv.tv_sec = timelimit;
+ tv.tv_sec = aTimeLimit;
tv.tv_usec = 0;
ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv);
#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT)
- timelimit *= 1000;
- ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit);
+ aTimeLimit *= 1000;
+ ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit);
#endif
}
ld->ld_options &= ~LDAP_OPT_REFERRALS;
}
static void
-squid_ldap_set_timelimit(int timelimit)
+squid_ldap_set_timelimit(int aTimeLimit)
{
- ld->ld_timelimit = timelimit;
+ ld->ld_timelimit = aTimeLimit;
}
static void
-squid_ldap_set_connect_timeout(int timelimit)
+squid_ldap_set_connect_timeout(int aTimeLimit)
{
fprintf(stderr, "Connect timeouts not supported in your LDAP library\n");
}
}
static void
-read_passwd_file(const char *passwdfile, int ha1mode)
+read_passwd_file(const char *passwordFile, int isHa1Mode)
{
FILE *f;
char buf[8192];
fprintf(stderr, "digest_pw_auth: cannot create hash table\n");
exit(1);
}
- f = fopen(passwdfile, "r");
+ f = fopen(passwordFile, "r");
while (fgets(buf, 8192, f) != NULL) {
if ((buf[0] == '#') || (buf[0] == ' ') || (buf[0] == '\t') ||
(buf[0] == '\n'))
if (strncmp(passwd, "{HHA1}", 6) == 0) {
ha1 = passwd + 6;
passwd = NULL;
- } else if (ha1mode) {
+ } else if (isHa1Mode) {
ha1 = passwd;
passwd = NULL;
}
ldap_set_option(ld, LDAP_OPT_REFERRALS, value);
}
static void
-squid_ldap_set_timelimit(LDAP * ld, int timelimit)
+squid_ldap_set_timelimit(LDAP * ld, int aTimeLimit)
{
- ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit);
+ ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit);
}
static void
-squid_ldap_set_connect_timeout(LDAP * ld, int timelimit)
+squid_ldap_set_connect_timeout(LDAP * ld, int aTimeLimit)
{
#if defined(LDAP_OPT_NETWORK_TIMEOUT)
struct timeval tv;
- tv.tv_sec = timelimit;
+ tv.tv_sec = aTimeLimit;
tv.tv_usec = 0;
ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv);
#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT)
- timelimit *= 1000;
- ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit);
+ aTimeLimit *= 1000;
+ ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit);
#endif
}
static void
init_db();
while (fgets(request, sizeof(request), stdin)) {
- const char *index, *detail;
+ const char *user_key, *detail;
char *lastdetail;
int action = 0;
- index = strtok(request, " \n");
+ user_key = strtok(request, " \n");
detail = strtok(NULL, "\n");
lastdetail = strrchr(detail, ' ');
if (lastdetail) {
}
if (action == -1) {
session_logout(detail);
- printf("%s OK message=\"Bye\"\n", index);
+ printf("%s OK message=\"Bye\"\n", user_key);
} else if (action == 1) {
session_login(detail);
- printf("%s OK message=\"Welcome\"\n", index);
+ printf("%s OK message=\"Welcome\"\n", user_key);
} else if (session_active(detail)) {
session_login(detail);
- printf("%s OK\n", index);
+ printf("%s OK\n", user_key);
} else if (default_action == 1) {
session_login(detail);
- printf("%s ERR message=\"Welcome\"\n", index);
+ printf("%s ERR message=\"Welcome\"\n", user_key);
} else {
- printf("%s ERR message=\"No session available\"\n", index);
+ printf("%s ERR message=\"No session available\"\n", user_key);
}
}
shutdown_db();
/* Disconnect the TCP connection to the server */
int
-RFCNB_Close(int socket)
+RFCNB_Close(int aSocket)
{
- close(socket);
+ close(aSocket);
/* If we want to do error recovery, here is where we put it */
Valid_User(char *username, char *password, char *server, char *backup, char *domain)
{
int pass_is_precrypted_p = 0;
- char const *SMB_Prots[] = {
+ char const *supportedDialects[] = {
/* "PC NETWORK PROGRAM 1.0", */
/* "MICROSOFT NETWORKS 1.03", */
/* "MICROSOFT NETWORKS 3.0", */
return (NTV_SERVER_ERROR);
}
}
- if (SMB_Negotiate(con, SMB_Prots) < 0) { /* An error */
+ if (SMB_Negotiate(con, supportedDialects) < 0) { /* An error */
SMB_Discon(con, 0);
return (NTV_PROTOCOL_ERROR);
}
return ((s + sizeof(void*) - 1) / sizeof(void*)) * sizeof(void*);
}
-MemMalloc::MemMalloc(char const *label, size_t aSize) : MemImplementingAllocator(label, aSize) { inuse = 0; }
+MemMalloc::MemMalloc(char const *aLabel, size_t aSize) : MemImplementingAllocator(aLabel, aSize) { inuse = 0; }
bool
MemMalloc::idleTrigger(int shift) const
static struct tm *
parse_date_elements(const char *day, const char *month, const char *year,
- const char *time, const char *zone) {
+ const char *aTime, const char *zone) {
static struct tm tm;
char *t;
memset(&tm, 0, sizeof(tm));
- if (!day || !month || !year || !time)
+ if (!day || !month || !year || !aTime)
return NULL;
tm.tm_mday = atoi(day);
tm.tm_mon = make_month(month);
tm.tm_year += 100;
else if (tm.tm_year > 19000)
tm.tm_year -= 19000;
- tm.tm_hour = make_num(time);
- t = strchr(time, ':');
+ tm.tm_hour = make_num(aTime);
+ t = strchr(aTime, ':');
if (!t)
return NULL;
t++;
char *day = NULL;
char *month = NULL;
char *year = NULL;
- char *time = NULL;
+ char *timestr = NULL;
char *zone = NULL;
xstrncpy(tmp, str, 64);
year = t;
}
} else if (strchr(t, ':'))
- time = t;
+ timestr = t;
else if (!year)
year = t;
} else if (!wday)
else if (!zone)
zone = t;
}
- tm = parse_date_elements(day, month, year, time, zone);
+ tm = parse_date_elements(day, month, year, timestr, zone);
return tm;
}
}
size_t
-BodyPipe::putMoreData(const char *buf, size_t size)
+BodyPipe::putMoreData(const char *aBuffer, size_t size)
{
if (bodySizeKnown())
size = min((uint64_t)size, unproducedSize());
const size_t spaceSize = static_cast<size_t>(theBuf.potentialSpaceSize());
if ((size = min(size, spaceSize))) {
- theBuf.append(buf, size);
+ theBuf.append(aBuffer, size);
postAppend(size);
return size;
}
}
size_t
-BodyPipe::getMoreData(MemBuf &buf)
+BodyPipe::getMoreData(MemBuf &aMemBuffer)
{
if (!theBuf.hasContent())
return 0; // did not touch the possibly uninitialized buf
- if (buf.isNull())
- buf.init();
- const size_t size = min(theBuf.contentSize(), buf.potentialSpaceSize());
- buf.append(theBuf.content(), size);
+ if (aMemBuffer.isNull())
+ aMemBuffer.init();
+ const size_t size = min(theBuf.contentSize(), aMemBuffer.potentialSpaceSize());
+ aMemBuffer.append(theBuf.content(), size);
theBuf.consume(size);
postConsume(size);
return size; // cannot be zero if we called buf.init above
// a short temporary string describing buffer status for debugging
const char *BodyPipe::status() const
{
- static MemBuf buf;
- buf.reset();
+ static MemBuf outputBuffer;
+ outputBuffer.reset();
- buf.append(" [", 2);
+ outputBuffer.append(" [", 2);
- buf.Printf("%"PRIu64"<=%"PRIu64, theGetSize, thePutSize);
+ outputBuffer.Printf("%"PRIu64"<=%"PRIu64, theGetSize, thePutSize);
if (theBodySize >= 0)
- buf.Printf("<=%"PRId64, theBodySize);
+ outputBuffer.Printf("<=%"PRId64, theBodySize);
else
- buf.append("<=?", 3);
+ outputBuffer.append("<=?", 3);
- buf.Printf(" %d+%d", (int)theBuf.contentSize(), (int)theBuf.spaceSize());
+ outputBuffer.Printf(" %d+%d", (int)theBuf.contentSize(), (int)theBuf.spaceSize());
- buf.Printf(" pipe%p", this);
+ outputBuffer.Printf(" pipe%p", this);
if (theProducer)
- buf.Printf(" prod%p", theProducer);
+ outputBuffer.Printf(" prod%p", theProducer);
if (theConsumer)
- buf.Printf(" cons%p", theConsumer);
+ outputBuffer.Printf(" cons%p", theConsumer);
if (mustAutoConsume)
- buf.append(" A", 2);
+ outputBuffer.append(" A", 2);
if (isCheckedOut)
- buf.append(" L", 2); // Locked
+ outputBuffer.append(" L", 2); // Locked
- buf.append("]", 1);
+ outputBuffer.append("]", 1);
- buf.terminate();
+ outputBuffer.terminate();
- return buf.content();
+ return outputBuffer.content();
}
/* CommCbFunPtrCallT */
template <class Dialer>
-CommCbFunPtrCallT<Dialer>::CommCbFunPtrCallT(int debugSection, int debugLevel,
+CommCbFunPtrCallT<Dialer>::CommCbFunPtrCallT(int aDebugSection, int aDebugLevel,
const char *callName, const Dialer &aDialer):
- AsyncCall(debugSection, debugLevel, callName),
+ AsyncCall(aDebugSection, aDebugLevel, callName),
dialer(aDialer)
{
}
}
bool
-ConfigOptionVector::parse(char const *option, const char *value, int reconfiguring)
+ConfigOptionVector::parse(char const *option, const char *value, int isaReconfig)
{
Vector<ConfigOption *>::iterator i = options.begin();
while (i != options.end()) {
- if ((*i)->parse(option,value, reconfiguring))
+ if ((*i)->parse(option,value, isaReconfig))
return true;
++i;
public:
ConfigOptionAdapter(C& theObject, bool (C::*parseFP)(char const *option, const char *value, int reconfiguring), void (C::*dumpFP) (StoreEntry * e) const) : object(theObject), parser (parseFP), dumper(dumpFP) {}
- bool parse(char const *option, const char *value, int reconfiguring) {
+ bool parse(char const *option, const char *value, int isaReconf) {
if (parser)
- return (object.*parser)(option, value, reconfiguring);
+ return (object.*parser)(option, value, isaReconf);
return false;
}
void *cbdata;
int callback_valid;
void *buf;
- int fd;
+ int filedescriptor;
async_queue_entry_t *aqe;
async_queue_entry_type_t type;
/* Get the callback parameters */
freefunc = aqe->aq_e_free;
buf = aqe->aq_e_buf;
- fd = aqe->aq_e_fd;
+ filedescriptor = aqe->aq_e_fd;
type = aqe->aq_e_type;
callback_valid = cbdataReferenceValidDone(aqe->aq_e_callback_data, &cbdata);
AIODiskFile * theFile = NULL;
}
bool
-DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int reconfiguring)
+DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int isaReconfig)
{
if (strcmp(name, "Q1") != 0)
return false;
magic1 = atoi(value);
- if (!reconfiguring)
+ if (!isaReconfig)
return true;
if (old_magic1 < magic1) {
}
bool
-DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int reconfiguring)
+DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int isaReconfig)
{
if (strcmp(name, "Q2") != 0)
return false;
magic2 = atoi(value);
- if (!reconfiguring)
+ if (!isaReconfig)
return true;
if (old_magic2 < magic2) {
return (*k & (--n));
}
-static void
-alarm_handler(int sig)
-{
- (void) 0;
-}
+SQUIDCEXTERN {
+ static void
+ alarm_handler(int sig) {
+ (void) 0;
+ }
+};
int
main(int argc, char *argv[])
dlinkDelete(&ctrlp->node, &used_list);
if (ctrlp->done_handler) {
- AIOCB *callback = ctrlp->done_handler;
+ AIOCB *done_callback = ctrlp->done_handler;
void *cbdata;
ctrlp->done_handler = NULL;
if (cbdataReferenceValidDone(ctrlp->done_handler_data, &cbdata)) {
retval = 1; /* Return that we've actually done some work */
- callback(ctrlp->fd, cbdata, ctrlp->bufp,
- ctrlp->result.aio_return, ctrlp->result.aio_errno);
+ done_callback(ctrlp->fd, cbdata, ctrlp->bufp,
+ ctrlp->result.aio_return, ctrlp->result.aio_errno);
} else {
if (ctrlp->operation == _AIO_OPEN) {
/* The open operation was aborted.. */
void
HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason,
- const char *ctype, int64_t clen, time_t lmt, time_t expires)
+ const char *ctype, int64_t clen, time_t lmt, time_t expiresTime)
{
HttpHeader *hdr;
httpStatusLineSet(&sline, ver, status, reason);
if (clen >= 0)
hdr->putInt64(HDR_CONTENT_LENGTH, clen);
- if (expires >= 0)
- hdr->putTime(HDR_EXPIRES, expires);
+ if (expiresTime >= 0)
+ hdr->putTime(HDR_EXPIRES, expiresTime);
if (lmt > 0) /* this used to be lmt != 0 @?@ */
hdr->putTime(HDR_LAST_MODIFIED, lmt);
content_length = clen;
- expires = expires;
+ expires = expiresTime;
last_modified = lmt;
}
}
void
-HttpRequestMethod::Configure(SquidConfig &Config)
+HttpRequestMethod::Configure(SquidConfig &cfg)
{
#if 0 /* extension methods obsolete now that we have METHOD_OTHER always enabled */
- wordlist *w = Config.ext_methods;
+ wordlist *w = cfg.ext_methods;
while (w) {
char *s;
const int StoreMeta::MaximumTLVLength = 1 << 16;
bool
-StoreMeta::validLength(int length) const
+StoreMeta::validLength(int aLength) const
{
- if (!IntRange (MinimumTLVLength, MaximumTLVLength).includes(length)) {
- debugs(20, 0, "storeSwapMetaUnpack: insane length (" << length << ")!");
+ if (!IntRange (MinimumTLVLength, MaximumTLVLength).includes(aLength)) {
+ debugs(20, 0, "storeSwapMetaUnpack: insane length (" << aLength << ")!");
return false;
}
}
char
-String::operator [](unsigned int pos) const
+String::operator [](unsigned int aPos) const
{
- assert(pos < size_);
+ assert(aPos < size_);
- return buf_[pos];
+ return buf_[aPos];
}
}
void
-SwapDir::parseOptions(int reconfiguring)
+SwapDir::parseOptions(int isaReconfig)
{
unsigned int old_read_only = flags.read_only;
char *name, *value;
debugs(3,2, "SwapDir::parseOptions: parsing store option '" << name << "'='" << (value ? value : "") << "'");
if (newOption)
- if (!newOption->parse(name, value, reconfiguring))
+ if (!newOption->parse(name, value, isaReconfig))
self_destruct();
}
* parsing...
*/
- if (reconfiguring) {
+ if (isaReconfig) {
if (old_read_only != flags.read_only) {
debugs(3, 1, "Cache dir '" << path << "' now " << (flags.read_only ? "No-Store" : "Read-Write"));
}
}
bool
-SwapDir::optionReadOnlyParse(char const *option, const char *value, int reconfiguring)
+SwapDir::optionReadOnlyParse(char const *option, const char *value, int isaReconfig)
{
if (strcmp(option, "no-store") != 0 && strcmp(option, "read-only") != 0)
return false;
}
bool
-SwapDir::optionMaxSizeParse(char const *option, const char *value, int reconfiguring)
+SwapDir::optionMaxSizeParse(char const *option, const char *value, int isaReconfig)
{
if (strcmp(option, "max-size") != 0)
return false;
int64_t size = strtoll(value, NULL, 10);
- if (reconfiguring && max_objsize != size)
+ if (isaReconfig && max_objsize != size)
debugs(3, 1, "Cache dir '" << path << "' max object size now " << size);
max_objsize = size;
void
SwapDir::get
-(String const key, STOREGETCLIENT callback, void *cbdata)
+(String const key, STOREGETCLIENT aCallback, void *aCallbackData)
{
fatal("not implemented");
}
while (q != NULL) {
/* pop each result off the list and add it to the data tree individually */
- acl_ip_data *next = q->next;
+ acl_ip_data *next_node = q->next;
q->next = NULL;
data = data->insert(q, acl_ip_data::NetworkCompare);
- q = next;
+ q = next_node;
}
}
}
/// impossible services value to identify unset theNextServices
const static char *TheNullServices = ",null,";
-Adaptation::History::Entry::Entry(const String &sid, const timeval &when):
- service(sid), start(when), theRptm(-1), retried(false)
+Adaptation::History::Entry::Entry(const String &serviceId, const timeval &when):
+ service(serviceId), start(when), theRptm(-1), retried(false)
{
}
{
}
-int Adaptation::History::recordXactStart(const String &sid, const timeval &when, bool retrying)
+int Adaptation::History::recordXactStart(const String &serviceId, const timeval &when, bool retrying)
{
if (retrying) {
Must(!theEntries.empty()); // or there would be nothing to retry
theEntries.back().retried = true;
}
- theEntries.push_back(Adaptation::History::Entry(sid, when));
+ theEntries.push_back(Adaptation::History::Entry(serviceId, when));
return theEntries.size() - 1; // record position becomes history ID
}
method = methodReqmod;
req = r;
rep = NULL;
- } else if (HttpReply *r = dynamic_cast<HttpReply*>(theMsg)) {
+ } else if (HttpReply *theReply = dynamic_cast<HttpReply*>(theMsg)) {
method = methodRespmod;
req = theCause;
- rep = r;
+ rep = theReply;
} else {
Must(false); // should not happen
}
bool baselineBypass = false;
for (Pos pos = 0; has(pos); ++pos) {
// TODO: quit on all errors
- const String &sid = services[pos];
+ const String &serviceId = services[pos];
ServicePointer service = at(pos);
if (service != NULL) {
if (method == methodNone) {
point = service->cfg().point;
} else {
if (method != service->cfg().method)
- finalizeMsg("Inconsistent service method for", sid, true);
+ finalizeMsg("Inconsistent service method for", serviceId, true);
if (point != service->cfg().point)
- finalizeMsg("Inconsistent vectoring point for", sid, true);
+ finalizeMsg("Inconsistent vectoring point for", serviceId, true);
}
checkUniqueness(pos);
} else if (baselineBypass != service->cfg().bypass) {
debugs(93,0, "WARNING: Inconsistent bypass in " << kind <<
' ' << id << " may produce surprising results: " <<
- baselineKey << " vs. " << sid);
+ baselineKey << " vs. " << serviceId);
}
}
} else {
- finalizeMsg("ERROR: Unknown adaptation name", sid, true);
+ finalizeMsg("ERROR: Unknown adaptation name", serviceId, true);
}
}
debugs(93,7, HERE << "finalized " << kind << ": " << id);
{
Must(act.active());
// asbolute start of unprocessed data
- const uint64_t start = act.offset();
+ const uint64_t dataStart = act.offset();
// absolute end of buffered data
- const uint64_t end = virginConsumed + virgin.body_pipe->buf().contentSize();
- Must(virginConsumed <= start && start <= end);
- return static_cast<size_t>(end - start);
+ const uint64_t dataEnd = virginConsumed + virgin.body_pipe->buf().contentSize();
+ Must(virginConsumed <= dataStart && dataStart <= dataEnd);
+ return static_cast<size_t>(dataEnd - dataStart);
}
// pointer to buffered virgin body data available for the specified activity
const char *Adaptation::Icap::ModXact::virginContentData(const Adaptation::Icap::VirginBodyAct &act) const
{
Must(act.active());
- const uint64_t start = act.offset();
- Must(virginConsumed <= start);
- return virgin.body_pipe->buf().content() + static_cast<size_t>(start-virginConsumed);
+ const uint64_t dataStart = act.offset();
+ Must(virginConsumed <= dataStart);
+ return virgin.body_pipe->buf().content() + static_cast<size_t>(dataStart-virginConsumed);
}
void Adaptation::Icap::ModXact::virginConsume()
Adaptation::Icap::Launcher::swanSong();
}
-void Adaptation::Icap::ModXactLauncher::updateHistory(bool start)
+void Adaptation::Icap::ModXactLauncher::updateHistory(bool doStart)
{
HttpRequest *r = virgin.cause ?
virgin.cause : dynamic_cast<HttpRequest*>(virgin.header);
if (r) {
Adaptation::Icap::History::Pointer h = r->icapHistory();
if (h != NULL) {
- if (start)
+ if (doStart)
h->start("ICAPModXactLauncher");
else
h->stop("ICAPModXactLauncher");
buf.append(ICAP::crlf, 2);
// XXX: HttpRequest cannot fully parse ICAP Request-Line
- http_status status;
- Must(icapRequest->parse(&buf, true, &status) > 0);
+ http_status reqStatus;
+ Must(icapRequest->parse(&buf, true, &reqStatus) > 0);
}
void Adaptation::Icap::OptXact::handleCommWrote(size_t size)
CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Icap, ServiceRep);
-Adaptation::Icap::ServiceRep::ServiceRep(const Adaptation::ServiceConfig &cfg):
- AsyncJob("Adaptation::Icap::ServiceRep"), Adaptation::Service(cfg),
+Adaptation::Icap::ServiceRep::ServiceRep(const Adaptation::ServiceConfig &svcCfg):
+ AsyncJob("Adaptation::Icap::ServiceRep"), Adaptation::Service(svcCfg),
theOptions(NULL), theOptionsFetcher(0), theLastUpdate(0),
theSessionFailures(0), isSuspended(0), notifying(false),
updateScheduled(false), self(NULL),
}
void
-AuthBasicConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request)
+AuthBasicConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
{
if (authenticate) {
- debugs(29, 9, HERE << "Sending type:" << type << " header: 'Basic realm=\"" << basicAuthRealm << "\"'");
- httpHeaderPutStrf(&rep->header, type, "Basic realm=\"%s\"", basicAuthRealm);
+ debugs(29, 9, HERE << "Sending type:" << hdrType << " header: 'Basic realm=\"" << basicAuthRealm << "\"'");
+ httpHeaderPutStrf(&rep->header, hdrType, "Basic realm=\"%s\"", basicAuthRealm);
}
}
delete this;
}
-BasicUser::BasicUser(AuthConfig *config) : AuthUser (config) , passwd (NULL), credentials_checkedtime(0), auth_queue(NULL), cleartext (NULL), currentRequest (NULL), httpAuthHeader (NULL)
+BasicUser::BasicUser(AuthConfig *aConfig) : AuthUser (aConfig) , passwd (NULL), credentials_checkedtime(0), auth_queue(NULL), cleartext (NULL), currentRequest (NULL), httpAuthHeader (NULL)
{
flags.credentials_ok = 0;
}
/* add the [www-|Proxy-]authenticate header on a 407 or 401 reply */
void
-AuthDigestConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request)
+AuthDigestConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
{
if (!authenticate)
return;
/* on a 407 or 401 we always use a new nonce */
digest_nonce_h *nonce = authenticateDigestNonceNew();
- debugs(29, 9, "authenticateFixHeader: Sending type:" << type <<
+ debugs(29, 9, "authenticateFixHeader: Sending type:" << hdrType <<
" header: 'Digest realm=\"" << digestAuthRealm << "\", nonce=\"" <<
authenticateDigestNonceNonceb64(nonce) << "\", qop=\"" << QOP_AUTH <<
"\", stale=" << (stale ? "true" : "false"));
/* in the future, for WWW auth we may want to support the domain entry */
- httpHeaderPutStrf(&rep->header, type, "Digest realm=\"%s\", nonce=\"%s\", qop=\"%s\", stale=%s", digestAuthRealm, authenticateDigestNonceNonceb64(nonce), QOP_AUTH, stale ? "true" : "false");
+ httpHeaderPutStrf(&rep->header, hdrType, "Digest realm=\"%s\", nonce=\"%s\", qop=\"%s\", stale=%s", digestAuthRealm, authenticateDigestNonceNonceb64(nonce), QOP_AUTH, stale ? "true" : "false");
}
DigestUser::~DigestUser()
r->auth_user_request = this;
AUTHUSERREQUESTLOCK(r->auth_user_request, "r");
if (digestConfig.utf8) {
- char user[1024];
- latin1_to_utf8(user, sizeof(user), digest_user->username());
- snprintf(buf, 8192, "\"%s\":\"%s\"\n", user, realm);
+ char userstr[1024];
+ latin1_to_utf8(userstr, sizeof(userstr), digest_user->username());
+ snprintf(buf, 8192, "\"%s\":\"%s\"\n", userstr, realm);
} else {
snprintf(buf, 8192, "\"%s\":\"%s\"\n", digest_user->username(), realm);
}
helperSubmit(digestauthenticators, buf, authenticateDigestHandleReply, r);
}
-DigestUser::DigestUser (AuthConfig *config) : AuthUser (config), HA1created (0)
+DigestUser::DigestUser (AuthConfig *aConfig) : AuthUser (aConfig), HA1created (0)
{}
AuthUser *
}
void
-AuthNegotiateConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request)
+AuthNegotiateConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type reqType, HttpRequest * request)
{
AuthNegotiateUserRequest *negotiate_request;
/* New request, no user details */
if (auth_user_request == NULL) {
- debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate'");
- httpHeaderPutStrf(&rep->header, type, "Negotiate");
+ debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate'");
+ httpHeaderPutStrf(&rep->header, reqType, "Negotiate");
if (!keep_alive) {
/* drop the connection */
*/
if (negotiate_request->server_blob) {
- debugs(29, 9, "authenticateNegotiateFixErrorHeader: Sending type:" << type << " header: 'Negotiate " << negotiate_request->server_blob << "'");
- httpHeaderPutStrf(&rep->header, type, "Negotiate %s", negotiate_request->server_blob);
+ debugs(29, 9, "authenticateNegotiateFixErrorHeader: Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'");
+ httpHeaderPutStrf(&rep->header, reqType, "Negotiate %s", negotiate_request->server_blob);
safe_free(negotiate_request->server_blob);
} else {
debugs(29, 9, "authenticateNegotiateFixErrorHeader: Connection authenticated");
- httpHeaderPutStrf(&rep->header, type, "Negotiate");
+ httpHeaderPutStrf(&rep->header, reqType, "Negotiate");
}
break;
case AUTHENTICATE_STATE_NONE:
/* semantic change: do not drop the connection.
* 2.5 implementation used to keep it open - Kinkie */
- debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate'");
- httpHeaderPutStrf(&rep->header, type, "Negotiate");
+ debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate'");
+ httpHeaderPutStrf(&rep->header, reqType, "Negotiate");
break;
case AUTHENTICATE_STATE_IN_PROGRESS:
/* we're waiting for a response from the client. Pass it the blob */
- debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate " << negotiate_request->server_blob << "'");
- httpHeaderPutStrf(&rep->header, type, "Negotiate %s", negotiate_request->server_blob);
+ debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'");
+ httpHeaderPutStrf(&rep->header, reqType, "Negotiate %s", negotiate_request->server_blob);
safe_free(negotiate_request->server_blob);
break;
}
void
-AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type)
+AuthNegotiateUserRequest::authenticate(HttpRequest * aRequest, ConnStateData * conn, http_hdr_type type)
{
const char *proxy_auth, *blob;
}
/* get header */
- proxy_auth = request->header.getStr(type);
+ proxy_auth = aRequest->header.getStr(type);
/* locate second word */
blob = proxy_auth;
assert(conn->auth_user_request == NULL);
conn->auth_user_request = this;
AUTHUSERREQUESTLOCK(conn->auth_user_request, "conn");
- this->request = request;
- HTTPMSGLOCK(this->request);
+ request = aRequest;
+ HTTPMSGLOCK(request);
return;
break;
client_blob = xstrdup (blob);
- if (this->request)
- HTTPMSGUNLOCK(this->request);
- this->request = request;
- HTTPMSGLOCK(this->request);
+ if (request)
+ HTTPMSGUNLOCK(request);
+ request = aRequest;
+ HTTPMSGLOCK(request);
return;
break;
delete this;
}
-NegotiateUser::NegotiateUser (AuthConfig *config) : AuthUser (config)
+NegotiateUser::NegotiateUser (AuthConfig *aConfig) : AuthUser (aConfig)
{
proxy_auth_list.head = proxy_auth_list.tail = NULL;
}
}
void
-AuthNTLMConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request)
+AuthNTLMConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
{
AuthNTLMUserRequest *ntlm_request;
/* New request, no user details */
if (auth_user_request == NULL) {
- debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM'");
- httpHeaderPutStrf(&rep->header, type, "NTLM");
+ debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM'");
+ httpHeaderPutStrf(&rep->header, hdrType, "NTLM");
if (!keep_alive) {
/* drop the connection */
case AUTHENTICATE_STATE_NONE:
/* semantic change: do not drop the connection.
* 2.5 implementation used to keep it open - Kinkie */
- debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM'");
- httpHeaderPutStrf(&rep->header, type, "NTLM");
+ debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM'");
+ httpHeaderPutStrf(&rep->header, hdrType, "NTLM");
break;
case AUTHENTICATE_STATE_IN_PROGRESS:
/* we're waiting for a response from the client. Pass it the blob */
- debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM " << ntlm_request->server_blob << "'");
- httpHeaderPutStrf(&rep->header, type, "NTLM %s", ntlm_request->server_blob);
+ debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM " << ntlm_request->server_blob << "'");
+ httpHeaderPutStrf(&rep->header, hdrType, "NTLM %s", ntlm_request->server_blob);
safe_free(ntlm_request->server_blob);
break;
}
void
-AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type)
+AuthNTLMUserRequest::authenticate(HttpRequest * aRequest, ConnStateData * conn, http_hdr_type type)
{
const char *proxy_auth, *blob;
}
/* get header */
- proxy_auth = request->header.getStr(type);
+ proxy_auth = aRequest->header.getStr(type);
/* locate second word */
blob = proxy_auth;
assert(conn->auth_user_request == NULL);
conn->auth_user_request = this;
AUTHUSERREQUESTLOCK(conn->auth_user_request, "conn");
- this->request = request;
- HTTPMSGLOCK(this->request);
+ request = aRequest;
+ HTTPMSGLOCK(request);
return;
break;
client_blob = xstrdup (blob);
- if (this->request)
- HTTPMSGUNLOCK(this->request);
- this->request = request;
- HTTPMSGLOCK(this->request);
+ if (request)
+ HTTPMSGUNLOCK(request);
+ request = aRequest;
+ HTTPMSGLOCK(request);
return;
break;
delete this;
}
-NTLMUser::NTLMUser (AuthConfig *config) : AuthUser (config)
+NTLMUser::NTLMUser (AuthConfig *aConfig) : AuthUser (aConfig)
{
proxy_auth_list.head = proxy_auth_list.tail = NULL;
}
if (CheckPassword(mgr) != 0) {
/* build error message */
- ErrorState *err;
+ ErrorState *errState;
HttpReply *rep;
- err = errorCon(ERR_CACHE_MGR_ACCESS_DENIED, HTTP_UNAUTHORIZED, request);
+ errState = errorCon(ERR_CACHE_MGR_ACCESS_DENIED, HTTP_UNAUTHORIZED, request);
/* warn if user specified incorrect password */
if (mgr->passwd)
fd_table[fd].ipaddr << ": password needed for '" <<
mgr->action << "'" );
- rep = err->BuildHttpReply();
+ rep = errState->BuildHttpReply();
- errorStateFree(err);
+ errorStateFree(errState);
/*
* add Authenticate header, use 'action' as a realm because
{
public:
- generic_cbdata(void * data) : data(data) {}
+ generic_cbdata(void * aData) : data(aData) {}
template<typename wrapped_type>void unwrap(wrapped_type **output) {
*output = static_cast<wrapped_type *>(data);
return;
}
- int64_t next = getNextRangeOffset();
+ int64_t nextOffset = getNextRangeOffset();
- assert (next >= http->out.offset);
+ assert (nextOffset >= http->out.offset);
- int64_t skip = next - http->out.offset;
+ int64_t skip = nextOffset - http->out.offset;
/* adjust for not to be transmitted bytes */
- http->out.offset = next;
+ http->out.offset = nextOffset;
if (available.size() <= skip)
return;
}
void
-ClientSocketContext::writeComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag)
+ClientSocketContext::writeComplete(int aFileDescriptor, char *bufnotused, size_t size, comm_err_t errflag)
{
StoreEntry *entry = http->storeEntry();
http->out.size += size;
- assert(fd > -1);
- debugs(33, 5, "clientWriteComplete: FD " << fd << ", sz " << size <<
+ assert(aFileDescriptor > -1);
+ debugs(33, 5, "clientWriteComplete: FD " << aFileDescriptor << ", sz " << size <<
", err " << errflag << ", off " << http->out.size << ", len " <<
entry ? entry->objectLen() : 0);
clientUpdateSocketStats(http->logType, size);
- assert (this->fd() == fd);
+ assert (this->fd() == aFileDescriptor);
/* Bail out quickly on COMM_ERR_CLOSING - close handlers will tidy up */
if (errflag == COMM_ERR_CLOSING)
return;
- if (errflag || clientHttpRequestStatus(fd, http)) {
+ if (errflag || clientHttpRequestStatus(aFileDescriptor, http)) {
initiateClose("failure or true request status");
/* Do we leak here ? */
return;
break;
case STREAM_COMPLETE:
- debugs(33, 5, "clientWriteComplete: FD " << fd << " Keeping Alive");
+ debugs(33, 5, "clientWriteComplete: FD " << aFileDescriptor << " Keeping Alive");
keepaliveNextRequest();
return;
* connection has gone away */
}
-void ConnStateData::pinConnection(int pinning_fd, HttpRequest *request, struct peer *peer, bool auth)
+void ConnStateData::pinConnection(int pinning_fd, HttpRequest *request, struct peer *aPeer, bool auth)
{
fde *f;
char desc[FD_DESC_SZ];
pinning.pinned = true;
if (pinning.peer)
cbdataReferenceDone(pinning.peer);
- if (peer)
- pinning.peer = cbdataReference(peer);
+ if (aPeer)
+ pinning.peer = cbdataReference(aPeer);
pinning.auth = auth;
f = &fd_table[fd];
snprintf(desc, FD_DESC_SZ, "%s pinned connection for %s:%d (%d)",
- (auth || !peer) ? request->GetHost() : peer->name, f->ipaddr, (int) f->remote_port, fd);
+ (auth || !aPeer) ? request->GetHost() : aPeer->name, f->ipaddr, (int) f->remote_port, fd);
fd_note(pinning_fd, desc);
typedef CommCbMemFunT<ConnStateData, CommCloseCbParams> Dialer;
}
-int ConnStateData::validatePinnedConnection(HttpRequest *request, const struct peer *peer)
+int ConnStateData::validatePinnedConnection(HttpRequest *request, const struct peer *aPeer)
{
bool valid = true;
if (pinning.fd < 0)
if (pinning.peer && !cbdataReferenceValid(pinning.peer)) {
valid = false;
}
- if (peer != pinning.peer) {
+ if (aPeer != pinning.peer) {
valid = false;
}
StoreEntry ** ep)
{
StoreEntry *e;
- store_client *sc = *scp;
+ store_client *sc_tmp = *scp;
if ((e = *ep) != NULL) {
*ep = NULL;
- storeUnregister(sc, e, this);
+ storeUnregister(sc_tmp, e, this);
*scp = NULL;
e->unlock();
}
}
void
-clientReplyContext::removeClientStoreReference(store_client **scp, ClientHttpRequest *http)
+clientReplyContext::removeClientStoreReference(store_client **scp, ClientHttpRequest *aHttpRequest)
{
- StoreEntry *reference = http->storeEntry();
+ StoreEntry *reference = aHttpRequest->storeEntry();
removeStoreReference(scp, &reference);
- http->storeEntry(reference);
+ aHttpRequest->storeEntry(reference);
}
void *
* startSendProcess
*/
assert(reqofs == 0);
- StoreIOBuffer tempBuffer (next()->readBuffer.length, 0, next()->readBuffer.data);
- storeClientCopy(sc, http->storeEntry(), tempBuffer, SendMoreData, this);
+ StoreIOBuffer localTempBuffer (next()->readBuffer.length, 0, next()->readBuffer.data);
+ storeClientCopy(sc, http->storeEntry(), localTempBuffer, SendMoreData, this);
}
/* there is an expired entry in the store.
{
/* start counting the length from 0 */
- StoreIOBuffer tempBuffer(HTTP_REQBUF_SZ, 0, tempbuf);
- storeClientCopy(sc, entry, tempBuffer, HandleIMSReply, this);
+ StoreIOBuffer localTempBuffer(HTTP_REQBUF_SZ, 0, tempbuf);
+ storeClientCopy(sc, entry, localTempBuffer, HandleIMSReply, this);
}
}
return;
}
- StoreIOBuffer tempBuffer;
+ StoreIOBuffer localTempBuffer;
/* Swap in the metadata */
http->storeEntry(entry);
reqofs = 0;
- tempBuffer.offset = http->out.offset;
+ localTempBuffer.offset = http->out.offset;
- tempBuffer.length = next()->readBuffer.length;
+ localTempBuffer.length = next()->readBuffer.length;
- tempBuffer.data = next()->readBuffer.data;
+ localTempBuffer.data = next()->readBuffer.data;
storeClientCopy(sc, http->storeEntry(),
- tempBuffer, CacheHit, this);
+ localTempBuffer, CacheHit, this);
}
void
void
clientReplyContext::traceReply(clientStreamNode * node)
{
- clientStreamNode *next = (clientStreamNode *)node->node.next->data;
- StoreIOBuffer tempBuffer;
+ clientStreamNode *nextNode = (clientStreamNode *)node->node.next->data;
+ StoreIOBuffer localTempBuffer;
assert(http->request->max_forwards == 0);
createStoreEntry(http->request->method, request_flags());
- tempBuffer.offset = next->readBuffer.offset + headers_sz;
- tempBuffer.length = next->readBuffer.length;
- tempBuffer.data = next->readBuffer.data;
+ localTempBuffer.offset = nextNode->readBuffer.offset + headers_sz;
+ localTempBuffer.length = nextNode->readBuffer.length;
+ localTempBuffer.data = nextNode->readBuffer.data;
storeClientCopy(sc, http->storeEntry(),
- tempBuffer, SendMoreData, this);
+ localTempBuffer, SendMoreData, this);
http->storeEntry()->releaseRequest();
http->storeEntry()->buffer();
HttpReply *rep = new HttpReply;
assert(mem != NULL);
assert(http->request != NULL);
/* mem->reply was wrong because it uses the UPSTREAM header length!!! */
- HttpReply const *reply = mem->getReply();
+ HttpReply const *curReply = mem->getReply();
if (headers_sz == 0)
/* haven't found end of headers yet */
int sending = SENDING_BODY;
- if (reply->sline.status == HTTP_NO_CONTENT ||
- reply->sline.status == HTTP_NOT_MODIFIED ||
- reply->sline.status < HTTP_OK ||
+ if (curReply->sline.status == HTTP_NO_CONTENT ||
+ curReply->sline.status == HTTP_NOT_MODIFIED ||
+ curReply->sline.status < HTTP_OK ||
http->request->method == METHOD_HEAD)
sending = SENDING_HDRSONLY;
* If we are sending a body and we don't have a content-length,
* then we must wait for the object to become STORE_OK.
*/
- if (reply->content_length < 0)
+ if (curReply->content_length < 0)
return 0;
- int64_t expectedLength = reply->content_length + http->out.headers_sz;
+ int64_t expectedLength = curReply->content_length + http->out.headers_sz;
if (http->out.size < expectedLength)
return 0;
/* TODO: if maxage or s-maxage is present, don't do this */
if (squid_curtime - http->storeEntry()->timestamp >= 86400) {
- char tempbuf[512];
- snprintf (tempbuf, sizeof(tempbuf), "%s %s %s",
+ char tbuf[512];
+ snprintf (tbuf, sizeof(tbuf), "%s %s %s",
"113", ThisCache,
"This cache hit is still fresh and more than 1 day old");
- hdr->putStr(HDR_WARNING, tempbuf);
+ hdr->putStr(HDR_WARNING, tbuf);
}
}
}
/* We still have to do store logic processing - vary, cache hit etc */
if (http->storeEntry() != NULL) {
/* someone found the object in the cache for us */
- StoreIOBuffer tempBuffer;
+ StoreIOBuffer localTempBuffer;
http->storeEntry()->lock();
comm_set_tos(http->getConn()->fd, Config.zph.tos_local_hit);
}
#endif /* USE_ZPH_QOS */
- tempBuffer.offset = reqofs;
- tempBuffer.length = getNextNode()->readBuffer.length;
- tempBuffer.data = getNextNode()->readBuffer.data;
- storeClientCopy(sc, http->storeEntry(), tempBuffer, CacheHit, this);
+ localTempBuffer.offset = reqofs;
+ localTempBuffer.length = getNextNode()->readBuffer.length;
+ localTempBuffer.data = getNextNode()->readBuffer.data;
+ storeClientCopy(sc, http->storeEntry(), localTempBuffer, CacheHit, this);
} else {
/* MISS CASE, http->logType is already set! */
processMiss();
* client socket!
*/
debugs(88, 5, "clientReplyContext::sendStreamError: A stream error has occured, marking as complete and sending no data.");
- StoreIOBuffer tempBuffer;
+ StoreIOBuffer localTempBuffer;
flags.complete = 1;
- tempBuffer.flags.error = result.flags.error;
+ localTempBuffer.flags.error = result.flags.error;
clientStreamCallback((clientStreamNode*)http->client_stream.head->data, http, NULL,
- tempBuffer);
+ localTempBuffer);
}
void
clientReplyContext::pushStreamData(StoreIOBuffer const &result, char *source)
{
- StoreIOBuffer tempBuffer;
+ StoreIOBuffer localTempBuffer;
if (result.length == 0) {
debugs(88, 5, "clientReplyContext::pushStreamData: marking request as complete due to 0 length store result");
}
assert(result.offset - headers_sz == next()->readBuffer.offset);
- tempBuffer.offset = result.offset - headers_sz;
- tempBuffer.length = result.length;
+ localTempBuffer.offset = result.offset - headers_sz;
+ localTempBuffer.length = result.length;
- if (tempBuffer.length)
- tempBuffer.data = source;
+ if (localTempBuffer.length)
+ localTempBuffer.data = source;
clientStreamCallback((clientStreamNode*)http->client_stream.head->data, http, NULL,
- tempBuffer);
+ localTempBuffer);
}
clientStreamNode *
assert (!flags.headersSent);
flags.headersSent = true;
- StoreIOBuffer tempBuffer;
+ StoreIOBuffer localTempBuffer;
char *buf = next()->readBuffer.data;
char *body_buf = buf + reply->hdr_sz;
if (next()->readBuffer.offset != 0) {
if (next()->readBuffer.offset > body_size) {
/* Can't use any of the body we received. send nothing */
- tempBuffer.length = 0;
- tempBuffer.data = NULL;
+ localTempBuffer.length = 0;
+ localTempBuffer.data = NULL;
} else {
- tempBuffer.length = body_size - next()->readBuffer.offset;
- tempBuffer.data = body_buf + next()->readBuffer.offset;
+ localTempBuffer.length = body_size - next()->readBuffer.offset;
+ localTempBuffer.data = body_buf + next()->readBuffer.offset;
}
} else {
- tempBuffer.length = body_size;
- tempBuffer.data = body_buf;
+ localTempBuffer.length = body_size;
+ localTempBuffer.data = body_buf;
}
/* TODO??: move the data in the buffer back by the request header size */
clientStreamCallback((clientStreamNode *)http->client_stream.head->data,
- http, reply, tempBuffer);
+ http, reply, localTempBuffer);
return;
}
/* Using this breaks the client layering just a little!
*/
void
-clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags flags)
+clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags reqFlags)
{
assert(http != NULL);
/*
if (http->request == NULL)
http->request = HTTPMSGLOCK(new HttpRequest(m, PROTO_NONE, null_string));
- StoreEntry *e = storeCreateEntry(http->uri, http->log_uri, flags, m);
+ StoreEntry *e = storeCreateEntry(http->uri, http->log_uri, reqFlags, m);
sc = storeClientListAdd(e, this);
// storeClientCopy(http->sc, e, 0, HTTP_REQBUF_SZ, http->reqbuf,
// SendMoreData, this);
/* So, we mark the store logic as complete */
- this->flags.storelogiccomplete = 1;
+ flags.storelogiccomplete = 1;
/* and get the caller to request a read, from whereever they are */
/* NOTE: after ANY data flows down the pipe, even one step,
typedef enum {
COMM_CB_READ = 1,
- COMM_CB_DERIVED,
+ COMM_CB_DERIVED
} comm_callback_t;
struct _fd_debug_t {
str.Printf("HTTP Request:\r\n");
if (NULL != request) {
- Packer p;
+ Packer pck;
String urlpath_or_slash;
if (request->urlpath.size() != 0)
RequestMethodStr(request->method),
SQUIDSTRINGPRINT(urlpath_or_slash),
request->http_ver.major, request->http_ver.minor);
- packerToMemInit(&p, &str);
- request->header.packInto(&p);
- packerClean(&p);
+ packerToMemInit(&pck, &str);
+ request->header.packInto(&pck);
+ packerClean(&pck);
} else if (request_hdrs) {
p = request_hdrs;
} else {
case 'R':
if (NULL != request) {
- Packer p;
+ Packer pck;
String urlpath_or_slash;
if (request->urlpath.size() != 0)
RequestMethodStr(request->method),
SQUIDSTRINGPRINT(urlpath_or_slash),
request->http_ver.major, request->http_ver.minor);
- packerToMemInit(&p, &mb);
- request->header.packInto(&p);
- packerClean(&p);
+ packerToMemInit(&pck, &mb);
+ request->header.packInto(&pck);
+ packerClean(&pck);
} else if (request_hdrs) {
p = request_hdrs;
} else {
char localbuf [HTTP_REQBUF_SZ];
ESIElement::Pointer element;
int specifiedattcount = attrCount * 2;
- char *pos;
+ char *position;
assert (ellen < sizeof (localbuf)); /* prevent unexpected overruns. */
debugs(86, 5, "ESIContext::Start: element '" << el << "' with " << specifiedattcount << " tags");
localbuf[0] = '<';
localbuf[1] = '\0';
assert (xstrncpy (&localbuf[1], el, sizeof(localbuf) - 2));
- pos = localbuf + strlen (localbuf);
+ position = localbuf + strlen (localbuf);
for (i = 0; i < specifiedattcount && attr[i]; i += 2) {
- *pos++ = ' ';
+ *position++ = ' ';
/* TODO: handle thisNode gracefully */
- assert (xstrncpy (pos, attr[i], sizeof(localbuf) + (pos - localbuf)));
- pos += strlen (pos);
- *pos++ = '=';
- *pos++ = '\"';
+ assert (xstrncpy (position, attr[i], sizeof(localbuf) + (position - localbuf)));
+ position += strlen (position);
+ *position++ = '=';
+ *position++ = '\"';
const char *chPtr = attr[i + 1];
char ch;
while ((ch = *chPtr++) != '\0') {
if (ch == '\"') {
- assert( xstrncpy(pos, """, sizeof(localbuf) + (pos-localbuf)) );
- pos += 6;
+ assert( xstrncpy(position, """, sizeof(localbuf) + (position-localbuf)) );
+ position += 6;
} else {
- *(pos++) = ch;
+ *(position++) = ch;
}
}
- pos += strlen (pos);
- *pos++ = '\"';
+ position += strlen (position);
+ *position++ = '\"';
}
- *pos++ = '>';
- *pos = '\0';
+ *position++ = '>';
+ *position = '\0';
- addLiteral (localbuf, pos - localbuf);
+ addLiteral (localbuf, position - localbuf);
debugs(86, 5, "esi stack depth " << parserState.stackdepth);
return;
break;
{
unsigned int ellen = strlen (el);
char localbuf [HTTP_REQBUF_SZ];
- char *pos;
+ char *position;
if (flags.error)
/* waiting for expat to finish the buffer we gave it */
localbuf[0] = '<';
localbuf[1] = '/';
assert (xstrncpy (&localbuf[2], el, sizeof(localbuf) - 3));
- pos = localbuf + strlen (localbuf);
- *pos++ = '>';
- *pos = '\0';
- addLiteral (localbuf, pos - localbuf);
+ position = localbuf + strlen (localbuf);
+ *position++ = '>';
+ *position = '\0';
+ addLiteral (localbuf, position - localbuf);
break;
case ESIElement::ESI_ELEMENT_COMMENT:
private:
bool validChar (char c);
- void eval (ESIVarState::Variable *var, char const *subref, char const *found_default );
+ void eval (ESIVarState::Variable *var, char const *subref, char const *foundDefault );
void doFunction();
void identifyFunction();
char *string;
};
void
-ESIVariableProcessor::eval (ESIVarState::Variable *var, char const *subref, char const *found_default )
+ESIVariableProcessor::eval (ESIVarState::Variable *var, char const *subref, char const *foundDefault )
{
assert (var);
- if (!found_default)
- found_default = "";
+ if (!foundDefault)
+ foundDefault = "";
- var->eval (*varState, subref, found_default);
+ var->eval (*varState, subref, foundDefault);
}
bool
}
-ev_entry::ev_entry(char const * name, EVH * func, void * arg, double when,
- int weight, bool cbdata) : name(name), func(func),
- arg(cbdata ? cbdataReference(arg) : arg), when(when), weight(weight),
- cbdata(cbdata)
+ev_entry::ev_entry(char const * aName, EVH * aFunction, void * aArgument, double evWhen,
+ int aWeight, bool haveArgument) : name(aName), func(aFunction),
+ arg(haveArgument ? cbdataReference(aArgument) : aArgument), when(evWhen), weight(aWeight),
+ cbdata(haveArgument)
{
}
debugs(17, 3, "fwdConnectStart: got outgoing addr " << outgoing << ", tos " << tos);
- int flags = COMM_NONBLOCKING;
+ int commFlags = COMM_NONBLOCKING;
if (request->flags.spoof_client_ip) {
if (!fs->_peer || !fs->_peer->options.no_tproxy)
- flags |= COMM_TRANSPARENT;
+ commFlags |= COMM_TRANSPARENT;
// else no tproxy today ...
}
- fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, outgoing, flags, tos, url);
+ fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, outgoing, commFlags, tos, url);
debugs(17, 3, "fwdConnectStart: got TCP FD " << fd);
*/
void
-UFSSwapDir::reconfigure(int index, char *path)
+UFSSwapDir::reconfigure(int aIndex, char *aPath)
{
parseSizeL1L2();
parseOptions(1);
}
bool
-UFSSwapDir::optionIOParse(char const *option, const char *value, int reconfiguring)
+UFSSwapDir::optionIOParse(char const *option, const char *value, int isaReconfig)
{
if (strcmp(option, "IOEngine") != 0)
return false;
- if (reconfiguring)
+ if (isaReconfig)
/* silently ignore this */
return true;
}
StoreIOState::Pointer
-UFSSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback, void *callback_data)
+UFSSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * aCallback, void *callback_data)
{
- return IO->create (this, &e, file_callback, callback, callback_data);
+ return IO->create (this, &e, file_callback, aCallback, callback_data);
}
StoreIOState::Pointer
-UFSSwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback, void *callback_data)
+UFSSwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * aCallback, void *callback_data)
{
- return IO->open (this, &e, file_callback, callback, callback_data);
+ return IO->open (this, &e, file_callback, aCallback, callback_data);
}
int
}
int
-UFSSwapDir::createDirectory(const char *path, int should_exist)
+UFSSwapDir::createDirectory(const char *aPath, int should_exist)
{
int created = 0;
struct stat st;
getCurrentTime();
- if (0 == ::stat(path, &st)) {
+ if (0 == ::stat(aPath, &st)) {
if (S_ISDIR(st.st_mode)) {
- debugs(47, (should_exist ? 3 : 1), path << " exists");
+ debugs(47, (should_exist ? 3 : 1), aPath << " exists");
} else {
- fatalf("Swap directory %s is not a directory.", path);
+ fatalf("Swap directory %s is not a directory.", aPath);
}
#ifdef _SQUID_MSWIN_
- } else if (0 == mkdir(path)) {
+ } else if (0 == mkdir(aPath)) {
#else
- } else if (0 == mkdir(path, 0755)) {
+ } else if (0 == mkdir(aPath, 0755)) {
#endif
- debugs(47, (should_exist ? 1 : 3), path << " created");
+ debugs(47, (should_exist ? 1 : 3), aPath << " created");
created = 1;
} else {
fatalf("Failed to make swap directory %s: %s",
- path, xstrerror());
+ aPath, xstrerror());
}
return created;
}
bool
-UFSSwapDir::pathIsDirectory(const char *path)const
+UFSSwapDir::pathIsDirectory(const char *aPath)const
{
struct stat sb;
- if (::stat(path, &sb) < 0) {
- debugs(47, 0, "" << path << ": " << xstrerror());
+ if (::stat(aPath, &sb) < 0) {
+ debugs(47, 0, "" << aPath << ": " << xstrerror());
return false;
}
if (S_ISDIR(sb.st_mode) == 0) {
- debugs(47, 0, "" << path << " is not a directory");
+ debugs(47, 0, "" << aPath << " is not a directory");
return false;
}
time_t lastref,
time_t lastmod,
u_int32_t refcount,
- u_int16_t flags,
+ u_int16_t newFlags,
int clean)
{
StoreEntry *e = NULL;
e->expires = expires;
e->lastmod = lastmod;
e->refcount = refcount;
- e->flags = flags;
+ e->flags = newFlags;
EBIT_SET(e->flags, ENTRY_CACHABLE);
EBIT_CLR(e->flags, RELEASE_REQUEST);
EBIT_CLR(e->flags, KEY_PRIVATE);
}
void
-StoreSearchUFS::next(void (callback)(void *cbdata), void *cbdata)
+StoreSearchUFS::next(void (aCallback)(void *cbdata), void *aCallbackArgs)
{
next();
- callback (cbdata);
+ aCallback(aCallbackArgs);
}
bool
}
StoreIOState::Pointer
-UFSStrategy::createState(SwapDir *SD, StoreEntry *e, StoreIOState::STIOCB * callback, void *callback_data) const
+UFSStrategy::createState(SwapDir *SD, StoreEntry *e, StoreIOState::STIOCB * aCallback, void *callback_data) const
{
- return new UFSStoreState (SD, e, callback, callback_data);
+ return new UFSStoreState (SD, e, aCallback, callback_data);
}
DiskFile::Pointer
}
void
-UFSStoreState::read_(char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data)
+UFSStoreState::read_(char *buf, size_t size, off_t aOffset, STRCB * aCallback, void *aCallbackData)
{
assert(read.callback == NULL);
assert(read.callback_data == NULL);
assert(!reading);
assert(!closing);
- assert (callback);
+ assert (aCallback);
if (!theFile->canRead()) {
debugs(79, 3, "UFSStoreState::read_: queueing read because theFile can't read");
- queueRead (buf, size, offset, callback, callback_data);
+ queueRead (buf, size, aOffset, aCallback, aCallbackData);
return;
}
- read.callback = callback;
- read.callback_data = cbdataReference(callback_data);
+ read.callback = aCallback;
+ read.callback_data = cbdataReference(aCallbackData);
debugs(79, 3, "UFSStoreState::read_: dirno " << swap_dirn << ", fileno "<<
std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen);
- offset_ = offset;
+ offset_ = aOffset;
read_buf = buf;
reading = true;
- theFile->read(new ReadRequest(buf,offset,size));
+ theFile->read(new ReadRequest(buf,aOffset,size));
}
* code simpler and always go through the pending_writes queue.
*/
void
-UFSStoreState::write(char const *buf, size_t size, off_t offset, FREE * free_func)
+UFSStoreState::write(char const *buf, size_t size, off_t aOffset, FREE * free_func)
{
debugs(79, 3, "UFSStoreState::write: dirn " << swap_dirn << ", fileno "<<
std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen);
return;
}
- queueWrite(buf, size, offset, free_func);
+ queueWrite(buf, size, aOffset, free_func);
drainWriteQueue();
}
if (len > 0)
offset_ += len;
- STRCB *callback = read.callback;
+ STRCB *callback_ = read.callback;
- assert(callback);
+ assert(callback_);
read.callback = NULL;
if (len > 0 && read_buf != buf)
memcpy(read_buf, buf, len);
- callback(cbdata, read_buf, len, this);
+ callback_(cbdata, read_buf, len, this);
}
if (flags.try_closing || (theFile != NULL && theFile->error()) )
}
void
-UFSStoreState::queueRead(char *buf, size_t size, off_t offset, STRCB *callback, void *callback_data)
+UFSStoreState::queueRead(char *buf, size_t size, off_t aOffset, STRCB *callback_, void *callback_data_)
{
debugs(79, 3, "UFSStoreState::queueRead: queueing read");
assert(opening);
_queued_read *q = new _queued_read;
q->buf = buf;
q->size = size;
- q->offset = offset;
- q->callback = callback;
- q->callback_data = cbdataReference(callback_data);
+ q->offset = aOffset;
+ q->callback = callback_;
+ q->callback_data = cbdataReference(callback_data_);
linklistPush(&pending_reads, q);
}
}
void
-UFSStoreState::queueWrite(char const *buf, size_t size, off_t offset, FREE * free_func)
+UFSStoreState::queueWrite(char const *buf, size_t size, off_t aOffset, FREE * free_func)
{
debugs(79, 3, HERE << this << " UFSStoreState::queueWrite: queueing write of size " << size);
q = new _queued_write;
q->buf = buf;
q->size = size;
- q->offset = offset;
+ q->offset = aOffset;
q->free_func = free_func;
linklistPush(&pending_writes, q);
}
StoreIOState::Pointer
UFSStrategy::open(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_callback,
- StoreIOState::STIOCB * callback, void *callback_data)
+ StoreIOState::STIOCB * aCallback, void *callback_data)
{
assert (((UFSSwapDir *)SD)->IO == this);
debugs(79, 3, "UFSStrategy::open: fileno "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << e->swap_filen);
/* to consider: make createstate a private UFSStrategy call */
- StoreIOState::Pointer sio = createState (SD, e, callback, callback_data);
+ StoreIOState::Pointer sio = createState (SD, e, aCallback, callback_data);
sio->mode |= O_RDONLY;
StoreIOState::Pointer
UFSStrategy::create(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_callback,
- StoreIOState::STIOCB * callback, void *callback_data)
+ StoreIOState::STIOCB * aCallback, void *callback_data)
{
assert (((UFSSwapDir *)SD)->IO == this);
/* Allocate a number */
/* Shouldn't we handle a 'bitmap full' error here? */
- StoreIOState::Pointer sio = createState (SD, e, callback, callback_data);
+ StoreIOState::Pointer sio = createState (SD, e, aCallback, callback_data);
sio->mode |= O_WRONLY | O_CREAT | O_TRUNC;
}
void
-RebuildState::next(void (callback)(void *cbdata), void *cbdata)
+RebuildState::next(void (aCallback)(void *aCallbackDataarg), void *aCallbackData)
{
/* for now, we don't cache at all */
speed = 1;
while (!isDone() && currentEntry() == NULL)
rebuildStep();
- callback(cbdata);
+ aCallback(aCallbackData);
}
bool
p->type = 0;
while (ct && *ct) {
- time_t t;
+ time_t tm;
int l = strcspn(ct, ",");
char *tmp;
break;
case 'm':
- t = (time_t) strtol(ct + 1, &tmp, 0);
+ tm = (time_t) strtol(ct + 1, &tmp, 0);
if (tmp != ct + 1)
break; /* not a valid integer */
- p->date = xstrdup(ctime(&t));
+ p->date = xstrdup(ctime(&tm));
*(strstr(p->date, "\n")) = '\0';
* which should be sent to either StoreEntry, or to ICAP...
*/
void
-FtpStateData::writeReplyBody(const char *data, size_t len)
+FtpStateData::writeReplyBody(const char *dataToWrite, size_t dataLength)
{
- debugs(9, 5, HERE << "writing " << len << " bytes to the reply");
- addVirginReplyBody(data, len);
+ debugs(9, 5, HERE << "writing " << dataLength << " bytes to the reply");
+ addVirginReplyBody(dataToWrite, dataLength);
}
/**
{
const char *data = NULL;
int len;
- bool status = false;
+ bool wasThereAnException = false;
assert(flags.chunked);
assert(httpChunkDecoder);
SQUID_ENTER_THROWING_CODE();
MemBuf decodedData;
decodedData.init();
- const bool done = httpChunkDecoder->parse(readBuf,&decodedData);
+ const bool doneParsing = httpChunkDecoder->parse(readBuf,&decodedData);
len = decodedData.contentSize();
data=decodedData.content();
addVirginReplyBody(data, len);
- if (done) {
+ if (doneParsing) {
lastChunk = 1;
flags.do_next_read = 0;
}
- SQUID_EXIT_THROWING_CODE(status);
- return status;
+ SQUID_EXIT_THROWING_CODE(wasThereAnException);
+ return wasThereAnException;
}
/**
{
// we may need to grow the buffer if headers do not fit
const int minRead = flags.headers_parsed ? 0 :1024;
- const int read_sz = replyBodySpace(*readBuf, minRead);
+ const int read_size = replyBodySpace(*readBuf, minRead);
debugs(11,9, HERE << (flags.do_next_read ? "may" : "wont") <<
- " read up to " << read_sz << " bytes from FD " << fd);
+ " read up to " << read_size << " bytes from FD " << fd);
/*
* why <2? Because delayAwareRead() won't actually read if
* handler until we get a notification from someone that
* its okay to read again.
*/
- if (read_sz < 2)
+ if (read_size < 2)
return;
if (flags.do_next_read) {
flags.do_next_read = 0;
typedef CommCbMemFunT<HttpStateData, CommIoCbParams> Dialer;
- entry->delayAwareRead(fd, readBuf->space(read_sz), read_sz,
+ entry->delayAwareRead(fd, readBuf->space(read_size), read_size,
asyncCall(11, 5, "HttpStateData::readReply",
Dialer(this, &HttpStateData::readReply)));
}
/* build request prefix and append it to a given MemBuf;
* return the length of the prefix */
mb_size_t
-HttpStateData::buildRequestPrefix(HttpRequest * request,
- HttpRequest * orig_request,
- StoreEntry * entry,
+HttpStateData::buildRequestPrefix(HttpRequest * aRequest,
+ HttpRequest * original_request,
+ StoreEntry * sentry,
MemBuf * mb,
- http_state_flags flags)
+ http_state_flags stateFlags)
{
const int offset = mb->size;
HttpVersion httpver(1, 0);
mb->Printf("%s %s HTTP/%d.%d\r\n",
- RequestMethodStr(request->method),
- request->urlpath.size() ? request->urlpath.termedBuf() : "/",
+ RequestMethodStr(aRequest->method),
+ aRequest->urlpath.size() ? aRequest->urlpath.termedBuf() : "/",
httpver.major,httpver.minor);
/* build and pack headers */
{
HttpHeader hdr(hoRequest);
Packer p;
- httpBuildRequestHeader(request, orig_request, entry, &hdr, flags);
+ httpBuildRequestHeader(aRequest, original_request, sentry, &hdr, stateFlags);
- if (request->flags.pinned && request->flags.connection_auth)
- request->flags.auth_sent = 1;
+ if (aRequest->flags.pinned && aRequest->flags.connection_auth)
+ aRequest->flags.auth_sent = 1;
else if (hdr.has(HDR_AUTHORIZATION))
- request->flags.auth_sent = 1;
+ aRequest->flags.auth_sent = 1;
packerToMemInit(&p, mb);
hdr.packInto(&p);
struct addrinfo *from = NULL;
// struct ip6_hdr *ip = NULL;
static char *pkt = NULL;
- struct icmp6_hdr *icmp6 = NULL;
+ struct icmp6_hdr *icmp6header = NULL;
icmpEchoData *echo = NULL;
struct timeval now;
static pingerReplyData preply;
);
*/
- icmp6 = (struct icmp6_hdr *) pkt;
+ icmp6header = (struct icmp6_hdr *) pkt;
pkt += sizeof(icmp6_hdr);
- if (icmp6->icmp6_type != ICMP6_ECHO_REPLY) {
+ if (icmp6header->icmp6_type != ICMP6_ECHO_REPLY) {
- switch (icmp6->icmp6_type) {
+ switch (icmp6header->icmp6_type) {
case 134:
case 135:
case 136:
break;
default:
- debugs(42, 8, HERE << preply.from << " said: " << icmp6->icmp6_type << "/" << (int)icmp6->icmp6_code << " " <<
- ( icmp6->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6->icmp6_type&0x7f)] )
+ debugs(42, 8, HERE << preply.from << " said: " << icmp6header->icmp6_type << "/" << (int)icmp6header->icmp6_code << " " <<
+ ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] )
);
}
return;
}
- if (icmp6->icmp6_id != icmp_ident) {
- debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6->icmp6_id << "'");
+ if (icmp6header->icmp6_id != icmp_ident) {
+ debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6header->icmp6_id << "'");
return;
}
}
Log(preply.from,
- icmp6->icmp6_type,
- ( icmp6->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6->icmp6_type&0x7f)] ),
+ icmp6header->icmp6_type,
+ ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ),
preply.rtt,
preply.hops);
{
public:
- SignalEngine(EventLoop &loop) : loop(loop) {}
+ SignalEngine(EventLoop &evtLoop) : loop(evtLoop) {}
virtual int checkEvents(int timeout);
private:
/* ick */
-static void
+void
memFree2K(void *p)
{
memFree(p, MEM_2K_BUF);
memFree(p, MEM_8K_BUF);
}
-static void
+void
memFree16K(void *p)
{
memFree(p, MEM_16K_BUF);
}
-static void
+void
memFree32K(void *p)
{
memFree(p, MEM_32K_BUF);
}
-static void
+void
memFree64K(void *p)
{
memFree(p, MEM_64K_BUF);
SQUIDCEXTERN void clientdbUpdate(const IpAddress &, log_type, protocol_t, size_t);
SQUIDCEXTERN int clientdbCutoffDenied(const IpAddress &);
-SQUIDCEXTERN void clientdbDump(StoreEntry *);
+void clientdbDump(StoreEntry *);
SQUIDCEXTERN void clientdbFreeMemory(void);
SQUIDCEXTERN int clientdbEstablished(const IpAddress &, int);
SQUIDCEXTERN void *memAllocBuf(size_t net_size, size_t * gross_size);
SQUIDCEXTERN void *memReallocBuf(void *buf, size_t net_size, size_t * gross_size);
SQUIDCEXTERN void memFree(void *, int type);
-SQUIDCEXTERN void memFree4K(void *);
-SQUIDCEXTERN void memFree8K(void *);
+void memFree2K(void *);
+void memFree4K(void *);
+void memFree8K(void *);
+void memFree16K(void *);
+void memFree32K(void *);
+void memFree64K(void *);
SQUIDCEXTERN void memFreeString(size_t size, void *);
SQUIDCEXTERN void memFreeBuf(size_t size, void *);
SQUIDCEXTERN FREE *memFreeBufFunc(size_t size);
if ((NCountHist % COUNT_INTERVAL) == 0) {
/* we have an hours worth of readings. store previous hour */
- StatCounters *t = &CountHourHist[0];
- StatCounters *p = &CountHourHist[1];
- StatCounters *c = &CountHist[N_COUNT_HIST - 1];
+ StatCounters *t2 = &CountHourHist[0];
+ StatCounters *p2 = &CountHourHist[1];
+ StatCounters *c2 = &CountHist[N_COUNT_HIST - 1];
statCountersClean(CountHourHist + N_COUNT_HOUR_HIST - 1);
- xmemmove(p, t, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters));
- statCountersCopy(t, c);
+ xmemmove(p2, t2, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters));
+ statCountersCopy(t2, c2);
NCountHourHist++;
}
swap_dirn = -1;
}
-StoreEntry::StoreEntry(const char *url, const char *log_url)
+StoreEntry::StoreEntry(const char *aUrl, const char *aLogUrl)
{
debugs(20, 3, HERE << "new StoreEntry " << this);
- mem_obj = new MemObject(url, log_url);
+ mem_obj = new MemObject(aUrl, aLogUrl);
expires = lastmod = lastref = timestamp = -1;
}
void
-StoreEntry::createMemObject(const char *url, const char *log_url)
+StoreEntry::createMemObject(const char *aUrl, const char *aLogUrl)
{
if (mem_obj)
return;
- mem_obj = new MemObject(url, log_url);
+ mem_obj = new MemObject(aUrl, aLogUrl);
}
/* this just sets DELAY_SENDING */
void
StoreController::get
-(String const key, STOREGETCLIENT callback, void *cbdata)
+(String const key, STOREGETCLIENT aCallback, void *aCallbackData)
{
fatal("not implemented");
}
void
StoreHashIndex::get
-(String const key, STOREGETCLIENT callback, void *cbdata)
+(String const key, STOREGETCLIENT aCallback, void *aCallbackData)
{
fatal("not implemented");
}
{}
void
-StoreSearchHashIndex::next(void (callback)(void *cbdata), void *cbdata)
+StoreSearchHashIndex::next(void (aCallback)(void *), void *aCallbackData)
{
next();
- callback (cbdata);
+ aCallback (aCallbackData);
}
bool
{
char buf[MAXPATHLEN];
int l;
- int x;
+ int bytes_written;
static int queuelen = 0;
if (unlinkd_wfd < 0) {
* decrement the queue size by the number of newlines read.
*/
if (queuelen > 0) {
- int x;
+ int bytes_read;
int i;
char rbuf[512];
- x = read(unlinkd_rfd, rbuf, 511);
+ bytes_read = read(unlinkd_rfd, rbuf, 511);
- if (x > 0) {
- rbuf[x] = '\0';
+ if (bytes_read > 0) {
+ rbuf[bytes_read] = '\0';
- for (i = 0; i < x; i++)
+ for (i = 0; i < bytes_read; i++)
if ('\n' == rbuf[i])
queuelen--;
assert(l < MAXPATHLEN);
xstrncpy(buf, path, MAXPATHLEN);
buf[l++] = '\n';
- x = write(unlinkd_wfd, buf, l);
+ bytes_written = write(unlinkd_wfd, buf, l);
- if (x < 0) {
+ if (bytes_written < 0) {
debugs(2, 1, "unlinkdUnlink: write FD " << unlinkd_wfd << " failed: " << xstrerror());
safeunlink(path, 0);
return;
- } else if (x != l) {
- debugs(2, 1, "unlinkdUnlink: FD " << unlinkd_wfd << " only wrote " << x << " of " << l << " bytes");
+ } else if (bytes_written != l) {
+ debugs(2, 1, "unlinkdUnlink: FD " << unlinkd_wfd << " only wrote " << bytes_written << " of " << l << " bytes");
safeunlink(path, 0);
return;
}
public:
~WhoisState();
- void readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrno);
- void setReplyToOK(StoreEntry *entry);
+ void readReply (int fd, char *aBuffer, size_t aBufferLength, comm_err_t flag, int xerrno);
+ void setReplyToOK(StoreEntry *sentry);
StoreEntry *entry;
HttpRequest *request;
FwdState::Pointer fwd;
}
void
-WhoisState::setReplyToOK(StoreEntry *entry)
+WhoisState::setReplyToOK(StoreEntry *sentry)
{
HttpReply *reply = new HttpReply;
- entry->buffer();
+ sentry->buffer();
HttpVersion version(1, 0);
reply->setHeaders(version, HTTP_OK, "Gatewaying", "text/plain", -1, -1, -2);
- entry->replaceHttpReply(reply);
+ sentry->replaceHttpReply(reply);
}
void
-WhoisState::readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrno)
+WhoisState::readReply (int fd, char *aBuffer, size_t aBufferLength, comm_err_t flag, int xerrno)
{
int do_next_read = 0;
return;
}
- buf[len] = '\0';
- debugs(75, 3, "whoisReadReply: FD " << fd << " read " << len << " bytes");
- debugs(75, 5, "{" << buf << "}");
+ aBuffer[aBufferLength] = '\0';
+ debugs(75, 3, "whoisReadReply: FD " << fd << " read " << aBufferLength << " bytes");
+ debugs(75, 5, "{" << aBuffer << "}");
- if (flag == COMM_OK && len > 0) {
+ if (flag == COMM_OK && aBufferLength > 0) {
if (!dataWritten)
setReplyToOK(entry);
- kb_incr(&statCounter.server.all.kbytes_in, len);
+ kb_incr(&statCounter.server.all.kbytes_in, aBufferLength);
- kb_incr(&statCounter.server.http.kbytes_in, len);
+ kb_incr(&statCounter.server.http.kbytes_in, aBufferLength);
/* No range support, we always grab it all */
dataWritten = true;
- entry->append(buf, len);
+ entry->append(aBuffer, aBufferLength);
entry->flush();
do_next_read = 1;
- } else if (flag != COMM_OK || len < 0) {
+ } else if (flag != COMM_OK || aBufferLength < 0) {
debugs(50, 2, "whoisReadReply: FD " << fd << ": read failure: " << xstrerror() << ".");
if (ignoreErrno(errno)) {
}
if (do_next_read)
- comm_read(fd, buf, BUFSIZ, whoisReadReply, this);
+ comm_read(fd, aBuffer, BUFSIZ, whoisReadReply, this);
}
static void
iaddr.SetPort(port);
if (client_comm_connect(conn, iaddr, ping ? &tv1 : NULL) < 0) {
- char buf[MAX_IPSTRLEN];
- iaddr.ToURL(buf, MAX_IPSTRLEN);
+ char hostnameBuf[MAX_IPSTRLEN];
+ iaddr.ToURL(hostnameBuf, MAX_IPSTRLEN);
if (errno == 0) {
- fprintf(stderr, "client: ERROR: Cannot connect to %s: Host unknown.\n", buf);
+ fprintf(stderr, "client: ERROR: Cannot connect to %s: Host unknown.\n", hostnameBuf);
} else {
char tbuf[BUFSIZ];
- snprintf(tbuf, BUFSIZ, "client: ERROR: Cannot connect to %s", buf);
+ snprintf(tbuf, BUFSIZ, "client: ERROR: Cannot connect to %s", hostnameBuf);
perror(tbuf);
}
exit(1);