function where on the HttpRequest object.
Apply Gonzalo Aranas bugfix for the replacement to cachemgrRegister,
as having some options disabled/changed did not compile.
/*
- * $Id: HttpRequest.cc,v 1.66 2006/05/08 23:38:33 robertc Exp $
+ * $Id: HttpRequest.cc,v 1.67 2006/05/29 21:44:18 robertc Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
{
return urlParse(METHOD_GET, url, NULL);
}
+
+/*
+ * Are responses to this request possible cacheable ?
+ * If false then no matter what the response must not be cached.
+ */
+bool
+HttpRequest::cacheable() const
+{
+ if (protocol == PROTO_HTTP)
+ return httpCachable(method);
+
+ /* FTP is always cachable */
+
+ /* WAIS is never cachable */
+ if (protocol == PROTO_WAIS)
+ return 0;
+
+ /*
+ * The below looks questionable: what non HTTP protocols use connect,
+ * trace, put and post? RC
+ */
+ if (method == METHOD_CONNECT)
+ return 0;
+
+ if (method == METHOD_TRACE)
+ return 0;
+
+ if (method == METHOD_PUT)
+ return 0;
+
+ if (method == METHOD_POST)
+ return 0;
+
+ /*
+ * XXX POST may be cached sometimes.. ignored
+ * for now
+ */
+ if (protocol == PROTO_GOPHER)
+ return gopherCachable(this);
+
+ if (protocol == PROTO_CACHEOBJ)
+ return 0;
+
+ return 1;
+}
/*
- * $Id: HttpRequest.h,v 1.22 2006/05/08 23:38:33 robertc Exp $
+ * $Id: HttpRequest.h,v 1.23 2006/05/29 21:44:18 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
void initHTTP(method_t aMethod, protocol_t aProtocol, const char *aUrlpath);
+ /* are responses to this request potentially cachable */
+ bool cacheable() const;
+
protected:
void clean();
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.am,v 1.148 2006/05/29 00:15:00 robertc Exp $
+# $Id: Makefile.am,v 1.149 2006/05/29 21:44:18 robertc Exp $
#
# Uncomment and customize the following to suit your needs:
#
@SSLLIB@ \
-L../lib -lmiscutil \
@XTRA_LIBS@ \
+ @SQUID_CPPUNIT_LIBS@ \
@SQUID_CPPUNIT_LA@ \
@SNMPLIB@
tests_testCacheManager_LDFLAGS = $(LIBADD_DL)
@REPL_OBJS@ \
@DISK_LIBS@ \
-L../lib -lmiscutil \
- @SQUID_CPPUNITLIBS@
+ @SQUID_CPPUNIT_LIBS@
SWAP_TEST_DS =\
$(top_builddir)/lib/libmiscutil.a \
DiskIO/Blocking/BlockingDiskIOModule.o \
/*
- * $Id: client_side_request.cc,v 1.68 2006/05/19 17:19:09 wessels Exp $
+ * $Id: client_side_request.cc,v 1.69 2006/05/29 21:44:18 robertc Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
/* Local functions */
/* other */
static void clientAccessCheckDoneWrapper(int, void *);
-static int clientCachable(ClientHttpRequest * http);
static int clientHierarchical(ClientHttpRequest * http);
static void clientInterpretRequestHeaders(ClientHttpRequest * http);
static RH clientRedirectDoneWrapper;
redirectStart(http, clientRedirectDoneWrapper, this);
}
-static int
-clientCachable(ClientHttpRequest * http)
-{
- HttpRequest *req = http->request;
- method_t method = req->method;
-
- if (req->protocol == PROTO_HTTP)
- return httpCachable(method);
-
- /* FTP is always cachable */
- if (req->protocol == PROTO_WAIS)
- return 0;
-
- /*
- * The below looks questionable: what non HTTP protocols use connect,
- * trace, put and post? RC
- */
- if (method == METHOD_CONNECT)
- return 0;
-
- if (method == METHOD_TRACE)
- return 0;
-
- if (method == METHOD_PUT)
- return 0;
-
- if (method == METHOD_POST)
- return 0;
-
- /* XXX POST may be cached sometimes.. ignored
-
- * for now */
- if (req->protocol == PROTO_GOPHER)
- return gopherCachable(req);
-
- if (req->protocol == PROTO_CACHEOBJ)
- return 0;
-
- return 1;
-}
-
static int
clientHierarchical(ClientHttpRequest * http)
{
request->max_forwards = req_hdr->getInt(HDR_MAX_FORWARDS);
}
- if (clientCachable(http))
- request->flags.cachable = 1;
+ request->flags.cachable = http->request->cacheable();
if (clientHierarchical(http))
request->flags.hierarchical = 1;
/*
- * $Id: comm_epoll.cc,v 1.10 2006/05/29 00:15:01 robertc Exp $
+ * $Id: comm_epoll.cc,v 1.11 2006/05/29 21:44:18 robertc Exp $
*
* DEBUG: section 5 Socket functions
*
F->timeout = squid_curtime + timeout;
}
+
+static void commIncomingStats(StoreEntry * sentry);
+
+void
+commEPollRegisterWithCacheManager(CacheManager& manager)
+{
+ manager.registerAction("comm_epoll_incoming",
+ "comm_incoming() stats",
+ commIncomingStats, 0, 1);
+}
+
+static void
+commIncomingStats(StoreEntry * sentry)
+{
+ StatCounters *f = &statCounter;
+ storeAppendPrintf(sentry, "Total number of epoll(2) loops: %d\n", statCounter.select_loops);
+ storeAppendPrintf(sentry, "Histogram of returned filedescriptors\n");
+ statHistDump(&f->select_fds_hist, sentry, statHistIntDumper);
+}
+
/*
+ * comm_select
* Check all connections for new connections and input data that is to be
* processed. Also check for connections with data queued and whether we can
* write it out.
- */
-
-/*
- * comm_select
*
* Called to do the new-style IO, courtesy of of squid (like most of this
* new IO code). This routine handles the stuff we've hidden in
/*
- * $Id: main.cc,v 1.423 2006/05/29 00:15:02 robertc Exp $
+ * $Id: main.cc,v 1.424 2006/05/29 21:44:18 robertc Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
#endif
clientdbRegisterWithCacheManager(manager);
+#if DELAY_POOLS
+
DelayPools::RegisterWithCacheManager(manager);
+#endif
+
DiskIOModule::RegisterAllModulesWithCacheManager(manager);
#if USE_DNSSERVERS
StringRegistry::Instance().registerWithCacheManager(manager);
#endif
+#if USE_XPROF_STATS
+
xprofRegisterWithCacheManager(manager);
+#endif
+
}
#if USE_WCCP
/*
- * $Id: store_digest.cc,v 1.67 2006/05/29 00:15:02 robertc Exp $
+ * $Id: store_digest.cc,v 1.68 2006/05/29 21:44:18 robertc Exp $
*
* DEBUG: section 71 Store Digest Manager
* AUTHOR: Alex Rousskov
*/
#include "squid.h"
+#include "CacheManager.h"
#if USE_CACHE_DIGESTS
-#include "CacheManager.h"
#include "Store.h"
#include "HttpRequest.h"
#include "HttpReply.h"
/*
- * $Id: url.cc,v 1.154 2006/05/08 23:38:33 robertc Exp $
+ * $Id: url.cc,v 1.155 2006/05/29 21:44:18 robertc Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
/*
- * what does the return code of this mean ?
+ * return true if we can serve requests for this method.
*/
int
urlCheckRequest(const HttpRequest * r)
{
int rc = 0;
- /* protocol "independent" methods */
+ /* protocol "independent" methods
+ *
+ * actually these methods are specific to HTTP:
+ * they are methods we recieve on our HTTP port,
+ * and if we had a FTP listener would not be relevant
+ * there.
+ *
+ * So, we should delegate them to HTTP. The problem is that we
+ * do not have a default protocol from the client side of HTTP.
+ */
if (r->method == METHOD_CONNECT)
return 1;