/*
- * $Id: client_side_request.cc,v 1.3 2002/09/15 15:06:01 robertc Exp $
- *
- * DEBUG: section 85 Client-side Request Routines
- * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
- *
+ * $Id: client_side_request.cc,v 1.4 2002/09/23 03:59:15 wessels Exp $
+ *
+ * DEBUG: section 85 Client-side Request Routines AUTHOR: Robert Collins
+ * (Originally Duane Wessels in client_side.c)
+ *
* 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.
- *
+ *
+ * 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.
+ *
*/
-/* General logic of request processing:
- *
- * We run a series of tests to determine if access will be permitted,
- * and to do any redirection. Then we call into the result clientStream
- * to retrieve data. From that point on it's up to reply management.
+/*
+ * General logic of request processing:
+ *
+ * We run a series of tests to determine if access will be permitted, and to do
+ * any redirection. Then we call into the result clientStream to retrieve data.
+ * From that point on it's up to reply management.
*/
#include "squid.h"
/* other */
static int checkAccelOnly(clientHttpRequest *);
static void clientAccessCheckDone(int, void *);
-/*static */ aclCheck_t *clientAclChecklistCreate(const acl_access * acl,
+ /* static */ aclCheck_t *
+ clientAclChecklistCreate(const acl_access * acl,
const clientHttpRequest * http);
static int clientCachable(clientHttpRequest * http);
static int clientHierarchical(clientHttpRequest * http);
}
/* Create a request and kick it off */
-/* TODO: Pass in the buffers to be used in the inital Read request,
- * as they are determined by the user
+/*
+ * TODO: Pass in the buffers to be used in the inital Read request, as they are
+ * determined by the user
*/
int /* returns nonzero on failure */
clientBeginRequest(method_t method, char const *url, CSCB * streamcallback,
/* make it visible in the 'current acctive requests list' */
dlinkAdd(http, &http->active, &ClientActiveRequests);
/* Set flags */
- http->flags.accel = 1; /* internal requests only makes sense in an
+ http->flags.accel = 1; /* internal requests only makes sense in an
* accelerator today. TODO: accept flags ? */
/* allow size for url rewriting */
url_sz = strlen(url) + Config.appendDomainLen + 5;
debug(85, 5) ("Invalid URL: %s\n", http->uri);
return -1;
}
- /* now update the headers in request with our supplied headers.
- * urLParse should return a blank header set, but we use Update to be sure
- * of correctness.
+ /*
+ * now update the headers in request with our supplied headers. urLParse
+ * should return a blank header set, but we use Update to be sure of
+ * correctness.
*/
if (header)
httpHeaderUpdate(&request->header, header, NULL);
http->log_uri = xstrdup(urlCanonicalClean(request));
/* http struct now ready */
- /* build new header list *?
- * TODO
+ /*
+ * build new header list *? TODO
*/
request->flags.accelerated = http->flags.accel;
- request->flags.internalclient = 1; /* this is an internally created request, not subject
- * to acceleration target overrides
- */
- /* FIXME? Do we want to detect and handle internal requests of internal
- * objects ? */
+ request->flags.internalclient = 1; /* this is an internally created
+ * request, not subject to acceleration
+ * target overrides */
+ /*
+ * FIXME? Do we want to detect and handle internal requests of internal
+ * objects ?
+ */
/* Internally created requests cannot have bodies today */
request->content_length = 0;
static int
checkAccelOnly(clientHttpRequest * http)
{
- /* return TRUE if someone makes a proxy request to us and
- * we are in httpd-accel only mode */
+ /*
+ * return TRUE if someone makes a proxy request to us and we are in
+ * httpd-accel only mode
+ */
if (!Config2.Accel.on)
return 0;
if (Config.onoff.accel_with_proxy)
ch = aclChecklistCreate(acl, http->request, conn ? conn->rfc931 : dash_str);
/*
- * hack for ident ACL. It needs to get full addresses, and a
- * place to store the ident result on persistent connections...
+ * hack for ident ACL. It needs to get full addresses, and a place to store
+ * the ident result on persistent connections...
*/
/* connection oriented auth also needs these two lines for it's operation. */
- /* Internal requests do not have a connection reference, because:
- * A) their byte count may be transformed before being applied to an outbound
- * connection
- * B) they are internal - any limiting on them should be done on the server end.
+ /*
+ * Internal requests do not have a connection reference, because: A) their
+ * byte count may be transformed before being applied to an outbound
+ * connection B) they are internal - any limiting on them should be done on
+ * the server end.
*/
if (conn)
ch->conn = cbdataReference(conn); /* unreferenced in acl.c */
debug(85, 5) ("Proxy Auth Message = %s\n",
proxy_auth_msg ? proxy_auth_msg : "<null>");
/*
- * NOTE: get page_id here, based on AclMatchedName because
- * if USE_DELAY_POOLS is enabled, then AclMatchedName gets
- * clobbered in the clientCreateStoreEntry() call
- * just below. Pedro Ribeiro <pribeiro@isel.pt>
+ * NOTE: get page_id here, based on AclMatchedName because if
+ * USE_DELAY_POOLS is enabled, then AclMatchedName gets clobbered in
+ * the clientCreateStoreEntry() call just below. Pedro Ribeiro
+ * <pribeiro@isel.pt>
*/
page_id = aclGetDenyInfoPage(&Config.denyInfoList, AclMatchedName);
http->logType = LOG_TCP_DENIED;
/* 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
+ /*
+ * The below looks questionable: what non HTTP protocols use connect,
+ * trace, put and post? RC
*/
if (method == METHOD_CONNECT)
return 0;
if (method == METHOD_PUT)
return 0;
if (method == METHOD_POST)
- return 0; /* XXX POST may be cached sometimes.. ignored for now */
+ return 0; /* XXX POST may be cached sometimes.. ignored
+ * for now */
if (req->protocol == PROTO_GOPHER)
return gopherCachable(req);
if (req->protocol == PROTO_CACHEOBJ)
method_t method = request->method;
const wordlist *p = NULL;
- /* IMS needs a private key, so we can use the hierarchy for IMS only
- * if our neighbors support private keys */
+ /*
+ * IMS needs a private key, so we can use the hierarchy for IMS only if our
+ * neighbors support private keys
+ */
if (request->flags.ims && !neighbors_do_private_keys)
return 0;
- /* This is incorrect: authenticating requests
- * can be sent via a hierarchy (they can even
- * be cached if the correct headers are set on
- * the reply
+ /*
+ * This is incorrect: authenticating requests can be sent via a hierarchy
+ * (they can even be cached if the correct headers are set on the reply
*/
if (request->flags.auth)
return 0;
if (request->ims > 0)
request->flags.ims = 1;
#if ESI
- /* We ignore Cache-Control as per the Edge Architecture
- * Section 3. See www.esi.org for more information.
+ /*
+ * We ignore Cache-Control as per the Edge Architecture Section 3. See
+ * www.esi.org for more information.
*/
#else
if (httpHeaderHas(req_hdr, HDR_PRAGMA)) {
if (request->cache_control)
if (EBIT_TEST(request->cache_control->mask, CC_NO_CACHE))
no_cache++;
- /* Work around for supporting the Reload button in IE browsers
- * when Squid is used as an accelerator or transparent proxy,
- * by turning accelerated IMS request to no-cache requests.
- * Now knows about IE 5.5 fix (is actually only fixed in SP1,
- * but we can't tell whether we are talking to SP1 or not so
- * all 5.5 versions are treated 'normally').
+ /*
+ * Work around for supporting the Reload button in IE browsers when Squid
+ * is used as an accelerator or transparent proxy, by turning accelerated
+ * IMS request to no-cache requests. Now knows about IE 5.5 fix (is
+ * actually only fixed in SP1, but we can't tell whether we are talking to
+ * SP1 or not so all 5.5 versions are treated 'normally').
*/
if (Config.onoff.ie_refresh) {
if (http->flags.accel && request->flags.ims) {
/* ignore range header in non-GETs */
if (request->method == METHOD_GET) {
/*
- * Since we're not doing ranges atm, just set the flag if
- * the header exists, and then free the range header info
- * -- adrian
+ * Since we're not doing ranges atm, just set the flag if the header
+ * exists, and then free the range header info -- adrian
*/
request->range = httpHeaderGetRange(req_hdr);
if (request->range) {
if (result) {
http_status status = (http_status) atoi(result);
if (status == HTTP_MOVED_PERMANENTLY
- || status == HTTP_MOVED_TEMPORARILY) {
+ || status == HTTP_MOVED_TEMPORARILY
+ || status == HTTP_SEE_OTHER
+ || status == HTTP_TEMPORARY_REDIRECT) {
char *t = result;
if ((t = strchr(result, ':')) != NULL) {
http->redirect.status = status;
clientProcessRequest(http);
}
-/* Identify requests that do not go through the store and client side
- * stream and forward them to the appropriate location.
- * All other requests, request them.
+/*
+ * Identify requests that do not go through the store and client side stream
+ * and forward them to the appropriate location. All other requests, request
+ * them.
*/
void
clientProcessRequest(clientHttpRequest * http)