/*
- * $Id: ICAPConfig.h,v 1.4 2005/12/01 23:19:24 wessels Exp $
+ * $Id: ICAPConfig.h,v 1.5 2005/12/01 23:24:00 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
int preview_enable;
int preview_size;
int send_client_ip;
- int auth_user;
- char *auth_scheme;
+ int send_client_username;
+ int reuse_connections;
Vector<ICAPServiceRep::Pointer> services;
Vector<ICAPClass*> classes;
#include "ChunkedCodingParser.h"
#include "TextException.h"
#include "AuthUserRequest.h"
+#include "ICAPConfig.h"
// flow and terminology:
// HTTP| --> receive --> encode --> write --> |network
static const size_t TheBackupLimit = ICAP::MsgPipeBufSizeMax;
+extern ICAPConfig TheICAPConfig;
+
ICAPModXact::State::State()
{
void ICAPModXact::makeRequestHeaders(MemBuf &buf)
{
+ /*
+ * XXX These should use HttpHdr interfaces instead of Printfs
+ */
const ICAPServiceRep &s = service();
buf.Printf("%s %s ICAP/1.0\r\n", s.methodStr(), s.uri.buf());
buf.Printf("Host: %s:%d\r\n", s.host.buf(), s.port);
+ buf.Printf("Date: %s\r\n", mkrfc1123(squid_curtime));
+
+ if (!TheICAPConfig.reuse_connections)
+ buf.Printf("Connection: close\r\n");
+
buf.Printf("Encapsulated: ");
MemBuf httpBuf;
+
httpBuf.init();
// build HTTP request header, if any
virgin->data->cause :
dynamic_cast<const HttpRequest*>(virgin->data->header);
- if (request->client_addr.s_addr != any_addr.s_addr)
- buf.Printf("X-Client-IP: %s\r\n", inet_ntoa(request->client_addr));
+ if (TheICAPConfig.send_client_ip)
+ if (request->client_addr.s_addr != any_addr.s_addr)
+ buf.Printf("X-Client-IP: %s\r\n", inet_ntoa(request->client_addr));
- if (request->auth_user_request)
- if (request->auth_user_request->username())
- buf.Printf("X-Client-Username: %s\r\n", request->auth_user_request->username());
+ if (TheICAPConfig.send_client_username)
+ if (request->auth_user_request)
+ if (request->auth_user_request->username())
+ buf.Printf("X-Client-Username: %s\r\n", request->auth_user_request->username());
fprintf(stderr, "%s\n", buf.content());
#
-# $Id: cf.data.pre,v 1.407 2005/12/01 23:19:22 wessels Exp $
+# $Id: cf.data.pre,v 1.408 2005/12/01 23:23:59 wessels Exp $
#
#
# SQUID Web Proxy Cache http://www.squid-cache.org/
basis by OPTIONS requests.
DOC_END
+NAME: icap_persistent_connections
+TYPE: onoff
+IFDEF: ICAP_CLIENT
+COMMENT: on|off
+LOC: TheICAPConfig.reuse_connections
+DEFAULT: on
+DOC_START
+ Whether or not Squid should use persistent connections to
+ an ICAP server.
+DOC_END
+
NAME: icap_send_client_ip
TYPE: onoff
IFDEF: ICAP_CLIENT
This adds the header "X-Client-IP" to ICAP requests.
DOC_END
-NAME: icap_send_auth_user
+NAME: icap_send_client_username
TYPE: onoff
IFDEF: ICAP_CLIENT
COMMENT: on|off
-LOC: TheICAPConfig.auth_user
+LOC: TheICAPConfig.send_client_username
DEFAULT: off
DOC_START
- This adds the header "X-Authenticated-User" to ICAP requests
+ This adds the header "X-Client-Username" to ICAP requests
if proxy access is authentified.
DOC_END
-NAME: icap_auth_scheme
-TYPE: string
-IFDEF: ICAP_CLIENT
-LOC: TheICAPConfig.auth_scheme
-DEFAULT: Local://%u
-DOC_START
- Authentification scheme to pass to ICAP requests if
- icap_send_auth_user is enabled. The first occurence of "%u"
- is replaced by the authentified user name. If no "%u" is found,
- the username is added at the end of the scheme.
-
- See http://www.ietf.org/internet-drafts/draft-stecher-icap-subid-00.txt,
- section 3.4 for details on this.
-
- Examples:
-
- icap_auth_scheme Local://%u
- icap_auth_scheme LDAP://ldap-server/cn=%u,dc=company,dc=com
- icap_auth_scheme WinNT://nt-domain/%u
- icap_auth_scheme Radius://radius-server/%u
-DOC_END
-
NAME: icap_service
TYPE: icap_service_type
IFDEF: ICAP_CLIENT