}
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)
}
static void
-read_passwd_file(const char *passwdfile, int ha1mode)
+read_passwd_file(const char *passwdfile, int isHa1Mode)
{
FILE *f;
char buf[8192];
if (strncmp(passwd, "{HHA1}", 6) == 0) {
ha1 = passwd + 6;
passwd = NULL;
- } else if (ha1mode) {
+ } else if (isHa1Mode) {
ha1 = passwd;
passwd = NULL;
}
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();
}
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");
}
}
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;
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 {
}
-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 when,
+ int weight, bool haveArgument) : name(aName), func(aFunction),
+ arg(haveArgument ? cbdataReference(aArgument) : aArgument), when(when), weight(weight),
+ cbdata(haveArgument)
{
}
* 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;
}
/**
/* 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);
{
public:
- SignalEngine(EventLoop &loop) : loop(loop) {}
+ SignalEngine(EventLoop &evtLoop) : loop(evtLoop) {}
virtual int checkEvents(int timeout);
private:
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++;
}
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");
}
{
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);