--- /dev/null
+
+/*
+ * $Id: AccessLogEntry.h,v 1.1 2003/09/01 03:49:37 robertc Exp $
+ *
+ *
+ * SQUID Web Proxy Cache http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ * Squid is the result of efforts by numerous individuals from
+ * the Internet community; see the CONTRIBUTORS file for full
+ * details. Many organizations have provided support for Squid's
+ * development; see the SPONSORS file for full details. Squid is
+ * Copyrighted (C) 2001 by the Regents of the University of
+ * California; see the COPYRIGHT file for full details. Squid
+ * incorporates software developed and/or copyrighted by other
+ * sources; see the CREDITS file for full details.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
+ */
+
+#ifndef SQUID_HTTPACCESSLOGENTRY_H
+#define SQUID_HTTPACCESSLOGENTRY_H
+
+#include "HttpVersion.h"
+
+class AccessLogEntry
+{
+
+public:
+ AccessLogEntry() : url(NULL) , reply(NULL), request(NULL) {}
+
+ const char *url;
+
+ class HttpDetails
+ {
+
+ public:
+ HttpDetails() : method(METHOD_NONE), code(0), content_type(NULL) {}
+
+ method_t method;
+ int code;
+ const char *content_type;
+ HttpVersion version;
+ }
+
+ http;
+
+ class ICPDetails
+ {
+
+ public:
+ ICPDetails() : opcode(ICP_INVALID) {}
+
+ icp_opcode opcode;
+ }
+
+ icp;
+
+ class CacheDetails
+ {
+
+ public:
+ CacheDetails() : size(0),
+ highOffset(0),
+ objectSize(0),
+ code (LOG_TAG_NONE),
+ msec(0),
+ rfc931 (NULL),
+ authuser (NULL),
+ extuser(NULL)
+#if USE_SSL
+ ,ssluser(NULL)
+#endif
+ {
+ memset(&caddr, '\0', sizeof(caddr));
+ }
+
+ struct in_addr caddr;
+ size_t size;
+ off_t highOffset;
+ size_t objectSize;
+ log_type code;
+ int msec;
+ const char *rfc931;
+ const char *authuser;
+#if USE_SSL
+
+ const char *ssluser;
+#endif
+
+ const char *extuser;
+
+ }
+
+ cache;
+
+ class Headers
+ {
+
+ public:
+ Headers() : request(NULL), reply(NULL) {}
+
+ char *request;
+ char *reply;
+ }
+
+ headers;
+
+ class Private
+ {
+
+ public:
+ Private() : method_str(NULL) {}
+
+ const char *method_str;
+ }
+
+ _private;
+ HierarchyLogEntry hier;
+ HttpReply *reply;
+ HttpRequest *request;
+};
+
+/* Should be in 'AccessLog.h' as the driver */
+SQUIDCEXTERN void accessLogLog(AccessLogEntry *, ACLChecklist * checklist);
+SQUIDCEXTERN void accessLogRotate(void);
+SQUIDCEXTERN void accessLogClose(void);
+SQUIDCEXTERN void accessLogInit(void);
+SQUIDCEXTERN void accessLogFreeMemory(AccessLogEntry * aLogEntry);
+SQUIDCEXTERN const char *accessLogTime(time_t);
+SQUIDCEXTERN int accessLogParseLogFormat(logformat_token ** fmt, char *def);
+SQUIDCEXTERN void accessLogDumpLogFormat(StoreEntry * entry, const char *name, logformat * definitions);
+SQUIDCEXTERN void accessLogFreeLogFormat(logformat_token ** fmt);
+
+#endif /* SQUID_HTTPACCESSLOGENTRY_H */
/*
- * $Id: HttpHeader.h,v 1.6 2003/07/15 06:50:39 robertc Exp $
+ * $Id: HttpHeader.h,v 1.7 2003/09/01 03:49:37 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
field_type type;
};
+class HttpVersion;
+
extern int httpHeaderParseQuotedString (const char *start, String *val);
extern void httpHeaderPutSc(HttpHeader *hdr, const HttpHdrSc *sc);
extern HttpHdrSc *httpHeaderGetSc(const HttpHeader *hdr);
SQUIDCEXTERN void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, ssize_t);
extern int httpHeaderHasListMember(const HttpHeader * hdr, http_hdr_type id, const char *member, const char separator);
SQUIDCEXTERN void httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, const HttpHeaderMask * denied_mask);
+int httpMsgIsPersistent(HttpVersion const &http_ver, const HttpHeader * hdr);
class HttpHeader
{
/*
- * $Id: HttpMsg.cc,v 1.12 2003/02/21 22:50:05 robertc Exp $
+ * $Id: HttpMsg.cc,v 1.13 2003/09/01 03:49:37 robertc Exp $
*
* DEBUG: section 74 HTTP Message
* AUTHOR: Alex Rousskov
*/
#include "squid.h"
-
+#include "HttpVersion.h"
/* find end of headers */
int
/* returns true if connection should be "persistent"
* after processing this message */
int
-httpMsgIsPersistent(http_version_t http_ver, const HttpHeader * hdr)
+httpMsgIsPersistent(HttpVersion const &http_ver, const HttpHeader * hdr)
{
if ((http_ver.major >= 1) && (http_ver.minor >= 1)) {
/*
/*
- * $Id: HttpReply.cc,v 1.62 2003/07/15 06:50:39 robertc Exp $
+ * $Id: HttpReply.cc,v 1.63 2003/09/01 03:49:37 robertc Exp $
*
* DEBUG: section 58 HTTP Reply (Response)
* AUTHOR: Alex Rousskov
}
MemBuf
-httpPackedReply(http_version_t ver, http_status status, const char *ctype,
+httpPackedReply(HttpVersion ver, http_status status, const char *ctype,
int clen, time_t lmt, time_t expires)
{
HttpReply *rep = httpReplyCreate();
HttpReply *rv;
int t;
HttpHeaderEntry *e;
- http_version_t ver;
assert(rep);
rv = httpReplyCreate ();
/* rv->cache_control */
/* rv->content_range */
/* rv->keep_alive */
- httpBuildVersion(&ver, 1, 0);
+ HttpVersion ver(1,0);
httpStatusLineSet(&rv->sline, ver,
HTTP_NOT_MODIFIED, "");
}
void
-httpReplySetHeaders(HttpReply * reply, http_version_t ver, http_status status, const char *reason,
+httpReplySetHeaders(HttpReply * reply, HttpVersion ver, http_status status, const char *reason,
const char *ctype, int clen, time_t lmt, time_t expires)
{
HttpHeader *hdr;
httpRedirectReply(HttpReply * reply, http_status status, const char *loc)
{
HttpHeader *hdr;
- http_version_t ver;
assert(reply);
- httpBuildVersion(&ver, 1, 0);
+ HttpVersion ver(1,0);
httpStatusLineSet(&reply->sline, ver, status, httpStatusString(status));
hdr = &reply->header;
httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string);
/*
- * $Id: HttpReply.h,v 1.5 2003/07/15 06:50:39 robertc Exp $
+ * $Id: HttpReply.h,v 1.6 2003/09/01 03:49:37 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "typedefs.h"
#include "HttpHeader.h"
+#include "HttpStatusLine.h"
/* Http Reply */
extern void httpReplyInitModule(void);
/* swap: create swap-based packer, pack, destroy packer */
extern void httpReplySwapOut(HttpReply * rep, StoreEntry * e);
/* set commonly used info with one call */
-extern void httpReplySetHeaders(HttpReply * rep, http_version_t ver, http_status status,
+extern void httpReplySetHeaders(HttpReply * rep, HttpVersion ver, http_status status,
const char *reason, const char *ctype, int clen, time_t lmt, time_t expires);
/* do everything in one call: init, set, pack, clean, return MemBuf */
-extern MemBuf httpPackedReply(http_version_t ver, http_status status, const char *ctype,
+extern MemBuf httpPackedReply(HttpVersion ver, http_status status, const char *ctype,
int clen, time_t lmt, time_t expires);
/* construct 304 reply and pack it into MemBuf, return MemBuf */
extern MemBuf httpPacked304Reply(const HttpReply * rep);
/*
- * $Id: HttpRequest.cc,v 1.44 2003/08/14 12:15:04 robertc Exp $
+ * $Id: HttpRequest.cc,v 1.45 2003/09/01 03:49:37 robertc Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
request_flags flags;
HttpHdrCc *cache_control;
HttpHdrRange *range;
- http_version_t http_ver;
+ HttpVersion http_ver;
time_t ims;
int imslen;
int max_forwards;
/*
- * $Id: HttpRequest.h,v 1.7 2003/08/10 11:00:40 robertc Exp $
+ * $Id: HttpRequest.h,v 1.8 2003/09/01 03:49:37 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "typedefs.h"
#include "HttpHeader.h"
#include "client_side.h"
+#include "HttpVersion.h"
/* Http Request */
extern HttpRequest *requestCreate(method_t, protocol_t, const char *urlpath);
request_flags flags;
HttpHdrCc *cache_control;
HttpHdrRange *range;
- http_version_t http_ver;
+ HttpVersion http_ver;
time_t ims;
int imslen;
int max_forwards;
/*
- * $Id: HttpStatusLine.cc,v 1.27 2003/02/21 22:50:05 robertc Exp $
+ * $Id: HttpStatusLine.cc,v 1.28 2003/09/01 03:49:37 robertc Exp $
*
* DEBUG: section 57 HTTP Status-line
* AUTHOR: Alex Rousskov
*/
#include "squid.h"
-
+#include "HttpStatusLine.h"
/* local constants */
const char *HttpStatusLineFormat = "HTTP/%d.%d %3d %s\r\n";
void
httpStatusLineInit(HttpStatusLine * sline)
{
- http_version_t version;
- httpBuildVersion(&version, 0, 0);
+ HttpVersion version;
httpStatusLineSet(sline, version, HTTP_STATUS_NONE, NULL);
}
void
httpStatusLineClean(HttpStatusLine * sline)
{
- http_version_t version;
- httpBuildVersion(&version, 0, 0);
+ HttpVersion version;
httpStatusLineSet(sline, version, HTTP_INTERNAL_SERVER_ERROR, NULL);
}
/* set values */
void
-httpStatusLineSet(HttpStatusLine * sline, http_version_t version, http_status status, const char *reason)
+httpStatusLineSet(HttpStatusLine * sline, HttpVersion version, http_status status, const char *reason)
{
assert(sline);
sline->version = version;
--- /dev/null
+
+/*
+ * $Id: HttpStatusLine.h,v 1.1 2003/09/01 03:49:37 robertc Exp $
+ *
+ *
+ * SQUID Web Proxy Cache http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ * Squid is the result of efforts by numerous individuals from
+ * the Internet community; see the CONTRIBUTORS file for full
+ * details. Many organizations have provided support for Squid's
+ * development; see the SPONSORS file for full details. Squid is
+ * Copyrighted (C) 2001 by the Regents of the University of
+ * California; see the COPYRIGHT file for full details. Squid
+ * incorporates software developed and/or copyrighted by other
+ * sources; see the CREDITS file for full details.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
+ */
+
+#ifndef SQUID_HTTPSTATUSLINE_H
+#define SQUID_HTTPSTATUSLINE_H
+
+#include "HttpVersion.h"
+
+class HttpStatusLine
+{
+
+public:
+ /* public, read only */
+ HttpVersion version;
+ const char *reason; /* points to a _constant_ string (default or supplied), never free()d */
+ http_status status;
+};
+
+/* init/clean */
+SQUIDCEXTERN void httpStatusLineInit(HttpStatusLine * sline);
+SQUIDCEXTERN void httpStatusLineClean(HttpStatusLine * sline);
+/* set/get values */
+SQUIDCEXTERN void httpStatusLineSet(HttpStatusLine * sline, HttpVersion version,
+ http_status status, const char *reason);
+SQUIDCEXTERN const char *httpStatusLineReason(const HttpStatusLine * sline);
+/* parse/pack */
+/* parse a 0-terminating buffer and fill internal structires; returns true on success */
+SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const char *start,
+ const char *end);
+/* pack fields using Packer */
+SQUIDCEXTERN void httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p);
+
+#endif /* SQUID_HTTPSTATUSLINE_H */
--- /dev/null
+
+/*
+ * $Id: HttpVersion.h,v 1.1 2003/09/01 03:49:37 robertc Exp $
+ *
+ *
+ * SQUID Web Proxy Cache http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ * Squid is the result of efforts by numerous individuals from
+ * the Internet community; see the CONTRIBUTORS file for full
+ * details. Many organizations have provided support for Squid's
+ * development; see the SPONSORS file for full details. Squid is
+ * Copyrighted (C) 2001 by the Regents of the University of
+ * California; see the COPYRIGHT file for full details. Squid
+ * incorporates software developed and/or copyrighted by other
+ * sources; see the CREDITS file for full details.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
+ */
+
+#ifndef SQUID_HTTPVERSION_H
+#define SQUID_HTTPVERSION_H
+
+class HttpVersion
+{
+
+public:
+ HttpVersion()
+ {
+ major = 0;
+ minor = 0;
+ }
+
+ HttpVersion(unsigned int aMajor, unsigned int aMinor)
+ {
+ major = aMajor;
+ minor = aMinor;
+ }
+
+ unsigned int major;
+ unsigned int minor;
+};
+
+#endif /* SQUID_HTTPVERSION_H */
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.am,v 1.89 2003/08/14 23:21:51 robertc Exp $
+# $Id: Makefile.am,v 1.90 2003/09/01 03:49:37 robertc Exp $
#
# Uncomment and customize the following to suit your needs:
#
squid_SOURCES = \
access_log.cc \
+ AccessLogEntry.h \
acl.cc \
ACL.h \
ACLChecklist.cc \
http.cc \
http.h \
HttpStatusLine.cc \
+ HttpStatusLine.h \
HttpHdrCc.cc \
HttpHdrRange.cc \
HttpHdrSc.cc \
HttpReply.h \
HttpRequest.cc \
HttpRequest.h \
+ HttpVersion.h \
icmp.cc \
ICP.h \
icp_v2.cc \
/*
- * $Id: access_log.cc,v 1.94 2003/08/20 13:34:41 hno Exp $
+ * $Id: access_log.cc,v 1.95 2003/09/01 03:49:37 robertc Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
#include "squid.h"
+#include "AccessLogEntry.h"
// Store.h Required by configuration directives parsing/dumping only
#include "Store.h"
/*
- * $Id: cache_cf.cc,v 1.449 2003/08/31 21:20:08 robertc Exp $
+ * $Id: cache_cf.cc,v 1.450 2003/09/01 03:49:37 robertc Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
}
}
+#include "AccessLogEntry.h"
+/* TODO: split out parsing somehow ...*/
static void
parse_logformat(logformat ** logformat_definitions)
{
/*
- * $Id: cache_manager.cc,v 1.30 2003/08/10 11:00:42 robertc Exp $
+ * $Id: cache_manager.cc,v 1.31 2003/09/01 03:49:38 robertc Exp $
*
* DEBUG: section 16 Cache Manager Objects
* AUTHOR: Duane Wessels
storeBuffer(entry);
{
- http_version_t version;
+ HttpVersion version(1,0);
HttpReply *rep = httpReplyCreate();
- httpBuildVersion(&version, 1, 0);
httpReplySetHeaders(rep,
version,
HTTP_OK,
/*
- * $Id: client_side.cc,v 1.657 2003/08/14 12:15:04 robertc Exp $
+ * $Id: client_side.cc,v 1.658 2003/09/01 03:49:38 robertc Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
#if UNUSED_CODE
static void trimTrailingSpaces(char *aString, size_t len);
#endif
-static ClientSocketContext *parseURIandHTTPVersion(char **url_p, http_version_t * http_ver_p, ConnStateData::Pointer& conn, char *http_version_str);
+static ClientSocketContext *parseURIandHTTPVersion(char **url_p, HttpVersion * http_ver_p, ConnStateData::Pointer& conn, char *http_version_str);
static void setLogUri(clientHttpRequest * http, char const *uri);
static int connReadWasError(ConnStateData::Pointer& conn, comm_err_t, int size, int xerrno);
static int connFinishedWithConn(ConnStateData::Pointer& conn, int size);
if (!Config.onoff.client_pconns)
request->flags.proxy_keepalive = 0;
else {
- http_version_t http_ver;
- httpBuildVersion(&http_ver, 1, 0);
+ HttpVersion http_ver(1,0);
/* we are HTTP/1.0, no matter what the client requests... */
if (httpMsgIsPersistent(http_ver, req_hdr))
#endif
static ClientSocketContext *
-parseURIandHTTPVersion(char **url_p, http_version_t * http_ver_p,
+parseURIandHTTPVersion(char **url_p, HttpVersion * http_ver_p,
ConnStateData::Pointer & conn, char *http_version_str)
{
char *url;
debug(33, 6) ("parseHttpRequest: Client HTTP version %d.%d.\n",
http_ver_p->major, http_ver_p->minor);
} else {
- httpBuildVersion(http_ver_p, 0, 9); /* wild guess */
+ *http_ver_p = HttpVersion(0,9); /* wild guess */
}
return NULL;
/* Utility function to perform part of request parsing */
static ClientSocketContext *
clientParseHttpRequestLine(char *reqline, ConnStateData::Pointer &conn,
- method_t * method_p, char **url_p, http_version_t * http_ver_p, char * http_version_str)
+ method_t * method_p, char **url_p, HttpVersion * http_ver_p, char * http_version_str)
{
ClientSocketContext *result = NULL;
/* XXX: This sequence relies on strtok() */
char *url = NULL;
char *req_hdr = NULL;
char *t;
- http_version_t http_ver;
+ HttpVersion http_ver;
char *end;
size_t header_sz; /* size of headers, not including first line */
size_t prefix_sz; /* size of whole request (req-line + headers) */
/*
- * $Id: client_side_reply.cc,v 1.66 2003/08/19 22:30:36 robertc Exp $
+ * $Id: client_side_reply.cc,v 1.67 2003/09/01 03:49:38 robertc Exp $
*
* DEBUG: section 88 Client-side Reply Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
}
HttpReply *r;
- http_version_t version;
/* And for Vary, release the base URI if none of the headers was included in the request */
r = httpReplyCreate();
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1,0);
httpReplySetHeaders(r, version, purgeStatus, NULL, NULL, 0, 0, -1);
clientReplyContext::traceReply(clientStreamNode * node)
{
HttpReply *rep;
- http_version_t version;
clientStreamNode *next = (clientStreamNode *)node->node.next->data;
StoreIOBuffer tempBuffer;
assert(http->request->max_forwards == 0);
storeReleaseRequest(http->storeEntry());
storeBuffer(http->storeEntry());
rep = httpReplyCreate();
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1,0);
httpReplySetHeaders(rep, version, HTTP_OK, NULL, "text/plain",
httpRequestPrefixLen(http->request), 0, squid_curtime);
httpReplySwapOut(rep, http->storeEntry());
}
/* enforce 1.0 reply version */
- httpBuildVersion(&holdingReply->sline.version, 1, 0);
+ holdingReply->sline.version = HttpVersion(1,0);
/* do header conversions */
buildReplyHeader();
/*
- * $Id: client_side_request.cc,v 1.32 2003/08/13 00:17:26 robertc Exp $
+ * $Id: client_side_request.cc,v 1.33 2003/09/01 03:49:38 robertc Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
char *tailbuf, size_t taillen)
{
size_t url_sz;
- http_version_t http_ver =
- {1, 0};
+ HttpVersion http_ver (1, 0);
clientHttpRequest *http = new ClientHttpRequest;
HttpRequest *request;
StoreIOBuffer tempBuffer;
/*
- * $Id: client_side_request.h,v 1.18 2003/08/13 00:17:26 robertc Exp $
+ * $Id: client_side_request.h,v 1.19 2003/09/01 03:49:38 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "HttpHeader.h"
#include "clientStream.h"
#include "client_side.h"
+#include "AccessLogEntry.h"
/* client_side_request.c - client side request related routines (pure logic) */
extern int clientBeginRequest(method_t, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t);
log_type logType;
struct timeval start;
- http_version_t http_ver;
+ HttpVersion http_ver;
AccessLogEntry al;
struct
/*
- * $Id: errorpage.cc,v 1.190 2003/08/10 11:00:42 robertc Exp $
+ * $Id: errorpage.cc,v 1.191 2003/09/01 03:49:38 robertc Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
{
HttpReply *rep = httpReplyCreate();
const char *name = errorPageName(err->page_id);
- http_version_t version;
/* no LMT for error pages; error pages expire immediately */
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
if (strchr(name, ':')) {
/* Redirection */
/*
- * $Id: store_dir_coss.cc,v 1.50 2003/08/31 21:20:10 robertc Exp $
+ * $Id: store_dir_coss.cc,v 1.51 2003/09/01 03:49:42 robertc Exp $
*
* DEBUG: section 47 Store COSS Directory Routines
* AUTHOR: Eric Stern
max_size = size;
+ parseOptions(0);
+
/* Enforce maxobjsize being set to something */
if (max_objsize == -1)
fatal("COSS requires max-size to be set to something other than -1!\n");
/*
- * $Id: ftp.cc,v 1.353 2003/08/10 11:00:43 robertc Exp $
+ * $Id: ftp.cc,v 1.354 2003/09/01 03:49:38 robertc Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
const char *t = NULL;
StoreEntry *e = ftpState->entry;
HttpReply *reply = httpReplyCreate ();
- http_version_t version;
if (ftpState->flags.http_header_sent)
return;
HttpHdrRangeSpec range_spec;
range_spec.offset = ftpState->restarted_offset;
range_spec.length = ftpState->size - ftpState->restarted_offset;
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
httpReplySetHeaders(reply, version, HTTP_PARTIAL_CONTENT, "Gatewaying",
mime_type, ftpState->size - ftpState->restarted_offset, ftpState->mdtm, -2);
httpHeaderAddContRange(&reply->header, range_spec, ftpState->size);
} else {
/* Full reply */
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying",
mime_type, ftpState->size, ftpState->mdtm, -2);
}
/*
- * $Id: http.cc,v 1.426 2003/08/10 11:00:43 robertc Exp $
+ * $Id: http.cc,v 1.427 2003/09/01 03:49:38 robertc Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
http_state_flags flags)
{
const int offset = mb->size;
- http_version_t httpver;
- httpBuildVersion(&httpver, 1, 0);
+ HttpVersion httpver(1, 0);
memBufPrintf(mb, "%s %s HTTP/%d.%d\r\n",
RequestMethodStr[request->method],
request->urlpath.size() ? request->urlpath.buf() : "/",
}
void
-httpBuildVersion(http_version_t * version, unsigned int major, unsigned int minor)
+httpBuildVersion(HttpVersion * version, unsigned int major, unsigned int minor)
{
version->major = major;
version->minor = minor;
/*
- * $Id: icp_v2.cc,v 1.82 2003/08/10 11:00:43 robertc Exp $
+ * $Id: icp_v2.cc,v 1.83 2003/09/01 03:49:39 robertc Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
#include "HttpRequest.h"
#include "ACLChecklist.h"
#include "ACL.h"
+#include "AccessLogEntry.h"
static void icpLogIcp(struct in_addr, log_type, int, const char *, int);
if (!Config.onoff.log_udp)
return;
- memset(&al, '\0', sizeof(al));
-
al.icp.opcode = ICP_QUERY;
al.url = url;
/*
- * $Id: internal.cc,v 1.29 2003/08/10 11:00:43 robertc Exp $
+ * $Id: internal.cc,v 1.30 2003/09/01 03:49:39 robertc Exp $
*
* DEBUG: section 76 Internal Squid Object handling
* AUTHOR: Duane, Alex, Henrik
{
ErrorState *err;
const char *upath = request->urlpath.buf();
- http_version_t version;
debug(76, 3) ("internalStart: %s requesting '%s'\n",
inet_ntoa(request->client_addr), upath);
const char *msgbuf = "This cache does not suport Cache Digests.\n";
#endif
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
HttpReply *reply = httpReplyCreate ();
httpReplySetHeaders(reply,
version,
/*
- * $Id: main.cc,v 1.387 2003/08/31 01:22:05 robertc Exp $
+ * $Id: main.cc,v 1.388 2003/09/01 03:49:39 robertc Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
*/
#include "squid.h"
+#include "AccessLogEntry.h"
#include "authenticate.h"
#include "Store.h"
#include "ICP.h"
/*
- * $Id: mime.cc,v 1.113 2003/08/10 11:00:43 robertc Exp $
+ * $Id: mime.cc,v 1.114 2003/09/01 03:49:39 robertc Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
char *buf;
- http_version_t version;
-
-
snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon);
fd = file_open(path, O_RDONLY | O_BINARY);
HttpReply *reply = httpReplyCreate();
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
httpReplySetHeaders(reply, version, HTTP_OK, NULL,
mimeGetContentType(icon), (int) sb.st_size, sb.st_mtime, -1);
/*
- * $Id: net_db.cc,v 1.172 2003/08/10 11:00:44 robertc Exp $
+ * $Id: net_db.cc,v 1.173 2003/09/01 03:49:39 robertc Exp $
*
* DEBUG: section 38 Network Measurement Database
* AUTHOR: Duane Wessels
netdbBinaryExchange(StoreEntry * s)
{
HttpReply *reply = httpReplyCreate();
- http_version_t version;
#if USE_ICMP
netdbEntry *n;
struct in_addr addr;
storeBuffer(s);
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
httpReplySetHeaders(reply, version, HTTP_OK, "OK",
NULL, -1, squid_curtime, -2);
httpReplySwapOut(reply, s);
memFree(buf, MEM_4K_BUF);
#else
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1,0);
httpReplySetHeaders(reply, version, HTTP_BAD_REQUEST, "Bad Request",
NULL, -1, squid_curtime, -2);
httpReplySwapOut(reply, s);
requestLink(ex->r);
assert(NULL != ex->r);
- httpBuildVersion(&ex->r->http_ver, 1, 0);
+ ex->r->http_ver = HttpVersion(1,0);
ex->connstate = STATE_HEADER;
ex->e = storeCreateEntry(uri, uri, request_flags(), METHOD_GET);
ex->buf_sz = NETDB_REQBUF_SZ;
/*
- * $Id: protos.h,v 1.491 2003/08/17 13:42:04 robertc Exp $
+ * $Id: protos.h,v 1.492 2003/09/01 03:49:39 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#ifndef SQUID_PROTOS_H
#define SQUID_PROTOS_H
-SQUIDCEXTERN void accessLogLog(AccessLogEntry *, ACLChecklist * checklist);
-SQUIDCEXTERN void accessLogRotate(void);
-SQUIDCEXTERN void accessLogClose(void);
-SQUIDCEXTERN void accessLogInit(void);
-SQUIDCEXTERN void accessLogFreeMemory(AccessLogEntry * aLogEntry);
-SQUIDCEXTERN const char *accessLogTime(time_t);
-SQUIDCEXTERN int accessLogParseLogFormat(logformat_token ** fmt, char *def);
-SQUIDCEXTERN void accessLogDumpLogFormat(StoreEntry * entry, const char *name, logformat * definitions);
-SQUIDCEXTERN void accessLogFreeLogFormat(logformat_token ** fmt);
SQUIDCEXTERN void hierarchyNote(HierarchyLogEntry *, hier_code, const char *);
#if FORW_VIA_DB
SQUIDCEXTERN void fvdbCountVia(const char *key);
SQUIDCEXTERN int httpAnonHdrAllowed(http_hdr_type hdr_id);
SQUIDCEXTERN int httpAnonHdrDenied(http_hdr_type hdr_id);
SQUIDCEXTERN void httpBuildRequestHeader(HttpRequest *, HttpRequest *, StoreEntry *, HttpHeader *, http_state_flags);
-SQUIDCEXTERN void httpBuildVersion(http_version_t * version, unsigned int major, unsigned int minor);
SQUIDCEXTERN const char *httpMakeVaryMark(HttpRequest * request, HttpReply const * reply);
/* ETag */
SQUIDCEXTERN int etagParseInit(ETag * etag, const char *str);
SQUIDCEXTERN int etagIsEqual(const ETag * tag1, const ETag * tag2);
-/* Http Status Line */
-/* init/clean */
-SQUIDCEXTERN void httpStatusLineInit(HttpStatusLine * sline);
-SQUIDCEXTERN void httpStatusLineClean(HttpStatusLine * sline);
-/* set/get values */
-SQUIDCEXTERN void httpStatusLineSet(HttpStatusLine * sline, http_version_t version,
- http_status status, const char *reason);
-SQUIDCEXTERN const char *httpStatusLineReason(const HttpStatusLine * sline);
-/* parse/pack */
-/* parse a 0-terminating buffer and fill internal structires; returns true on success */
-SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const char *start,
- const char *end);
-/* pack fields using Packer */
-SQUIDCEXTERN void httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p);
SQUIDCEXTERN const char *httpStatusString(http_status status);
/* Http Body */
SQUIDCEXTERN void httpHdrMangleList(HttpHeader *, HttpRequest *);
/* Http Msg (currently in HttpReply.c @?@ ) */
-SQUIDCEXTERN int httpMsgIsPersistent(http_version_t http_ver, const HttpHeader * hdr);
SQUIDCEXTERN int httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end);
SQUIDCEXTERN void icmpOpen(void);
/*
- * $Id: store.cc,v 1.573 2003/08/10 11:00:44 robertc Exp $
+ * $Id: store.cc,v 1.574 2003/09/01 03:49:39 robertc Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
if (mem->vary_headers && !storeGetPublic(mem->url, mem->method)) {
/* Create "vary" base object */
- http_version_t version;
String vary;
pe = storeCreateEntry(mem->url, mem->log_url, request->flags, request->method);
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
/* We are allowed to do this typecast */
httpReplySetHeaders((HttpReply *)pe->getReply(), version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
vary = httpHeaderGetList(&mem->getReply()->header, HDR_VARY);
/*
- * $Id: store_digest.cc,v 1.56 2003/02/21 22:50:12 robertc Exp $
+ * $Id: store_digest.cc,v 1.57 2003/09/01 03:49:40 robertc Exp $
*
* DEBUG: section 71 Store Digest Manager
* AUTHOR: Alex Rousskov
storeDigestRewriteResume(void)
{
StoreEntry *e;
- http_version_t version;
assert(sd_state.rewrite_lock);
assert(!sd_state.rebuild_lock);
storeSetPublicKey(e);
/* fake reply */
HttpReply *rep = httpReplyCreate ();
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
httpReplySetHeaders(rep, version, HTTP_OK, "Cache Digest OK",
"application/cache-digest", store_digest->mask_size + sizeof(sd_state.cblock),
squid_curtime, squid_curtime + Config.digest.rewrite_period);
/*
- * $Id: structs.h,v 1.480 2003/08/18 12:24:45 hno Exp $
+ * $Id: structs.h,v 1.481 2003/09/01 03:49:40 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
size_t maxsize;
};
-struct _http_version_t
-{
- unsigned int major;
- unsigned int minor;
-};
#if SQUID_SNMP
void *real_handler; /* first parameter to real append and vprintf */
};
-/* http status line */
-
-struct _HttpStatusLine
-{
- /* public, read only */
- http_version_t version;
- const char *reason; /* points to a _constant_ string (default or supplied), never free()d */
- http_status status;
-};
/*
* Note: HttpBody is used only for messages with a small content that is
struct timeval store_complete_stop;
};
-struct _AccessLogEntry
-{
- /* NB: memset is used on AccessLogEntries as at 20030715 RBC */
- const char *url;
-
- struct
- {
- method_t method;
- int code;
- const char *content_type;
- http_version_t version;
- }
-
- http;
-
- struct
- {
- icp_opcode opcode;
- }
-
- icp;
-
- struct
- {
-
- struct in_addr caddr;
- size_t size;
- off_t highOffset;
- size_t objectSize;
- log_type code;
- int msec;
- const char *rfc931;
- const char *authuser;
-#if USE_SSL
-
- const char *ssluser;
-#endif
-
- const char *extuser;
-
- }
-
- cache;
-
- struct
- {
- char *request;
- char *reply;
- }
-
- headers;
-
- struct
- {
- const char *method_str;
- }
-
- _private;
- HierarchyLogEntry hier;
- HttpReply *reply;
- HttpRequest *request;
-};
struct _ipcache_addrs
{
/*
- * $Id: typedefs.h,v 1.169 2003/08/10 09:53:49 robertc Exp $
+ * $Id: typedefs.h,v 1.170 2003/09/01 03:49:40 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
typedef struct _fileMap fileMap;
-typedef struct _HttpStatusLine HttpStatusLine;
-
typedef struct _HttpHeaderFieldAttrs HttpHeaderFieldAttrs;
class HttpHeaderFieldInfo;
class HttpRequest;
-typedef struct _AccessLogEntry AccessLogEntry;
-
typedef struct _cachemgr_passwd cachemgr_passwd;
typedef struct _refresh_t refresh_t;
typedef struct _RemovalPolicySettings RemovalPolicySettings;
-typedef struct _http_version_t http_version_t;
-
#if SQUID_SNMP
typedef variable_list *(oid_ParseFn) (variable_list *, snint *);
/*
- * $Id: urn.cc,v 1.85 2003/08/10 11:00:45 robertc Exp $
+ * $Id: urn.cc,v 1.86 2003/09/01 03:49:40 robertc Exp $
*
* DEBUG: section 52 URN Parsing
* AUTHOR: Kostas Anagnostakis
ErrorState *err;
int i;
int urlcnt = 0;
- http_version_t version;
char *buf = urnState->reqbuf;
StoreIOBuffer tempBuffer;
debug(52, 3) ("urnHandleReply: Called with size=%u.\n", (unsigned int)result.length);
+ /* Can't be lower because of the goto's */
+ HttpVersion version(1, 0);
+
if (EBIT_TEST(urlres_e->flags, ENTRY_ABORTED)) {
goto error;
}
"</ADDRESS>\n",
full_appname_string, getMyHostname());
rep = httpReplyCreate();
- httpBuildVersion(&version, 1, 0);
httpReplySetHeaders(rep, version, HTTP_MOVED_TEMPORARILY, NULL,
"text/html", mb.size, 0, squid_curtime);
/*
- * $Id: whois.cc,v 1.27 2003/08/10 11:00:45 robertc Exp $
+ * $Id: whois.cc,v 1.28 2003/09/01 03:49:40 robertc Exp $
*
* DEBUG: section 75 WHOIS protocol
* AUTHOR: Duane Wessels, Kostas Anagnostakis
WhoisState::setReplyToOK(StoreEntry *entry)
{
HttpReply *reply = httpReplyCreate();
- http_version_t version;
- httpBuildVersion(&version, 1, 0);
+ HttpVersion version(1, 0);
httpReplySetHeaders(reply, version, HTTP_OK, NULL, NULL, 0, 0, -1);
storeEntryReplaceObject (entry, reply);
}