View | Details | Raw Unified | Return to bug 94642
Collapse All | Expand All

(-)pkg-install (-168 lines)
Lines 1-168 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD: ports/www/squid/pkg-install,v 1.21 2006/01/09 13:37:54 jylefort Exp $
4
#
5
6
PATH=/bin:/usr/bin:/usr/sbin
7
pkgname=$1
8
squid_base=${PKG_PREFIX:-/usr/local}/squid
9
squid_confdir=${PKG_PREFIX:-/usr/local}/etc/squid
10
if [ -x /usr/sbin/nologin ]; then
11
	nologin=/usr/sbin/nologin
12
else
13
	nologin=/sbin/nologin
14
fi
15
squid_user=${squid_user:-squid}
16
squid_group=${squid_group:-squid}
17
squid_gid=100
18
squid_uid=100
19
# Try to catch the case where the $squid_user might have been created with an
20
# id greater than or equal 3128. The valid exception is "nobody".
21
nobody_uid=65534
22
nobody_gid=65534
23
squid_oldgid=3128
24
squid_olduid=3128
25
unset wrong_id
26
case $2 in
27
PRE-INSTALL)
28
	echo "===> Pre-installation configuration for ${pkgname}"
29
	if ! pw groupshow ${squid_group} -q >/dev/null ; then
30
		echo "There is no group '${squid_group}' on this system, so I will try to create it:"
31
		if ! pw groupadd ${squid_group} -g ${squid_gid} -q ; then
32
			echo "Failed to create group \"${squid_group}\"!" >&2
33
			echo "Please create it manually." >&2
34
			exit 1
35
		else
36
			echo "Group '${squid_group}' created successfully:"
37
		fi
38
	else
39
		echo "I will use the existing group '${squid_group}':"
40
		current_gid=`pw groupshow ${squid_group}|cut -f 3 -d :`
41
		if [ ${current_gid} -ge ${squid_oldgid} \
42
		    -a ${current_gid} -ne ${nobody_gid} ]; then
43
			wrong_id=1
44
		fi	
45
	fi
46
	pw groupshow ${squid_group}
47
48
	if ! pw usershow ${squid_user} -q >/dev/null ; then
49
		echo "There is no account '${squid_user}' on this system, so I will try to create it:"
50
		if ! pw useradd -q -n ${squid_user} \
51
		    -u ${squid_uid} -g ${squid_group} \
52
	  	    -c "squid caching-proxy pseudo user" \
53
		    -d "${squid_base}" -s "${nologin}" \
54
		    -h - ; then
55
			echo "Failed to create user '${squid_user}'!" >&2
56
			echo "Please create it manually." >&2
57
			exit 1
58
		else
59
			echo "User '${squid_user}' created successfully:"
60
		fi
61
	else
62
		echo "I will use the existing user '${squid_user}':"
63
		current_uid=`id -u ${squid_user}`
64
		if [ ${current_uid} -ge ${squid_olduid} \
65
		    -a ${current_uid} -ne ${nobody_uid} ];
66
		then
67
			wrong_id=1
68
		fi
69
	fi
70
	pw usershow ${squid_user}
71
	if [ "${wrong_id}" ]; then
72
		echo ""
73
		echo " * NOTICE *"
74
		echo ""
75
		echo "The squid pseudo-user's uid and/or gid have been found"
76
		echo "to be greater than or equal 3128."
77
		echo ""
78
		echo "This is not a problem as such, but violates the FreeBSD"
79
		echo "ports' principle that a ports must not claim a uid greater"
80
		echo "than 999."
81
		echo ""
82
		echo "Since version 2.5.4_11, the squid user is thus created"
83
		echo "with an id of ${squid_uid}:${squid_gid} while earlier versions of this"
84
		echo "port used the first unused uid/gid greater than or"
85
		echo "equal 3128."
86
		echo ""
87
		echo "If you want to change the existing squid user's id, run"
88
		echo "'make changeuser' after the installation has completed."
89
		echo "If you installed this port via a package, issue the"
90
		echo "following commands as root:"
91
		echo ""
92
		echo "pw userdel -u ${current_uid}"
93
		echo "pw groupadd -n ${squid_group} -g ${squid_gid}"
94
		echo "pw useradd -n ${squid_user} -u ${squid_uid} \\"
95
		echo "    -c \"squid caching-proxy pseudo user\" \\"
96
		echo "    -g ${squid_group} -d ${squid_base} -s /sbin/nologin \\"
97
		echo "    -h -"
98
		echo "find -H ${PKG_PREFIX} -user ${current_uid} -exec chown ${squid_user} {} \\;"
99
		echo "find -H ${PKG_PREFIX} -group ${current_gid} -exec chgrp ${squid_group} {} \\;"
100
		echo ""
101
		echo "In case you have installed third party software for squid"
102
		echo "like squidGuard, you should additionally run:"
103
		echo "find -H /var -user ${current_uid} -exec chown ${squid_user} {} \\;"
104
		echo "find -H /var -group ${current_gid} -exec chgrp ${squid_group} {} \\;"
105
		echo ""
106
		if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
107
			sleep 30
108
		fi
109
	fi
110
	for dir in cache logs; do
111
	if [ ! -d ${squid_base}/${dir} ]; then
112
		echo "Creating ${squid_base}/${dir}..."
113
		install -d -o ${squid_user} -g ${squid_group} \
114
		    -m 0750 ${squid_base}/${dir}
115
	fi
116
	done
117
	if [ ! -d ${squid_confdir} ]; then
118
		echo "Creating ${squid_confdir}..."
119
		install -d -o root -g ${squid_group} \
120
		    -m 0750 ${squid_confdir}
121
	fi
122
	;;
123
POST-INSTALL)
124
	for file in cachemgr.conf mime.conf squid.conf; do
125
		if [ ! -f ${squid_confdir}/${file} \
126
		    -a -f ${squid_confdir}/${file}.default ]; then
127
			echo "Creating ${file} from default..."
128
			install -c -o root -g ${squid_group} -m 0640 \
129
		    	    ${squid_confdir}/${file}.default \
130
			    ${squid_confdir}/${file}
131
		fi
132
	done
133
134
	echo "===> Post-installation informations for ${pkgname}"
135
	echo ""
136
	echo "     o You can find the configuration files for this package"
137
	echo "       in the directory ${squid_confdir}."
138
	echo ""
139
	echo "     o A cache directory has been created in ${squid_base}/cache."
140
	echo "       Log files will be written to ${squid_base}/logs."
141
	echo ""
142
	echo "     o The default configuration will deny everyone access to the"
143
	echo "       proxy service. Edit the \"http_access\" directives in"
144
	echo "       ${squid_confdir}/squid.conf to suit your needs."
145
	echo ""
146
	echo "     o If you never ran squid on this system before, you need to"
147
	echo "       initialize the cache directory by running \"squid -z\""
148
	echo "       as 'root' or '${squid_user}' before starting squid."
149
	echo ""
150
	echo "     Please note that ${PKG_PREFIX}/etc/rc.d/squid.sh is a"
151
	echo "     new style rc script. This means that squid will not"
152
	echo "     start automatically at boot time."
153
	echo ""
154
	echo "     To enable squid, set squid_enable=yes in either"
155
	echo "     /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/squid"
156
	echo "     See ${PKG_PREFIX}/etc/rc.d/squid.sh for more"
157
	echo "     configuration options."
158
	echo ""
159
	echo "     If you want the port to install an old style rc script, run"
160
	echo "     'make config' and deselect the option to install an"
161
	echo "     rcNG script."
162
	echo ""
163
	;;
164
*)
165
	exit 64
166
	;;
167
esac
168
exit 0
(-)pkg-deinstall (-40 lines)
Lines 1-40 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD: ports/www/squid/pkg-deinstall,v 1.6 2005/11/01 14:05:59 krion Exp $
4
#
5
6
PATH=/bin:/usr/bin:/usr/sbin
7
8
case $2 in
9
DEINSTALL)
10
	cd ${PKG_PREFIX}/etc/squid || exit 1
11
	for f in cachemgr.conf mime.conf msntauth.conf squid.conf; do
12
		cmp -s -z ${f} ${f}.default && rm ${f}
13
	done
14
	;;
15
POST-DEINSTALL)
16
	echo "===> post-deinstallation information for $1"
17
	echo ""
18
	echo "     Note:"
19
	echo "     squid related user accounts and groups were not removed."
20
	echo ""
21
	echo "     To remove the 'squid' user and the 'squid' group which were"
22
	echo "     created by a default installation of this package, run"
23
	echo ""
24
	echo "     pw userdel -r -n squid -u 100"
25
	echo ""
26
	if  [ -d ${PKG_PREFIX}/squid -o -d ${PKG_PREFIX}/etc/squid ] ; then
27
		echo ""
28
		echo "     To ease updates, the cache and log directories and"
29
		echo "     all configuration files modified by you were preserved."
30
		echo ""
31
		echo "     Please remove them manually if you do not want to use"
32
	       	echo "     squid any longer."
33
	fi
34
	echo ""
35
	;;
36
*)
37
	exit 64
38
	;;
39
esac
40
exit 0
(-)distinfo (-12 / +3 lines)
Lines 1-12 Link Here
1
MD5 (squid2.5/squid-2.5.STABLE12.tar.bz2) = 7354255015b3772a1e024dfac173e48c
1
MD5 (squid2.5/squid-2.5.STABLE13.tar.bz2) = 3e64468e123be1246d17486dab6bee87
2
SHA256 (squid2.5/squid-2.5.STABLE12.tar.bz2) = ba0ccd956323f0dad46c19aa8d40c537846fedfc3778b5730e5610f16c0d9af1
2
SHA256 (squid2.5/squid-2.5.STABLE13.tar.bz2) = c4a7cde3d63559576f704b8a10561d61135a3788423ae417fb728d112b1962a8
3
SIZE (squid2.5/squid-2.5.STABLE12.tar.bz2) = 1075111
3
SIZE (squid2.5/squid-2.5.STABLE13.tar.bz2) = 1074112
4
MD5 (squid2.5/squid-2.5.STABLE12-SMB_BadFetch.patch) = 8e83b776c0d015bd4137cc1ca08f6d38
5
SHA256 (squid2.5/squid-2.5.STABLE12-SMB_BadFetch.patch) = 9ca8427c2eb9e5cbdb5a49fb5cb94fc00853ad965f87666f8fc35236e98bc0ae
6
SIZE (squid2.5/squid-2.5.STABLE12-SMB_BadFetch.patch) = 826
7
MD5 (squid2.5/squid-2.5.STABLE12-wbinfo_group.patch) = fe0ab5839d282fda67ffd8eb17f2588d
8
SHA256 (squid2.5/squid-2.5.STABLE12-wbinfo_group.patch) = 9aa671be4022f1126071cf83ca800795f609b731aac74237bc70e11d8f069046
9
SIZE (squid2.5/squid-2.5.STABLE12-wbinfo_group.patch) = 1615
10
MD5 (squid2.5/squid-2.5.STABLE12-asyncio_counters.patch) = 70485fac2c02d836f7027122e65d5767
11
SHA256 (squid2.5/squid-2.5.STABLE12-asyncio_counters.patch) = 39bf2ca95a3c1fc90a40c437253dbbf6d71f37763369ada287039340a68b873f
12
SIZE (squid2.5/squid-2.5.STABLE12-asyncio_counters.patch) = 497
(-)files/squid.sh (-85 lines)
Lines 1-85 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD: ports/www/squid/files/squid.sh,v 1.11 2005/12/25 23:38:48 edwin Exp $
4
#
5
# --begin rcng
6
# PROVIDE: squid
7
# REQUIRE: LOGIN
8
# KEYWORD: shutdown
9
# 
10
# Note:
11
# Set "squid_enable=yes" in either /etc/rc.conf, /etc/rc.conf.local or
12
# /etc/rc.conf.d/squid to make this script actually do something. There
13
# you can also set squid_chdir, squid_user, and squid_flags.
14
#
15
# Please see squid(8), rc.conf(5) and rc(8) for further details.
16
#
17
# --end rcng
18
19
name=squid
20
command=%%PREFIX%%/sbin/squid
21
# --begin rcng
22
extra_commands=reload
23
reload_cmd="${command} -k reconfigure"
24
# --end rcng
25
stop_cmd="squid_stop"
26
squid_chdir=${squid_chdir:-%%PREFIX%%/squid/logs}
27
squid_enable=${squid_enable:-"NO"}
28
squid_flags=${squid_flags-"-D"}
29
squid_user=${squid_user:-%%SQUID_UID%%}
30
default_config=%%PREFIX%%/etc/squid/squid.conf
31
32
# --begin rcold
33
squid_stop() {
34
	echo -n " ${name}"
35
	${command} -k shutdown
36
	while ps -xcU ${squid_user} | grep -q squid; do
37
		sleep 2
38
	done
39
}
40
41
# --end rcold
42
# --begin rcng
43
squid_stop() {
44
	${command} -k shutdown
45
	run_rc_command poll
46
}
47
48
. %%RC_SUBR%%
49
rcvar=`set_rcvar`
50
load_rc_config ${name}
51
52
# squid(8) will not start if ${default_config} is not present so try
53
# to catch that beforehand via ${required_files} rather than make
54
# squid(8) crash.
55
# If you remove the default configuration file make sure to add
56
# '-f /path/to/your/squid.conf' to squid_flags
57
58
if [ -z "${squid_flags}" ]; then
59
	required_files=${default_config}
60
fi
61
required_dirs=${squid_chdir}
62
run_rc_command "$1"
63
# --end rcng
64
# --begin rcold
65
case $1 in
66
start)
67
	if [ -x "${command}" -a \
68
		\( -f "${default_config}" -o "${squid_flags}" \) ]; then
69
		echo -n " ${name}"
70
		(cd ${squid_chdir} && exec su -fm ${squid_user} -c \
71
			"${command} ${squid_flags}")
72
	fi
73
	;;
74
stop)
75
	if [ -x "${command}" ]; then
76
		${stop_cmd}
77
	fi
78
	;;
79
*)
80
	echo "usage: ${0##*/} {start|stop}" >&2
81
	exit 64
82
	;;
83
esac
84
exit 0
85
# --end rcold
(-)files/icap-2.5-core.patch (-87 / +204 lines)
Lines 20-27 Link Here
20
See http://devel.squid-cache.org/icap/ for further information
20
See http://devel.squid-cache.org/icap/ for further information
21
about the ICAP client project.
21
about the ICAP client project.
22
22
23
Patch last updated: 2005-12-17
23
Patch last updated: 2006-03-17
24
24
25
Index: errors/Azerbaijani/ERR_ICAP_FAILURE
26
===================================================================
27
RCS file: errors/Azerbaijani/ERR_ICAP_FAILURE
28
diff -N errors/Azerbaijani/ERR_ICAP_FAILURE
29
--- /dev/null	1 Jan 1970 00:00:00 -0000
30
+++ errors/Azerbaijani/ERR_ICAP_FAILURE	8 Dec 2003 12:30:56 -0000	1.1.2.1
31
@@ -0,0 +1,31 @@
32
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
33
+<HTML><HEAD>
34
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
35
+<STYLE type="text/css"><!--BODY{background-color:#ffffff; font-family:verdana,sans-serif}--></STYLE>
36
+</HEAD><BODY>
37
+<H1>ERROR</H1>
38
+<H2>The requested URL could not be retrieved</H2>
39
+<HR noshade size="1px">
40
+<P>
41
+While attempting to retrieve the URL:
42
+<A HREF="%U">%U</A>
43
+<P>
44
+the following error was encountered:
45
+<UL>
46
+<LI>
47
+<STRONG>
48
+ICAP protocol error.
49
+</STRONG>
50
+</UL>
51
+
52
+<P>
53
+<P>
54
+Some aspect of the ICAP communication failed. Possible problems:
55
+<UL>
56
+<LI>ICAP server is not reachable.
57
+<LI>Illegal response from ICAP server.
58
+</UL>
59
+</P>
60
+
61
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
62
+
25
Index: errors/Bulgarian/ERR_ICAP_FAILURE
63
Index: errors/Bulgarian/ERR_ICAP_FAILURE
26
===================================================================
64
===================================================================
27
RCS file: errors/Bulgarian/ERR_ICAP_FAILURE
65
RCS file: errors/Bulgarian/ERR_ICAP_FAILURE
Lines 1981-1991 Link Here
1981
Index: src/cf.data.pre
2019
Index: src/cf.data.pre
1982
===================================================================
2020
===================================================================
1983
RCS file: /cvsroot/squid/squid/src/cf.data.pre,v
2021
RCS file: /cvsroot/squid/squid/src/cf.data.pre,v
1984
retrieving revision 1.49.2.84
2022
retrieving revision 1.49.2.86
1985
retrieving revision 1.49.2.33.2.32
2023
retrieving revision 1.49.2.33.2.33
1986
diff -p -u -b -r1.49.2.84 -r1.49.2.33.2.32
2024
diff -p -u -b -r1.49.2.86 -r1.49.2.33.2.33
1987
--- src/cf.data.pre	21 Oct 2005 02:13:47 -0000	1.49.2.84
2025
--- src/cf.data.pre	26 Feb 2006 03:13:57 -0000	1.49.2.86
1988
+++ src/cf.data.pre	24 Oct 2005 17:07:42 -0000	1.49.2.33.2.32
2026
+++ src/cf.data.pre	16 Feb 2006 17:21:45 -0000	1.49.2.33.2.33
1989
@@ -2397,7 +2397,6 @@ DOC_START
2027
@@ -2397,7 +2397,6 @@ DOC_START
1990
 	ensure correct results it is best to set server_persisten_connections
2028
 	ensure correct results it is best to set server_persisten_connections
1991
 	to off when using this directive in such configurations.
2029
 	to off when using this directive in such configurations.
Lines 1994-2000 Link Here
1994
 NAME: reply_header_max_size
2032
 NAME: reply_header_max_size
1995
 COMMENT: (KB)
2033
 COMMENT: (KB)
1996
 TYPE: b_size_t
2034
 TYPE: b_size_t
1997
@@ -2716,6 +2715,177 @@ DOC_START
2035
@@ -2716,6 +2715,187 @@ DOC_START
1998
 DOC_END
2036
 DOC_END
1999
 
2037
 
2000
 COMMENT_START
2038
 COMMENT_START
Lines 2051-2060 Link Here
2051
+LOC: Config.icapcfg.send_client_ip
2089
+LOC: Config.icapcfg.send_client_ip
2052
+DEFAULT: off
2090
+DEFAULT: off
2053
+DOC_START
2091
+DOC_START
2054
+	This adds the header "X-Client-IP" to ICAP requests. Can also be
2092
+	Allows Squid to add the "X-Client-IP" header if requested by
2055
+	set from the server's response to OPTIONS.
2093
+	an ICAP service in it's response to OPTIONS.
2056
+DOC_END
2094
+DOC_END
2057
+
2095
+
2096
+NAME: icap_send_server_ip
2097
+TYPE: onoff
2098
+IFDEF: HS_FEAT_ICAP
2099
+COMMENT: on|off
2100
+LOC: Config.icapcfg.send_server_ip
2101
+DEFAULT: off
2102
+DOC_START
2103
+	Allows Squid to add the "X-Server-IP" header if requested by
2104
+	an ICAP service in it's response to OPTIONS.
2105
+DOC_END
2106
+
2058
+NAME: icap_send_auth_user
2107
+NAME: icap_send_auth_user
2059
+TYPE: onoff
2108
+TYPE: onoff
2060
+IFDEF: HS_FEAT_ICAP
2109
+IFDEF: HS_FEAT_ICAP
Lines 2062-2070 Link Here
2062
+LOC: Config.icapcfg.send_auth_user
2111
+LOC: Config.icapcfg.send_auth_user
2063
+DEFAULT: off
2112
+DEFAULT: off
2064
+DOC_START
2113
+DOC_START
2065
+	This adds the header "X-Authenticated-User" to ICAP requests 
2114
+	Allows Squid to add the "X-Authenticated-User" header if requested
2066
+	if proxy access is authentified. Can also be set from the server's
2115
+	by an ICAP service in it's response to OPTIONS.
2067
+	response to OPTIONS.
2068
+DOC_END
2116
+DOC_END
2069
+
2117
+
2070
+NAME: icap_auth_scheme
2118
+NAME: icap_auth_scheme
Lines 2199-2208 Link Here
2199
Index: src/client_side.c
2247
Index: src/client_side.c
2200
===================================================================
2248
===================================================================
2201
RCS file: /cvsroot/squid/squid/src/client_side.c,v
2249
RCS file: /cvsroot/squid/squid/src/client_side.c,v
2202
retrieving revision 1.47.2.71
2250
retrieving revision 1.47.2.76
2203
retrieving revision 1.47.2.28.2.40
2251
retrieving revision 1.47.2.28.2.40
2204
diff -p -u -b -r1.47.2.71 -r1.47.2.28.2.40
2252
diff -p -u -b -r1.47.2.76 -r1.47.2.28.2.40
2205
--- src/client_side.c	19 Oct 2005 02:13:20 -0000	1.47.2.71
2253
--- src/client_side.c	11 Mar 2006 03:16:31 -0000	1.47.2.76
2206
+++ src/client_side.c	6 Dec 2005 21:53:44 -0000	1.47.2.28.2.40
2254
+++ src/client_side.c	6 Dec 2005 21:53:44 -0000	1.47.2.28.2.40
2207
@@ -109,7 +109,7 @@ static const char *const crlf = "\r\n";
2255
@@ -109,7 +109,7 @@ static const char *const crlf = "\r\n";
2208
 static CWCB clientWriteComplete;
2256
 static CWCB clientWriteComplete;
Lines 2277-2283 Link Here
2277
 connStateFree(int fd, void *data)
2325
 connStateFree(int fd, void *data)
2278
 {
2326
 {
2279
     ConnStateData *connState = data;
2327
     ConnStateData *connState = data;
2280
@@ -958,7 +976,6 @@ connStateFree(int fd, void *data)
2328
@@ -963,7 +976,6 @@ connStateFree(int fd, void *data)
2281
     } else
2329
     } else
2282
 	safe_free(connState->in.buf);
2330
 	safe_free(connState->in.buf);
2283
     /* XXX account connState->in.buf */
2331
     /* XXX account connState->in.buf */
Lines 2285-2291 Link Here
2285
     cbdataFree(connState);
2333
     cbdataFree(connState);
2286
 #ifdef _SQUID_LINUX_
2334
 #ifdef _SQUID_LINUX_
2287
     /* prevent those nasty RST packets */
2335
     /* prevent those nasty RST packets */
2288
@@ -1103,7 +1120,7 @@ clientSetKeepaliveFlag(clientHttpRequest
2336
@@ -1108,7 +1120,7 @@ clientSetKeepaliveFlag(clientHttpRequest
2289
     }
2337
     }
2290
 }
2338
 }
2291
 
2339
 
Lines 2294-2300 Link Here
2294
 clientCheckContentLength(request_t * r)
2342
 clientCheckContentLength(request_t * r)
2295
 {
2343
 {
2296
     switch (r->method) {
2344
     switch (r->method) {
2297
@@ -1122,7 +1139,7 @@ clientCheckContentLength(request_t * r)
2345
@@ -1127,7 +1139,7 @@ clientCheckContentLength(request_t * r)
2298
     /* NOT REACHED */
2346
     /* NOT REACHED */
2299
 }
2347
 }
2300
 
2348
 
Lines 2303-2309 Link Here
2303
 clientCachable(clientHttpRequest * http)
2351
 clientCachable(clientHttpRequest * http)
2304
 {
2352
 {
2305
     request_t *req = http->request;
2353
     request_t *req = http->request;
2306
@@ -1148,7 +1165,7 @@ clientCachable(clientHttpRequest * http)
2354
@@ -1153,7 +1165,7 @@ clientCachable(clientHttpRequest * http)
2307
 }
2355
 }
2308
 
2356
 
2309
 /* Return true if we can query our neighbors for this object */
2357
 /* Return true if we can query our neighbors for this object */
Lines 2321-2327 Link Here
2321
 clientProcessRequest(clientHttpRequest * http)
2369
 clientProcessRequest(clientHttpRequest * http)
2322
 {
2370
 {
2323
     char *url = http->uri;
2371
     char *url = http->uri;
2324
@@ -2449,6 +2466,11 @@ clientProcessRequest(clientHttpRequest *
2372
@@ -2457,6 +2466,11 @@ clientProcessRequest(clientHttpRequest *
2325
     debug(33, 4) ("clientProcessRequest: %s '%s'\n",
2373
     debug(33, 4) ("clientProcessRequest: %s '%s'\n",
2326
 	RequestMethodStr[r->method],
2374
 	RequestMethodStr[r->method],
2327
 	url);
2375
 	url);
Lines 2333-2339 Link Here
2333
     if (r->method == METHOD_CONNECT && !http->redirect.status) {
2381
     if (r->method == METHOD_CONNECT && !http->redirect.status) {
2334
 	http->log_type = LOG_TCP_MISS;
2382
 	http->log_type = LOG_TCP_MISS;
2335
 	sslStart(http, &http->out.size, &http->al.http.code);
2383
 	sslStart(http, &http->out.size, &http->al.http.code);
2336
@@ -2993,6 +3015,20 @@ clientReadRequest(int fd, void *data)
2384
@@ -3001,6 +3015,20 @@ clientReadRequest(int fd, void *data)
2337
 	    (long) conn->in.offset, (long) conn->in.size);
2385
 	    (long) conn->in.offset, (long) conn->in.size);
2338
 	len = conn->in.size - conn->in.offset - 1;
2386
 	len = conn->in.size - conn->in.offset - 1;
2339
     }
2387
     }
Lines 2354-2360 Link Here
2354
     statCounter.syscalls.sock.reads++;
2402
     statCounter.syscalls.sock.reads++;
2355
     size = FD_READ_METHOD(fd, conn->in.buf + conn->in.offset, len);
2403
     size = FD_READ_METHOD(fd, conn->in.buf + conn->in.offset, len);
2356
     if (size > 0) {
2404
     if (size > 0) {
2357
@@ -3096,7 +3132,8 @@ clientReadRequest(int fd, void *data)
2405
@@ -3104,7 +3132,8 @@ clientReadRequest(int fd, void *data)
2358
 	    /* add to the client request queue */
2406
 	    /* add to the client request queue */
2359
 	    for (H = &conn->chr; *H; H = &(*H)->next);
2407
 	    for (H = &conn->chr; *H; H = &(*H)->next);
2360
 	    *H = http;
2408
 	    *H = http;
Lines 2364-2370 Link Here
2364
 	    /*
2412
 	    /*
2365
 	     * I wanted to lock 'http' here since its callback data for 
2413
 	     * I wanted to lock 'http' here since its callback data for 
2366
 	     * clientLifetimeTimeout(), but there's no logical place to
2414
 	     * clientLifetimeTimeout(), but there's no logical place to
2367
@@ -3266,7 +3303,7 @@ clientReadRequest(int fd, void *data)
2415
@@ -3274,7 +3303,7 @@ clientReadRequest(int fd, void *data)
2368
 }
2416
 }
2369
 
2417
 
2370
 /* file_read like function, for reading body content */
2418
 /* file_read like function, for reading body content */
Lines 2373-2379 Link Here
2373
 clientReadBody(request_t * request, char *buf, size_t size, CBCB * callback, void *cbdata)
2421
 clientReadBody(request_t * request, char *buf, size_t size, CBCB * callback, void *cbdata)
2374
 {
2422
 {
2375
     ConnStateData *conn = request->body_reader_data;
2423
     ConnStateData *conn = request->body_reader_data;
2376
@@ -3390,7 +3427,7 @@ clientProcessBody(ConnStateData * conn)
2424
@@ -3398,7 +3427,7 @@ clientProcessBody(ConnStateData * conn)
2377
 }
2425
 }
2378
 
2426
 
2379
 /* Abort a body request */
2427
 /* Abort a body request */
Lines 2391-2397 Link Here
2391
 	/*
2439
 	/*
2392
 	 * assume its a persistent connection; just close it
2440
 	 * assume its a persistent connection; just close it
2393
 	 */
2441
 	 */
2394
@@ -3948,3 +3985,49 @@ varyEvaluateMatch(StoreEntry * entry, re
2442
@@ -3956,3 +3985,49 @@ varyEvaluateMatch(StoreEntry * entry, re
2395
 	}
2443
 	}
2396
     }
2444
     }
2397
 }
2445
 }
Lines 2586-2595 Link Here
2586
Index: src/forward.c
2634
Index: src/forward.c
2587
===================================================================
2635
===================================================================
2588
RCS file: /cvsroot/squid/squid/src/forward.c,v
2636
RCS file: /cvsroot/squid/squid/src/forward.c,v
2589
retrieving revision 1.13.6.15
2637
retrieving revision 1.13.6.16
2590
retrieving revision 1.13.6.3.2.15
2638
retrieving revision 1.13.6.3.2.15
2591
diff -p -u -b -r1.13.6.15 -r1.13.6.3.2.15
2639
diff -p -u -b -r1.13.6.16 -r1.13.6.3.2.15
2592
--- src/forward.c	2 Sep 2005 02:13:43 -0000	1.13.6.15
2640
--- src/forward.c	11 Mar 2006 03:16:31 -0000	1.13.6.16
2593
+++ src/forward.c	30 Nov 2005 21:52:15 -0000	1.13.6.3.2.15
2641
+++ src/forward.c	30 Nov 2005 21:52:15 -0000	1.13.6.3.2.15
2594
@@ -262,7 +262,8 @@ fwdConnectDone(int server_fd, int status
2642
@@ -262,7 +262,8 @@ fwdConnectDone(int server_fd, int status
2595
 	else
2643
 	else
Lines 2653-2662 Link Here
2653
===================================================================
2701
===================================================================
2654
RCS file: /cvsroot/squid/squid/src/http.c,v
2702
RCS file: /cvsroot/squid/squid/src/http.c,v
2655
retrieving revision 1.17.6.32
2703
retrieving revision 1.17.6.32
2656
retrieving revision 1.17.6.3.6.39
2704
retrieving revision 1.17.6.3.6.40
2657
diff -p -u -b -r1.17.6.32 -r1.17.6.3.6.39
2705
diff -p -u -b -r1.17.6.32 -r1.17.6.3.6.40
2658
--- src/http.c	19 Oct 2005 02:13:21 -0000	1.17.6.32
2706
--- src/http.c	19 Oct 2005 02:13:21 -0000	1.17.6.32
2659
+++ src/http.c	23 Nov 2005 20:33:07 -0000	1.17.6.3.6.39
2707
+++ src/http.c	17 Feb 2006 12:45:21 -0000	1.17.6.3.6.40
2660
@@ -47,7 +47,7 @@ static CWCB httpSendRequestEntry;
2708
@@ -47,7 +47,7 @@ static CWCB httpSendRequestEntry;
2661
 
2709
 
2662
 static PF httpReadReply;
2710
 static PF httpReadReply;
Lines 2756-2762 Link Here
2756
     if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
2804
     if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
2757
 	comm_close(fd);
2805
 	comm_close(fd);
2758
 	return;
2806
 	return;
2759
@@ -579,6 +605,33 @@ httpReadReply(int fd, void *data)
2807
@@ -579,6 +605,37 @@ httpReadReply(int fd, void *data)
2760
     else
2808
     else
2761
 	delay_id = delayMostBytesAllowed(entry->mem_obj, &read_sz);
2809
 	delay_id = delayMostBytesAllowed(entry->mem_obj, &read_sz);
2762
 #endif
2810
 #endif
Lines 2784-2796 Link Here
2784
+	    commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
2832
+	    commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
2785
+	    return;
2833
+	    return;
2786
+	}
2834
+	}
2835
+
2836
+       if(icap->flags.no_content == 1) {
2837
+	 commSetDefer(fd, fwdCheckDeferRead, icap->respmod.entry);
2838
+       }
2787
+    }
2839
+    }
2788
+#endif
2840
+#endif
2789
+
2841
+
2790
     errno = 0;
2842
     errno = 0;
2791
     statCounter.syscalls.sock.reads++;
2843
     statCounter.syscalls.sock.reads++;
2792
     len = FD_READ_METHOD(fd, buf, read_sz);
2844
     len = FD_READ_METHOD(fd, buf, read_sz);
2793
@@ -595,7 +648,13 @@ httpReadReply(int fd, void *data)
2845
@@ -595,7 +652,13 @@ httpReadReply(int fd, void *data)
2794
 	    clen >>= 1;
2846
 	    clen >>= 1;
2795
 	IOStats.Http.read_hist[bin]++;
2847
 	IOStats.Http.read_hist[bin]++;
2796
     }
2848
     }
Lines 2805-2811 Link Here
2805
 	/* Skip whitespace */
2857
 	/* Skip whitespace */
2806
 	while (len > 0 && xisspace(*buf))
2858
 	while (len > 0 && xisspace(*buf))
2807
 	    xmemmove(buf, buf + 1, len--);
2859
 	    xmemmove(buf, buf + 1, len--);
2808
@@ -625,6 +684,12 @@ httpReadReply(int fd, void *data)
2860
@@ -625,6 +688,12 @@ httpReadReply(int fd, void *data)
2809
     } else if (len == 0) {
2861
     } else if (len == 0) {
2810
 	/* Connection closed; retrieval done. */
2862
 	/* Connection closed; retrieval done. */
2811
 	httpState->eof = 1;
2863
 	httpState->eof = 1;
Lines 2818-2824 Link Here
2818
 	if (httpState->reply_hdr_state < 2)
2870
 	if (httpState->reply_hdr_state < 2)
2819
 	    /*
2871
 	    /*
2820
 	     * Yes Henrik, there is a point to doing this.  When we
2872
 	     * Yes Henrik, there is a point to doing this.  When we
2821
@@ -677,7 +742,28 @@ httpReadReply(int fd, void *data)
2873
@@ -677,7 +746,28 @@ httpReadReply(int fd, void *data)
2822
 		    EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
2874
 		    EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
2823
 	    }
2875
 	    }
2824
 	}
2876
 	}
Lines 2847-2853 Link Here
2847
 	if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
2899
 	if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
2848
 	    /*
2900
 	    /*
2849
 	     * the above storeAppend() call could ABORT this entry,
2901
 	     * the above storeAppend() call could ABORT this entry,
2850
@@ -724,10 +810,21 @@ httpReadReply(int fd, void *data)
2902
@@ -724,10 +814,21 @@ httpReadReply(int fd, void *data)
2851
 			    ("httpReadReply: Excess data from \"%s %s\"\n",
2903
 			    ("httpReadReply: Excess data from \"%s %s\"\n",
2852
 			    RequestMethodStr[httpState->orig_request->method],
2904
 			    RequestMethodStr[httpState->orig_request->method],
2853
 			    storeUrl(entry));
2905
 			    storeUrl(entry));
Lines 2869-2875 Link Here
2869
 		if (keep_alive) {
2921
 		if (keep_alive) {
2870
 		    /* yes we have to clear all these! */
2922
 		    /* yes we have to clear all these! */
2871
 		    commSetDefer(fd, NULL, NULL);
2923
 		    commSetDefer(fd, NULL, NULL);
2872
@@ -766,6 +863,10 @@ httpReadReply(int fd, void *data)
2924
@@ -766,6 +867,10 @@ httpReadReply(int fd, void *data)
2873
 		("httpReadReply: Excess data from \"%s %s\"\n",
2925
 		("httpReadReply: Excess data from \"%s %s\"\n",
2874
 		RequestMethodStr[httpState->orig_request->method],
2926
 		RequestMethodStr[httpState->orig_request->method],
2875
 		storeUrl(entry));
2927
 		storeUrl(entry));
Lines 2880-2886 Link Here
2880
 	    fwdComplete(httpState->fwd);
2932
 	    fwdComplete(httpState->fwd);
2881
 	    comm_close(fd);
2933
 	    comm_close(fd);
2882
 	    return;
2934
 	    return;
2883
@@ -776,6 +877,34 @@ httpReadReply(int fd, void *data)
2935
@@ -776,6 +881,34 @@ httpReadReply(int fd, void *data)
2884
     }
2936
     }
2885
 }
2937
 }
2886
 
2938
 
Lines 2915-2921 Link Here
2915
 /* This will be called when request write is complete. Schedule read of
2967
 /* This will be called when request write is complete. Schedule read of
2916
  * reply. */
2968
  * reply. */
2917
 static void
2969
 static void
2918
@@ -803,6 +932,63 @@ httpSendComplete(int fd, char *bufnotuse
2970
@@ -803,6 +936,63 @@ httpSendComplete(int fd, char *bufnotuse
2919
 	comm_close(fd);
2971
 	comm_close(fd);
2920
 	return;
2972
 	return;
2921
     } else {
2973
     } else {
Lines 2979-2985 Link Here
2979
 	/*
3031
 	/*
2980
 	 * Set the read timeout here because it hasn't been set yet.
3032
 	 * Set the read timeout here because it hasn't been set yet.
2981
 	 * We only set the read timeout after the request has been
3033
 	 * We only set the read timeout after the request has been
2982
@@ -811,8 +997,18 @@ httpSendComplete(int fd, char *bufnotuse
3034
@@ -811,8 +1001,18 @@ httpSendComplete(int fd, char *bufnotuse
2983
 	 * the timeout for POST/PUT requests that have very large
3035
 	 * the timeout for POST/PUT requests that have very large
2984
 	 * request bodies.
3036
 	 * request bodies.
2985
 	 */
3037
 	 */
Lines 2999-3005 Link Here
2999
     }
3051
     }
3000
     httpState->flags.request_sent = 1;
3052
     httpState->flags.request_sent = 1;
3001
 }
3053
 }
3002
@@ -1010,8 +1206,11 @@ httpBuildRequestHeader(request_t * reque
3054
@@ -1010,8 +1210,11 @@ httpBuildRequestHeader(request_t * reque
3003
 	if (!EBIT_TEST(cc->mask, CC_MAX_AGE)) {
3055
 	if (!EBIT_TEST(cc->mask, CC_MAX_AGE)) {
3004
 	    const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request);
3056
 	    const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request);
3005
 	    httpHdrCcSetMaxAge(cc, getMaxAge(url));
3057
 	    httpHdrCcSetMaxAge(cc, getMaxAge(url));
Lines 3011-3017 Link Here
3011
 	}
3063
 	}
3012
 	/* Set no-cache if determined needed but not found */
3064
 	/* Set no-cache if determined needed but not found */
3013
 	if (orig_request->flags.nocache && !httpHeaderHas(hdr_in, HDR_PRAGMA))
3065
 	if (orig_request->flags.nocache && !httpHeaderHas(hdr_in, HDR_PRAGMA))
3014
@@ -1119,6 +1318,7 @@ httpStart(FwdState * fwd)
3066
@@ -1119,6 +1322,7 @@ httpStart(FwdState * fwd)
3015
     int fd = fwd->server_fd;
3067
     int fd = fwd->server_fd;
3016
     HttpStateData *httpState;
3068
     HttpStateData *httpState;
3017
     request_t *proxy_req;
3069
     request_t *proxy_req;
Lines 3019-3025 Link Here
3019
     request_t *orig_req = fwd->request;
3071
     request_t *orig_req = fwd->request;
3020
     debug(11, 3) ("httpStart: \"%s %s\"\n",
3072
     debug(11, 3) ("httpStart: \"%s %s\"\n",
3021
 	RequestMethodStr[orig_req->method],
3073
 	RequestMethodStr[orig_req->method],
3022
@@ -1156,12 +1356,22 @@ httpStart(FwdState * fwd)
3074
@@ -1156,12 +1360,22 @@ httpStart(FwdState * fwd)
3023
 	httpState->request = requestLink(orig_req);
3075
 	httpState->request = requestLink(orig_req);
3024
 	httpState->orig_request = requestLink(orig_req);
3076
 	httpState->orig_request = requestLink(orig_req);
3025
     }
3077
     }
Lines 3047-3054 Link Here
3047
RCS file: src/icap_common.c
3099
RCS file: src/icap_common.c
3048
diff -N src/icap_common.c
3100
diff -N src/icap_common.c
3049
--- /dev/null	1 Jan 1970 00:00:00 -0000
3101
--- /dev/null	1 Jan 1970 00:00:00 -0000
3050
+++ src/icap_common.c	22 Nov 2005 22:41:48 -0000	1.1.2.39
3102
+++ src/icap_common.c	16 Feb 2006 17:21:45 -0000	1.1.2.40
3051
@@ -0,0 +1,785 @@
3103
@@ -0,0 +1,817 @@
3052
+/*
3104
+/*
3053
+ * $Id$
3105
+ * $Id$
3054
+ *
3106
+ *
Lines 3834-3846 Link Here
3834
+    memBufPrintf(mb, "X-Authenticated-User: %s\r\n", base64_encode(authuser));
3886
+    memBufPrintf(mb, "X-Authenticated-User: %s\r\n", base64_encode(authuser));
3835
+    xfree(authuser);
3887
+    xfree(authuser);
3836
+}
3888
+}
3889
+
3890
+/*
3891
+ *  icapAddOriginIP
3892
+ *
3893
+ *  Builds and adds the X-Server-IP header to an ICAP request headers.
3894
+ */
3895
+void
3896
+icapAddOriginIP(MemBuf *mb, const char *host)
3897
+{
3898
+  const ipcache_addrs *addrs;
3899
+  struct in_addr s;
3900
+
3901
+  if (host == NULL) {
3902
+    debug(81, 5)("icapAddOriginIP: NULL host\n");
3903
+    return;
3904
+  }
3905
+    
3906
+  addrs = ipcache_gethostbyname(host, IP_LOOKUP_IF_MISS);
3907
+  if (addrs == NULL) {
3908
+    /*
3909
+     * http://www.i-cap.org/spec/draft-stecher-icap-subid-00.txt :
3910
+     *
3911
+     * [...] If the meta information for some header is not available,
3912
+     * the header field MUST be omitted.
3913
+     */
3914
+    debug(81, 5)("icapAddOriginIP: can't tell IP address\n");
3915
+    return;
3916
+  }
3917
+
3918
+  s = addrs->in_addrs[0];
3919
+  memBufPrintf(mb, "X-Server-IP: %s\r\n", inet_ntoa(s));
3920
+}
3837
Index: src/icap_opt.c
3921
Index: src/icap_opt.c
3838
===================================================================
3922
===================================================================
3839
RCS file: src/icap_opt.c
3923
RCS file: src/icap_opt.c
3840
diff -N src/icap_opt.c
3924
diff -N src/icap_opt.c
3841
--- /dev/null	1 Jan 1970 00:00:00 -0000
3925
--- /dev/null	1 Jan 1970 00:00:00 -0000
3842
+++ src/icap_opt.c	22 Nov 2005 22:41:48 -0000	1.1.2.17
3926
+++ src/icap_opt.c	16 Feb 2006 17:21:45 -0000	1.1.2.18
3843
@@ -0,0 +1,519 @@
3927
@@ -0,0 +1,523 @@
3844
+
3928
+
3845
+/*
3929
+/*
3846
+ * $Id$
3930
+ * $Id$
Lines 4278-4283 Link Here
4278
+	    debug(81, 5) ("icapOptParseEntry: X-Include: found X-Client-IP\n");
4362
+	    debug(81, 5) ("icapOptParseEntry: X-Include: found X-Client-IP\n");
4279
+	    s->flags.need_x_client_ip = 1;
4363
+	    s->flags.need_x_client_ip = 1;
4280
+	}
4364
+	}
4365
+	if (strstr(value_start, "X-Server-IP")) {
4366
+	    debug(81, 5) ("icapOptParseEntry: X-Include: found X-Server-IP\n");
4367
+	    s->flags.need_x_server_ip = 1;
4368
+	}
4281
+	if (strstr(value_start, "X-Authenticated-User")) {
4369
+	if (strstr(value_start, "X-Authenticated-User")) {
4282
+	    debug(81, 5) ("icapOptParseEntry: X-Include: found X-Authenticated-User\n");
4370
+	    debug(81, 5) ("icapOptParseEntry: X-Include: found X-Authenticated-User\n");
4283
+	    s->flags.need_x_authenticated_user = 1;
4371
+	    s->flags.need_x_authenticated_user = 1;
Lines 4365-4372 Link Here
4365
RCS file: src/icap_reqmod.c
4453
RCS file: src/icap_reqmod.c
4366
diff -N src/icap_reqmod.c
4454
diff -N src/icap_reqmod.c
4367
--- /dev/null	1 Jan 1970 00:00:00 -0000
4455
--- /dev/null	1 Jan 1970 00:00:00 -0000
4368
+++ src/icap_reqmod.c	6 Dec 2005 21:53:44 -0000	1.1.2.58
4456
+++ src/icap_reqmod.c	17 Feb 2006 12:50:52 -0000	1.1.2.60
4369
@@ -0,0 +1,976 @@
4457
@@ -0,0 +1,981 @@
4370
+
4458
+
4371
+/*
4459
+/*
4372
+ * $Id$
4460
+ * $Id$
Lines 5066-5075 Link Here
5066
+    else
5154
+    else
5067
+	memBufPrintf(&mb, ", null-body=%d", mb_hdr.size);
5155
+	memBufPrintf(&mb, ", null-body=%d", mb_hdr.size);
5068
+    memBufAppend(&mb, crlf, 2);
5156
+    memBufAppend(&mb, crlf, 2);
5069
+    if (Config.icapcfg.send_client_ip || service->flags.need_x_client_ip)
5157
+
5158
+    if (service->flags.need_x_client_ip && Config.icapcfg.send_client_ip)
5070
+	memBufPrintf(&mb, "X-Client-IP: %s\r\n", client_addr);
5159
+	memBufPrintf(&mb, "X-Client-IP: %s\r\n", client_addr);
5071
+    if ((Config.icapcfg.send_auth_user
5160
+
5072
+	    || service->flags.need_x_authenticated_user)
5161
+    if (service->flags.need_x_server_ip && Config.icapcfg.send_server_ip)
5162
+        icapAddOriginIP(&mb, icap->request->host);
5163
+
5164
+    if ((service->flags.need_x_authenticated_user
5165
+	    && Config.icapcfg.send_auth_user)
5073
+	&& (icap->request->auth_user_request != NULL))
5166
+	&& (icap->request->auth_user_request != NULL))
5074
+	icapAddAuthUserHeader(&mb, icap->request->auth_user_request);
5167
+	icapAddAuthUserHeader(&mb, icap->request->auth_user_request);
5075
+    if (service->keep_alive) {
5168
+    if (service->keep_alive) {
Lines 5348-5355 Link Here
5348
RCS file: src/icap_respmod.c
5441
RCS file: src/icap_respmod.c
5349
diff -N src/icap_respmod.c
5442
diff -N src/icap_respmod.c
5350
--- /dev/null	1 Jan 1970 00:00:00 -0000
5443
--- /dev/null	1 Jan 1970 00:00:00 -0000
5351
+++ src/icap_respmod.c	23 Nov 2005 20:34:34 -0000	1.1.2.60
5444
+++ src/icap_respmod.c	17 Feb 2006 12:45:23 -0000	1.1.2.64
5352
@@ -0,0 +1,1039 @@
5445
@@ -0,0 +1,1057 @@
5353
+
5446
+
5354
+/*
5447
+/*
5355
+ * $Id$
5448
+ * $Id$
Lines 5410-5422 Link Here
5410
+	memBufPrintf(mb, ", res-body=%1d", o3);
5503
+	memBufPrintf(mb, ", res-body=%1d", o3);
5411
+    else
5504
+    else
5412
+	memBufPrintf(mb, ", null-body=%1d", -o3);
5505
+	memBufPrintf(mb, ", null-body=%1d", -o3);
5506
+    memBufPrintf(mb, crlf);
5413
+
5507
+
5414
+    memBufPrintf(mb, crlf);
5508
+    if (service->flags.need_x_client_ip && Config.icapcfg.send_client_ip) {
5415
+    if (Config.icapcfg.send_client_ip || service->flags.need_x_client_ip) {
5416
+	memBufPrintf(mb, "X-Client-IP: %s\r\n", client_addr);
5509
+	memBufPrintf(mb, "X-Client-IP: %s\r\n", client_addr);
5417
+    }
5510
+    }
5418
+    if ((Config.icapcfg.send_auth_user
5511
+
5419
+	    || service->flags.need_x_authenticated_user)
5512
+    if (service->flags.need_x_server_ip && Config.icapcfg.send_server_ip)
5513
+        icapAddOriginIP(mb, icap->request->host);
5514
+
5515
+    if ((service->flags.need_x_authenticated_user
5516
+	    && Config.icapcfg.send_auth_user)
5420
+	&& (icap->request->auth_user_request != NULL)) {
5517
+	&& (icap->request->auth_user_request != NULL)) {
5421
+	icapAddAuthUserHeader(mb, icap->request->auth_user_request);
5518
+	icapAddAuthUserHeader(mb, icap->request->auth_user_request);
5422
+    }
5519
+    }
Lines 5456-5461 Link Here
5456
+	consumed = -1;
5553
+	consumed = -1;
5457
+	o2 = -1;
5554
+	o2 = -1;
5458
+	memBufDefInit(&mb_hdr);
5555
+	memBufDefInit(&mb_hdr);
5556
+	httpBuildRequestPrefix(icap->request, icap->request,
5557
+			       icap->respmod.entry, &mb_hdr, icap->http_flags);
5558
+	o3 = mb_hdr.size;
5459
+    } else {
5559
+    } else {
5460
+
5560
+
5461
+	hlen = headersEnd(icap->respmod.req_hdr_copy.buf,
5561
+	hlen = headersEnd(icap->respmod.req_hdr_copy.buf,
Lines 5484-5496 Link Here
5484
+	httpBuildRequestPrefix(icap->request, icap->request,
5584
+	httpBuildRequestPrefix(icap->request, icap->request,
5485
+	    icap->respmod.entry, &mb_hdr, icap->http_flags);
5585
+	    icap->respmod.entry, &mb_hdr, icap->http_flags);
5486
+	o2 = mb_hdr.size;
5586
+	o2 = mb_hdr.size;
5587
+
5588
+    	/* Copy response header - Append to request header mbuffer */
5589
+	memBufAppend(&mb_hdr,
5590
+		     icap->respmod.req_hdr_copy.buf, icap->respmod.req_hdr_copy.size);
5591
+	o3 = mb_hdr.size;
5487
+    }
5592
+    }
5488
+
5593
+
5489
+    /* Copy response header - Append to request header mbuffer */
5490
+    memBufAppend(&mb_hdr,
5491
+	icap->respmod.req_hdr_copy.buf, icap->respmod.req_hdr_copy.size);
5492
+    o3 = mb_hdr.size;
5493
+
5494
+    service = icap->current_service;
5594
+    service = icap->current_service;
5495
+    assert(service);
5595
+    assert(service);
5496
+    client_addr = inet_ntoa(icap->request->client_addr);
5596
+    client_addr = inet_ntoa(icap->request->client_addr);
Lines 5604-5609 Link Here
5604
+#endif
5704
+#endif
5605
+
5705
+
5606
+    if (icap->sc == 0) {
5706
+    if (icap->sc == 0) {
5707
+        // http connection has been closed without sending us anything
5708
+        if(len == 0 && theEnd == 1) {
5709
+	    ErrorState *err;
5710
+	    err = errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY);
5711
+	    err->request = requestLink(icap->request);
5712
+	    errorAppendEntry(icap->respmod.entry, err);
5713
+	    comm_close(icap->icap_fd);
5714
+	    return;
5715
+        }
5716
+
5607
+	/* No data sent yet. Start with headers */
5717
+	/* No data sent yet. Start with headers */
5608
+	if ((icap->sc = buildRespModHeader(&mb, icap, buf, len, theEnd)) > 0) {
5718
+	if ((icap->sc = buildRespModHeader(&mb, icap, buf, len, theEnd)) > 0) {
5609
+	    buf += icap->sc;
5719
+	    buf += icap->sc;
Lines 5979-5984 Link Here
5979
+	commSetSelect(fd, COMM_SELECT_READ, icapRespModReadReply, icap, 0);
6089
+	commSetSelect(fd, COMM_SELECT_READ, icapRespModReadReply, icap, 0);
5980
+#if 1
6090
+#if 1
5981
+	commSetTimeout(fd, Config.Timeout.read, icapReadTimeout, icap);
6091
+	commSetTimeout(fd, Config.Timeout.read, icapReadTimeout, icap);
6092
+	commSetDefer(fd, fwdCheckDeferRead, icap->respmod.entry);
5982
+#else
6093
+#else
5983
+	if (icap->flags.wait_for_preview_reply || icap->flags.http_server_eof) {
6094
+	if (icap->flags.wait_for_preview_reply || icap->flags.http_server_eof) {
5984
+	    /*
6095
+	    /*
Lines 6534-6544 Link Here
6534
Index: src/protos.h
6645
Index: src/protos.h
6535
===================================================================
6646
===================================================================
6536
RCS file: /cvsroot/squid/squid/src/protos.h,v
6647
RCS file: /cvsroot/squid/squid/src/protos.h,v
6537
retrieving revision 1.41.6.33
6648
retrieving revision 1.41.6.34
6538
retrieving revision 1.41.6.13.2.37
6649
retrieving revision 1.41.6.13.2.38
6539
diff -p -u -b -r1.41.6.33 -r1.41.6.13.2.37
6650
diff -p -u -b -r1.41.6.34 -r1.41.6.13.2.38
6540
--- src/protos.h	16 Sep 2005 02:13:25 -0000	1.41.6.33
6651
--- src/protos.h	26 Feb 2006 03:13:57 -0000	1.41.6.34
6541
+++ src/protos.h	6 Dec 2005 21:53:44 -0000	1.41.6.13.2.37
6652
+++ src/protos.h	16 Feb 2006 17:21:45 -0000	1.41.6.13.2.38
6542
@@ -292,6 +292,8 @@ extern void whoisStart(FwdState *);
6653
@@ -292,6 +292,8 @@ extern void whoisStart(FwdState *);
6543
 /* http.c */
6654
 /* http.c */
6544
 extern int httpCachable(method_t);
6655
 extern int httpCachable(method_t);
Lines 6556-6562 Link Here
6556
 
6667
 
6557
 extern char *mime_get_header(const char *mime, const char *header);
6668
 extern char *mime_get_header(const char *mime, const char *header);
6558
 extern char *mime_get_header_field(const char *mime, const char *name, const char *prefix);
6669
 extern char *mime_get_header_field(const char *mime, const char *name, const char *prefix);
6559
@@ -1341,4 +1344,49 @@ extern void externalAclShutdown(void);
6670
@@ -1341,4 +1344,53 @@ extern void externalAclShutdown(void);
6560
 extern int externalAclRequiresAuth(void *acl_data);
6671
 extern int externalAclRequiresAuth(void *acl_data);
6561
 extern char *strtokFile(void);
6672
 extern char *strtokFile(void);
6562
 
6673
 
Lines 6601-6606 Link Here
6601
+void icapOptInit(void);
6712
+void icapOptInit(void);
6602
+void icapOptShutdown(void);
6713
+void icapOptShutdown(void);
6603
+void icapOptSetUnreachable(icap_service * s);
6714
+void icapOptSetUnreachable(icap_service * s);
6715
+
6716
+/* X-Server-IP support */
6717
+void icapAddOriginIP(MemBuf *, const char *);
6718
+
6604
+/* for debugging purposes only */
6719
+/* for debugging purposes only */
6605
+void dump_icap_config(IcapConfig * cfg);
6720
+void dump_icap_config(IcapConfig * cfg);
6606
+#endif
6721
+#endif
Lines 6609-6618 Link Here
6609
Index: src/squid.h
6724
Index: src/squid.h
6610
===================================================================
6725
===================================================================
6611
RCS file: /cvsroot/squid/squid/src/squid.h,v
6726
RCS file: /cvsroot/squid/squid/src/squid.h,v
6612
retrieving revision 1.13.6.8
6727
retrieving revision 1.13.6.9
6613
retrieving revision 1.13.6.6.2.11
6728
retrieving revision 1.13.6.6.2.11
6614
diff -p -u -b -r1.13.6.8 -r1.13.6.6.2.11
6729
diff -p -u -b -r1.13.6.9 -r1.13.6.6.2.11
6615
--- src/squid.h	26 Mar 2005 03:15:58 -0000	1.13.6.8
6730
--- src/squid.h	11 Mar 2006 03:16:31 -0000	1.13.6.9
6616
+++ src/squid.h	15 May 2005 20:10:33 -0000	1.13.6.6.2.11
6731
+++ src/squid.h	15 May 2005 20:10:33 -0000	1.13.6.6.2.11
6617
@@ -38,6 +38,14 @@
6732
@@ -38,6 +38,14 @@
6618
 #include "config.h"
6733
 #include "config.h"
Lines 6711-6722 Link Here
6711
Index: src/structs.h
6826
Index: src/structs.h
6712
===================================================================
6827
===================================================================
6713
RCS file: /cvsroot/squid/squid/src/structs.h,v
6828
RCS file: /cvsroot/squid/squid/src/structs.h,v
6714
retrieving revision 1.48.2.43
6829
retrieving revision 1.48.2.46
6715
retrieving revision 1.48.2.9.2.48
6830
retrieving revision 1.48.2.9.2.49
6716
diff -p -u -b -r1.48.2.43 -r1.48.2.9.2.48
6831
diff -p -u -b -r1.48.2.46 -r1.48.2.9.2.49
6717
--- src/structs.h	4 Sep 2005 02:13:28 -0000	1.48.2.43
6832
--- src/structs.h	11 Mar 2006 03:16:31 -0000	1.48.2.46
6718
+++ src/structs.h	30 Nov 2005 21:52:15 -0000	1.48.2.9.2.48
6833
+++ src/structs.h	16 Feb 2006 17:21:45 -0000	1.48.2.9.2.49
6719
@@ -384,6 +384,22 @@ struct _RemovalPolicySettings {
6834
@@ -384,6 +384,23 @@ struct _RemovalPolicySettings {
6720
     wordlist *args;
6835
     wordlist *args;
6721
 };
6836
 };
6722
 
6837
 
Lines 6730-6735 Link Here
6730
+    int preview_size;
6845
+    int preview_size;
6731
+    int check_interval;
6846
+    int check_interval;
6732
+    int send_client_ip;
6847
+    int send_client_ip;
6848
+    int send_server_ip;
6733
+    int send_auth_user;
6849
+    int send_auth_user;
6734
+    char *auth_scheme;
6850
+    char *auth_scheme;
6735
+};
6851
+};
Lines 6749-6755 Link Here
6749
 };
6865
 };
6750
 
6866
 
6751
 struct _SquidConfig2 {
6867
 struct _SquidConfig2 {
6752
@@ -787,7 +806,10 @@ struct _fde {
6868
@@ -788,7 +807,10 @@ struct _fde {
6753
     } flags;
6869
     } flags;
6754
     squid_off_t bytes_read;
6870
     squid_off_t bytes_read;
6755
     squid_off_t bytes_written;
6871
     squid_off_t bytes_written;
Lines 6761-6767 Link Here
6761
     struct _fde_disk {
6877
     struct _fde_disk {
6762
 	DWCB *wrt_handle;
6878
 	DWCB *wrt_handle;
6763
 	void *wrt_handle_data;
6879
 	void *wrt_handle_data;
6764
@@ -982,6 +1004,130 @@ struct _http_state_flags {
6880
@@ -983,6 +1005,131 @@ struct _http_state_flags {
6765
     unsigned int request_sent:1;
6881
     unsigned int request_sent:1;
6766
 };
6882
 };
6767
 
6883
 
Lines 6846-6851 Link Here
6846
+    struct {
6962
+    struct {
6847
+	unsigned int allow_204:1;
6963
+	unsigned int allow_204:1;
6848
+	unsigned int need_x_client_ip:1;
6964
+	unsigned int need_x_client_ip:1;
6965
+	unsigned int need_x_server_ip:1;
6849
+	unsigned int need_x_authenticated_user:1;
6966
+	unsigned int need_x_authenticated_user:1;
6850
+    } flags;
6967
+    } flags;
6851
+    int preview;
6968
+    int preview;
Lines 6892-6898 Link Here
6892
 struct _HttpStateData {
7009
 struct _HttpStateData {
6893
     StoreEntry *entry;
7010
     StoreEntry *entry;
6894
     request_t *request;
7011
     request_t *request;
6895
@@ -993,10 +1139,14 @@ struct _HttpStateData {
7012
@@ -994,10 +1141,14 @@ struct _HttpStateData {
6896
     int fd;
7013
     int fd;
6897
     http_state_flags flags;
7014
     http_state_flags flags;
6898
     FwdState *fwd;
7015
     FwdState *fwd;
Lines 6915-6921 Link Here
6915
 	unsigned int hit:1;
7032
 	unsigned int hit:1;
6916
     } flags;
7033
     } flags;
6917
     struct {
7034
     struct {
6918
@@ -1100,6 +1251,9 @@ struct _clientHttpRequest {
7035
@@ -1107,6 +1253,9 @@ struct _clientHttpRequest {
6919
     } redirect;
7036
     } redirect;
6920
     dlink_node active;
7037
     dlink_node active;
6921
     squid_off_t maxBodySize;
7038
     squid_off_t maxBodySize;
Lines 6925-6931 Link Here
6925
 };
7042
 };
6926
 
7043
 
6927
 struct _ConnStateData {
7044
 struct _ConnStateData {
6928
@@ -1127,7 +1281,6 @@ struct _ConnStateData {
7045
@@ -1134,7 +1283,6 @@ struct _ConnStateData {
6929
     struct sockaddr_in me;
7046
     struct sockaddr_in me;
6930
     struct in_addr log_addr;
7047
     struct in_addr log_addr;
6931
     char rfc931[USER_IDENT_SZ];
7048
     char rfc931[USER_IDENT_SZ];
Lines 6933-6939 Link Here
6933
     struct {
7050
     struct {
6934
 	int n;
7051
 	int n;
6935
 	time_t until;
7052
 	time_t until;
6936
@@ -1678,6 +1831,9 @@ struct _request_t {
7053
@@ -1685,6 +1833,9 @@ struct _request_t {
6937
     char *peer_login;		/* Configured peer login:password */
7054
     char *peer_login;		/* Configured peer login:password */
6938
     time_t lastmod;		/* Used on refreshes */
7055
     time_t lastmod;		/* Used on refreshes */
6939
     const char *vary_headers;	/* Used when varying entities are detected. Changes how the store key is calculated */
7056
     const char *vary_headers;	/* Used when varying entities are detected. Changes how the store key is calculated */
Lines 6983-6992 Link Here
6983
Index: src/url.c
7100
Index: src/url.c
6984
===================================================================
7101
===================================================================
6985
RCS file: /cvsroot/squid/squid/src/url.c,v
7102
RCS file: /cvsroot/squid/squid/src/url.c,v
6986
retrieving revision 1.7.6.6
7103
retrieving revision 1.7.6.7
6987
retrieving revision 1.7.6.5.2.2
7104
retrieving revision 1.7.6.5.2.2
6988
diff -p -u -b -r1.7.6.6 -r1.7.6.5.2.2
7105
diff -p -u -b -r1.7.6.7 -r1.7.6.5.2.2
6989
--- src/url.c	12 Nov 2005 03:13:48 -0000	1.7.6.6
7106
--- src/url.c	11 Mar 2006 03:16:31 -0000	1.7.6.7
6990
+++ src/url.c	23 Nov 2005 20:38:56 -0000	1.7.6.5.2.2
7107
+++ src/url.c	23 Nov 2005 20:38:56 -0000	1.7.6.5.2.2
6991
@@ -103,6 +103,9 @@ const char *ProtocolStr[] =
7108
@@ -103,6 +103,9 @@ const char *ProtocolStr[] =
6992
     "whois",
7109
     "whois",
(-)files/pkg-deinstall.in (+40 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD: ports/www/squid/pkg-deinstall,v 1.6 2005/11/01 14:05:59 krion Exp $
4
#
5
6
PATH=/bin:/usr/bin:/usr/sbin
7
8
case $2 in
9
DEINSTALL)
10
	cd ${PKG_PREFIX}/etc/squid || exit 1
11
	for f in cachemgr.conf mime.conf msntauth.conf squid.conf; do
12
		cmp -s -z ${f} ${f}.default && rm ${f}
13
	done
14
	;;
15
POST-DEINSTALL)
16
	echo "===> post-deinstallation information for $1:"
17
	echo ""
18
	echo "     Note:"
19
	echo "     squid related user accounts and groups were not removed."
20
	echo ""
21
	echo "     To remove the '%%SQUID_UID%%' user and the '%%SQUID_GID%%' group which were"
22
	echo "     created by a default installation of this package, run"
23
	echo ""
24
	echo "     pw userdel -r -n %%SQUID_UID%% -u 100"
25
	echo ""
26
	if  [ -d ${PKG_PREFIX}/squid -o -d ${PKG_PREFIX}/etc/squid ] ; then
27
		echo ""
28
		echo "     To ease updates, the cache and log directories and"
29
		echo "     all configuration files modified by you were preserved."
30
		echo ""
31
		echo "     Please remove them manually if you do not want to use"
32
	       	echo "     squid any longer."
33
	fi
34
	echo ""
35
	;;
36
*)
37
	exit 64
38
	;;
39
esac
40
exit 0
(-)files/squid.sh.in (+87 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD: ports/www/squid/files/squid.sh,v 1.11 2005/12/25 23:38:48 edwin Exp $
4
#
5
# --begin rcng
6
# PROVIDE: squid
7
# REQUIRE: LOGIN
8
# KEYWORD: shutdown
9
# 
10
# Note:
11
# Set "squid_enable=yes" in either /etc/rc.conf, /etc/rc.conf.local or
12
# /etc/rc.conf.d/squid to make this script actually do something. There
13
# you can also set squid_chdir, squid_user, and squid_flags.
14
#
15
# Please see squid(8), rc.conf(5) and rc(8) for further details.
16
#
17
# --end rcng
18
19
name=squid
20
command=%%PREFIX%%/sbin/squid
21
# --begin rcng
22
extra_commands=reload
23
reload_cmd="${command} -k reconfigure"
24
# --end rcng
25
stop_cmd="squid_stop"
26
squid_chdir=${squid_chdir:-%%PREFIX%%/squid/logs}
27
# --begin rcng
28
squid_enable=${squid_enable:-"NO"}
29
# --end rcng
30
squid_flags=${squid_flags-"-D"}
31
squid_user=${squid_user:-%%SQUID_UID%%}
32
default_config=%%PREFIX%%/etc/squid/squid.conf
33
34
# --begin rcold
35
squid_stop() {
36
	echo -n " ${name}"
37
	${command} -k shutdown
38
	while ps -xcU ${squid_user} | grep -q squid; do
39
		sleep 2
40
	done
41
}
42
43
# --end rcold
44
# --begin rcng
45
squid_stop() {
46
	${command} -k shutdown
47
	run_rc_command poll
48
}
49
50
. %%RC_SUBR%%
51
rcvar=`set_rcvar`
52
load_rc_config ${name}
53
54
# squid(8) will not start if ${default_config} is not present so try
55
# to catch that beforehand via ${required_files} rather than make
56
# squid(8) crash.
57
# If you remove the default configuration file make sure to add
58
# '-f /path/to/your/squid.conf' to squid_flags
59
60
if [ -z "${squid_flags}" ]; then
61
	required_files=${default_config}
62
fi
63
required_dirs=${squid_chdir}
64
run_rc_command "$1"
65
# --end rcng
66
# --begin rcold
67
case $1 in
68
start)
69
	if [ -x "${command}" -a \
70
		\( -f "${default_config}" -o "${squid_flags}" \) ]; then
71
		echo -n " ${name}"
72
		(cd ${squid_chdir} && exec su -fm ${squid_user} -c \
73
			"${command} ${squid_flags}")
74
	fi
75
	;;
76
stop)
77
	if [ -x "${command}" ]; then
78
		${stop_cmd}
79
	fi
80
	;;
81
*)
82
	echo "usage: ${0##*/} {start|stop}" >&2
83
	exit 64
84
	;;
85
esac
86
exit 0
87
# --end rcold
(-)files/pkg-message.in (+24 lines)
Line 0 Link Here
1
     o You can find the configuration files for this package in the
2
       directory %%PREFIX%%/etc/squid.
3
     
4
     o A cache directory has been created in %%PREFIX%%/squid/cache.
5
       Log files will be written to %%PREFIX%%/squid/logs.
6
     
7
       Note:
8
       You must initialize new cache directories before you can start
9
       squid.  Do this by running "squid -z" as 'root' or '%%SQUID_UID%%'.
10
       If your cache directories are already initialized (e.g. after an
11
       upgrade of squid) you do not need to initialize them again.
12
13
     o The default configuration will deny everyone access to the
14
       proxy service. Edit the "http_access" directives in
15
       %%PREFIX%%/etc/squid.conf to suit your needs.
16
--begin rcng
17
18
     Please note that the squid start script is an rc.d style script.
19
     This means that squid will not start automatically at boot time.
20
21
     To enable squid, set squid_enable=yes in either
22
     etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/squid
23
     Please see %%PREFIX%%/etc/rc.d/squid(.sh) for further details.
24
--end rcng
(-)files/pkg-install.in (+138 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD: ports/www/squid/pkg-install,v 1.21 2006/01/09 13:37:54 jylefort Exp $
4
#
5
6
PATH=/bin:/usr/bin:/usr/sbin
7
pkgname=$1
8
squid_base="${PKG_PREFIX:-%%PREFIX%%}/squid"
9
squid_confdir="${PKG_PREFIX:-%%PREFIX%%}/etc/squid"
10
if [ -x /usr/sbin/nologin ]; then
11
	nologin=/usr/sbin/nologin
12
else
13
	nologin=/sbin/nologin
14
fi
15
squid_user="%%SQUID_UID%%"
16
squid_group="%%SQUID_GID%%"
17
squid_gid=100
18
squid_uid=100
19
# Try to catch the case where the $squid_user might have been created with an
20
# id greater than or equal 3128. The valid exception is "nobody".
21
nobody_uid=65534
22
nobody_gid=65534
23
squid_oldgid=3128
24
squid_olduid=3128
25
unset wrong_id
26
case $2 in
27
PRE-INSTALL)
28
	echo "===> Pre-installation configuration for ${pkgname}"
29
	if ! pw groupshow ${squid_group} -q >/dev/null ; then
30
		echo "There is no group '${squid_group}' on this system, so I will try to create it:"
31
		if ! pw groupadd ${squid_group} -g ${squid_gid} -q ; then
32
			echo "Failed to create group \"${squid_group}\"!" >&2
33
			echo "Please create it manually." >&2
34
			exit 1
35
		else
36
			echo "Group '${squid_group}' created successfully:"
37
		fi
38
	else
39
		echo "I will use the existing group '${squid_group}':"
40
		current_gid=`pw groupshow ${squid_group}|cut -f 3 -d :`
41
		if [ ${current_gid} -ge ${squid_oldgid} \
42
		    -a ${current_gid} -ne ${nobody_gid} ]; then
43
			wrong_id=1
44
		fi	
45
	fi
46
	pw groupshow ${squid_group}
47
48
	if ! pw usershow ${squid_user} -q >/dev/null ; then
49
		echo "There is no account '${squid_user}' on this system, so I will try to create it:"
50
		if ! pw useradd -q -n ${squid_user} \
51
		    -u ${squid_uid} -g ${squid_group} \
52
	  	    -c "squid caching-proxy pseudo user" \
53
		    -d "${squid_base}" -s "${nologin}" \
54
		    -h - ; then
55
			echo "Failed to create user '${squid_user}'!" >&2
56
			echo "Please create it manually." >&2
57
			exit 1
58
		else
59
			echo "User '${squid_user}' created successfully:"
60
		fi
61
	else
62
		echo "I will use the existing user '${squid_user}':"
63
		current_uid=`id -u ${squid_user}`
64
		if [ ${current_uid} -ge ${squid_olduid} \
65
		    -a ${current_uid} -ne ${nobody_uid} ];
66
		then
67
			wrong_id=1
68
		fi
69
	fi
70
	pw usershow ${squid_user}
71
	if [ "${wrong_id}" ]; then
72
		echo ""
73
		echo " * NOTICE *"
74
		echo ""
75
		echo "The squid pseudo-user's uid and/or gid have been found"
76
		echo "to be greater than or equal 3128."
77
		echo ""
78
		echo "This is not a problem as such, but violates the FreeBSD"
79
		echo "ports' principle that a ports must not claim a uid greater"
80
		echo "than 999."
81
		echo ""
82
		echo "Since version 2.5.4_11, the squid user is thus created"
83
		echo "with an id of ${squid_uid}:${squid_gid} while earlier versions of this"
84
		echo "port used the first unused uid/gid greater than or"
85
		echo "equal 3128."
86
		echo ""
87
		echo "If you want to change the existing squid user's id, run"
88
		echo "'make changeuser' after the installation has completed."
89
		echo "If you installed this port via a package, issue the"
90
		echo "following commands as root:"
91
		echo ""
92
		echo "pw userdel -u ${current_uid}"
93
		echo "pw groupadd -n ${squid_group} -g ${squid_gid}"
94
		echo "pw useradd -n ${squid_user} -u ${squid_uid} \\"
95
		echo "    -c \"squid caching-proxy pseudo user\" \\"
96
		echo "    -g ${squid_group} -d ${squid_base} -s /sbin/nologin \\"
97
		echo "    -h -"
98
		echo "find -H ${PKG_PREFIX} -user ${current_uid} -exec chown ${squid_user} {} \\;"
99
		echo "find -H ${PKG_PREFIX} -group ${current_gid} -exec chgrp ${squid_group} {} \\;"
100
		echo ""
101
		echo "In case you have installed third party software for squid"
102
		echo "like squidGuard, you should additionally run:"
103
		echo "find -H /var -user ${current_uid} -exec chown ${squid_user} {} \\;"
104
		echo "find -H /var -group ${current_gid} -exec chgrp ${squid_group} {} \\;"
105
		echo ""
106
		if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
107
			sleep 30
108
		fi
109
	fi
110
	for dir in cache logs; do
111
	if [ ! -d ${squid_base}/${dir} ]; then
112
		echo "Creating ${squid_base}/${dir}..."
113
		install -d -o ${squid_user} -g ${squid_group} \
114
		    -m 0750 ${squid_base}/${dir}
115
	fi
116
	done
117
	if [ ! -d ${squid_confdir} ]; then
118
		echo "Creating ${squid_confdir}..."
119
		install -d -o root -g ${squid_group} \
120
		    -m 0750 ${squid_confdir}
121
	fi
122
	;;
123
POST-INSTALL)
124
	for file in cachemgr.conf mime.conf squid.conf; do
125
		if [ ! -f ${squid_confdir}/${file} \
126
		    -a -f ${squid_confdir}/${file}.default ]; then
127
			echo "Creating ${file} from default..."
128
			install -c -o root -g ${squid_group} -m 0640 \
129
		    	    ${squid_confdir}/${file}.default \
130
			    ${squid_confdir}/${file}
131
		fi
132
	done
133
	;;
134
*)
135
	exit 64
136
	;;
137
esac
138
exit 0
(-)Makefile (-17 / +31 lines)
Lines 72-79 Link Here
72
#
72
#
73
73
74
PORTNAME=	squid
74
PORTNAME=	squid
75
PORTVERSION=	2.5.12
75
PORTVERSION=	2.5.13
76
PORTREVISION=	4
77
CATEGORIES=	www
76
CATEGORIES=	www
78
MASTER_SITES=	\
77
MASTER_SITES=	\
79
		ftp://ftp.squid-cache.org/pub/%SUBDIR%/ \
78
		ftp://ftp.squid-cache.org/pub/%SUBDIR%/ \
Lines 82-94 Link Here
82
		ftp://ftp.mirrorservice.org/sites/ftp.squid-cache.org/pub/%SUBDIR%/ \
81
		ftp://ftp.mirrorservice.org/sites/ftp.squid-cache.org/pub/%SUBDIR%/ \
83
		${MASTER_SITE_RINGSERVER:S,%SUBDIR%,net/www/squid/&,}
82
		${MASTER_SITE_RINGSERVER:S,%SUBDIR%,net/www/squid/&,}
84
MASTER_SITE_SUBDIR=	squid-2/STABLE
83
MASTER_SITE_SUBDIR=	squid-2/STABLE
85
DISTNAME=	squid-2.5.STABLE12
84
DISTNAME=	squid-2.5.STABLE13
86
DIST_SUBDIR=	squid2.5
85
DIST_SUBDIR=	squid2.5
87
86
88
PATCH_SITES=	http://www.squid-cache.org/Versions/v2/2.5/bugs/
87
PATCH_SITES=	http://www.squid-cache.org/Versions/v2/2.5/bugs/
89
PATCHFILES=	squid-2.5.STABLE12-SMB_BadFetch.patch \
88
PATCHFILES=
90
		squid-2.5.STABLE12-wbinfo_group.patch \
91
		squid-2.5.STABLE12-asyncio_counters.patch
92
PATCH_DIST_STRIP=	-p1
89
PATCH_DIST_STRIP=	-p1
93
90
94
MAINTAINER=	tmseck@netcologne.de
91
MAINTAINER=	tmseck@netcologne.de
Lines 98-104 Link Here
98
GNU_CONFIGURE=	yes
95
GNU_CONFIGURE=	yes
99
USE_BZIP2=	yes
96
USE_BZIP2=	yes
100
USE_PERL5=	yes
97
USE_PERL5=	yes
101
USE_REINPLACE=	yes
102
98
103
SQUID_UID?=	squid
99
SQUID_UID?=	squid
104
SQUID_GID?=	squid
100
SQUID_GID?=	squid
Lines 106-113 Link Here
106
MAN8=		cachemgr.cgi.8 squid.8
102
MAN8=		cachemgr.cgi.8 squid.8
107
docs=		QUICKSTART README RELEASENOTES.html doc/debug-sections.txt
103
docs=		QUICKSTART README RELEASENOTES.html doc/debug-sections.txt
108
PORTDOCS=	${docs:T}
104
PORTDOCS=	${docs:T}
105
SUB_FILES+=	pkg-deinstall pkg-install pkg-message
106
SUB_LIST+=	SQUID_UID=${SQUID_UID} SQUID_GID=${SQUID_GID}
109
107
110
OPTIONS=	SQUID_LDAP_AUTH "Install LDAP authentication helpers" off \
108
OPTIONS=	SQUID_LDAP_AUTH "Install LDAP authentication helpers" off \
109
		SQUID_SASL_AUTH "Install SASL authentication helpers" off \
111
		SQUID_DELAY_POOLS "Enable delay pools" off \
110
		SQUID_DELAY_POOLS "Enable delay pools" off \
112
		SQUID_SNMP "Enable SNMP support" off \
111
		SQUID_SNMP "Enable SNMP support" off \
113
		SQUID_CARP "Enable CARP support" off \
112
		SQUID_CARP "Enable CARP support" off \
Lines 133-141 Link Here
133
		SQUID_COSS "Enable the COSS storage scheme" off \
132
		SQUID_COSS "Enable the COSS storage scheme" off \
134
		SQUID_LARGEFILE "Support log and cache files >2GB" off \
133
		SQUID_LARGEFILE "Support log and cache files >2GB" off \
135
		SQUID_STACKTRACES "Create backtraces on fatal errors" off \
134
		SQUID_STACKTRACES "Create backtraces on fatal errors" off \
136
		SQUID_RCNG "Install an rcNG startup script" on
135
		SQUID_RCNG "Install an rc.d style startup script" on
137
136
138
etc_files=	rc.d/squid.sh squid/cachemgr.conf.default \
137
etc_files=	squid/cachemgr.conf.default \
139
		squid/mib.txt squid/mime.conf.default \
138
		squid/mib.txt squid/mime.conf.default \
140
		squid/msntauth.conf.default squid/squid.conf.default
139
		squid/msntauth.conf.default squid/squid.conf.default
141
140
Lines 193-198 Link Here
193
external_acl+=	ldap_group
192
external_acl+=	ldap_group
194
libexec+=	squid_ldap_auth squid_ldap_group
193
libexec+=	squid_ldap_auth squid_ldap_group
195
.endif
194
.endif
195
.if defined(WITH_SQUID_SASL_AUTH)
196
LIB_DEPENDS+=	sasl2.2:${PORTSDIR}/security/cyrus-sasl2
197
CFLAGS+=	-I${LOCALBASE}/include
198
CPPFLAGS+=	-I${LOCALBASE}/include
199
LDFLAGS+=	-L${LOCALBASE}/lib
200
basic_auth+=	SASL
201
libexec+=	sasl_auth
202
.endif
196
.if !defined(NO_NIS)
203
.if !defined(NO_NIS)
197
basic_auth+=	YP
204
basic_auth+=	YP
198
libexec+=	yp_auth
205
libexec+=	yp_auth
Lines 320-329 Link Here
320
STRIP=			""
327
STRIP=			""
321
.endif
328
.endif
322
.if !defined(WITHOUT_SQUID_RCNG)
329
.if !defined(WITHOUT_SQUID_RCNG)
323
USE_RC_SUBR=	yes
330
USE_RC_SUBR=	squid.sh
324
rc_del=		rcold
331
rc_del=		rcold
325
rc_state=	rcng
332
rc_state=	rcng
326
.else
333
.else
334
SUB_FILES+=	squid.sh
335
etc_files+=	rc.d/squid.sh
327
rc_del=		rcng
336
rc_del=		rcng
328
rc_state=	rcold
337
rc_state=	rcold
329
.endif
338
.endif
Lines 334-340 Link Here
334
# will be installed; the default language will be English.
343
# will be installed; the default language will be English.
335
344
336
SQUID_LANGUAGES?=	\
345
SQUID_LANGUAGES?=	\
337
	Bulgarian Catalan Czech Danish Dutch English Estonian Finnish      \
346
	Azerbaijani Bulgarian Catalan Czech Danish Dutch English Estonian Finnish      \
338
	French German Greek Hebrew Hungarian Italian Japanese Korean Lithuanian \
347
	French German Greek Hebrew Hungarian Italian Japanese Korean Lithuanian \
339
	Polish Portuguese Romanian Russian-1251 Russian-koi8-r Serbian     \
348
	Polish Portuguese Romanian Russian-1251 Russian-koi8-r Serbian     \
340
	Simplify_Chinese Slovak Spanish Swedish Traditional_Chinese Turkish
349
	Simplify_Chinese Slovak Spanish Swedish Traditional_Chinese Turkish
Lines 346-351 Link Here
346
CONFIGURE_ARGS+=	${SQUID_CONFIGURE_ARGS}
355
CONFIGURE_ARGS+=	${SQUID_CONFIGURE_ARGS}
347
356
348
CONFIGURE_ENV+=		CFLAGS="${CFLAGS}" \
357
CONFIGURE_ENV+=		CFLAGS="${CFLAGS}" \
358
			CPPFLAGS="${CPPFLAGS}"\
349
			LDFLAGS="${LDFLAGS}"
359
			LDFLAGS="${LDFLAGS}"
350
360
351
PLIST_DIRS=	etc/squid/icons libexec/squid
361
PLIST_DIRS=	etc/squid/icons libexec/squid
Lines 371-386 Link Here
371
	@${FIND} ${WRKSRC} -name '*.bak' -delete
381
	@${FIND} ${WRKSRC} -name '*.bak' -delete
372
	@${FIND} ${WRKSRC} -name '*.orig' -delete
382
	@${FIND} ${WRKSRC} -name '*.orig' -delete
373
# create the start script:
383
# create the start script:
374
	@${SED} -e 's|%%PREFIX%%|${PREFIX}|g' \
384
	@${REINPLACE_CMD} \
375
	    -e 's|%%SQUID_UID%%|${SQUID_UID}|g' \
376
	    -e 's|%%RC_SUBR%%|${RC_SUBR}|g' \
377
	    -e '/--begin ${rc_del}/,/--end ${rc_del}/d' \
385
	    -e '/--begin ${rc_del}/,/--end ${rc_del}/d' \
378
	    -e '/--.*${rc_state}/d' ${FILESDIR}/squid.sh \
386
	    -e '/--.*${rc_state}/d' ${WRKDIR}/squid.sh
379
	    >${WRKDIR}/squid.sh
387
# create variable information in pkg-message:
388
	@${REINPLACE_CMD} \
389
	    -e '/--begin ${rc_del}/,/--end ${rc_del}/d' \
390
	    -e '/--.*${rc_state}/d' ${PKGMESSAGE}
380
391
381
pre-su-install:
392
pre-su-install:
382
	@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${PREFIX} \
393
	@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${PREFIX} \
383
	    squid_user=${SQUID_UID} squid_group=${SQUID_GID} \
384
	    ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
394
	    ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
385
395
386
post-install:
396
post-install:
Lines 400-405 Link Here
400
	@${SETENV} PKG_PREFIX=${PREFIX} \
410
	@${SETENV} PKG_PREFIX=${PREFIX} \
401
	    ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
411
	    ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
402
412
413
	@${ECHO_CMD} "===> post-installation information for ${PKGNAME}:"
414
	@${ECHO_CMD} ""
415
	@${CAT} ${PKGMESSAGE}
416
	@${ECHO_CMD} ""
403
changeuser:
417
changeuser:
404
# Recover from the problem that earlier versions of this port created the
418
# Recover from the problem that earlier versions of this port created the
405
# squid pseudo-user with an id greater than 999 which is not allowed in
419
# squid pseudo-user with an id greater than 999 which is not allowed in

Return to bug 94642