? proxy-hostname.patch
Index: doc/cvs.texinfo
===================================================================
RCS file: /sources/cvs/ccvs/doc/cvs.texinfo,v
retrieving revision 1.674
diff -u -r1.674 cvs.texinfo
--- doc/cvs.texinfo	31 Dec 2005 23:34:22 -0000	1.674
+++ doc/cvs.texinfo	18 Jan 2006 12:59:10 -0000
@@ -2222,6 +2222,7 @@
 options are as follows:
 
 @table @code
+@cindex CVS_PROXY
 @cindex CVS_PROXY_PORT
 @cindex proxy, method option
 @cindex proxyport, method option
@@ -14996,6 +14997,13 @@
 if the port is not specified in the CVSROOT.
 @pxref{Remote repositories}
 
+@cindex CVS_PROXY
+@item $CVS_PROXY
+Used in client-server mode to set the proxy hostname to use when accessing
+a server via a web proxy, if the proxy hostname is not specified in the
+CVSROOT. Works with GSSAPI and the password authentication protocol.
+@pxref{Remote repositories}
+
 @cindex CVS_PROXY_PORT
 @item $CVS_PROXY_PORT
 Used in client-server mode to set the port to use when accessing a server
Index: src/ChangeLog
===================================================================
RCS file: /sources/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3337
diff -u -r1.3337 ChangeLog
--- src/ChangeLog	16 Jan 2006 19:06:05 -0000	1.3337
+++ src/ChangeLog	18 Jan 2006 12:59:41 -0000
@@ -1,3 +1,8 @@
+2006-01-18  Frank Hemer <frank@hemer.org>
+
+	* client.c (get_proxy_hostname): new fn to determin
+	CVS_PROXY env. variable for http proxy
+
 2006-01-16  Derek Price  <derek@ximbiot.com>
 
 	* sanity.sh (join-16a): Test "no such tag" error with -j.
@@ -7751,7 +7756,7 @@
 2003-02-01  Larry Jones  <lawrence.jones@eds.com>
 
 	* buffer.c (stdio_buffer_shutdown): Handle EINTR from waitpid.
-	(Patch from Johannes Grødem <johs+n@ifi.uio.no>.)
+	(Patch from Johannes Grdem <johs+n@ifi.uio.no>.)
 
 2003-02-01  Derek Price  <derek@ximbiot.com>
 
@@ -9230,7 +9235,7 @@
 
 2001-04-03  Derek Price  <dprice@collab.net>
 	    Larry Jones  <larry.jones@sdrc.com>
-	    reported by Jakob Bøhm  <JB@Danware.dk>
+	    reported by Jakob Bhm  <JB@Danware.dk>
 
 	* update.c (update_fileproc): Don't store a file with T_UNKNOWN status
 	in ignlist if present in the sandbox.
Index: src/client.c
===================================================================
RCS file: /sources/cvs/ccvs/src/client.c,v
retrieving revision 1.438
diff -u -r1.438 client.c
--- src/client.c	8 Dec 2005 00:53:08 -0000	1.438
+++ src/client.c	18 Jan 2006 12:59:50 -0000
@@ -3430,6 +3430,18 @@
 
 
 
+/* get the hostname for a client to connect to based on cvsroot_t.
+ */
+static char *
+get_proxy_hostname (const cvsroot_t *root)
+{
+    if (root->proxy_hostname) return root->proxy_hostname;
+
+    return getenv ("CVS_PROXY");
+}
+
+
+
 /* get the port number for a client to connect to based on the proxy port
  * of a cvsroot_t.
  */
@@ -3515,6 +3527,7 @@
     } client_sai;
     struct hostent *hostinfo;
     struct buffer *to_server, *from_server;
+    char *proxy_hostname;
 
     sock = socket (AF_INET, SOCK_STREAM, 0);
     if (sock == -1)
@@ -3522,13 +3535,13 @@
     port_number = get_cvs_port_number (root);
 
     /* if we have a proxy connect to that instead */
-    if (root->proxy_hostname)
+    if ((proxy_hostname = get_proxy_hostname (root)))
     {
         proxy_port_number = get_proxy_port_number (root);
-	hostinfo = init_sockaddr (&client_sai.addr_in, root->proxy_hostname,
+	hostinfo = init_sockaddr (&client_sai.addr_in, proxy_hostname,
                                   proxy_port_number);
         TRACE (TRACE_FUNCTION, "Connecting to %s:%d via proxy %s(%s):%d.",
-               root->hostname, port_number, root->proxy_hostname,
+               root->hostname, port_number, proxy_hostname,
                inet_ntoa (client_sai.addr_in.sin_addr), proxy_port_number);
     }
     else
@@ -3551,7 +3564,7 @@
     make_bufs_from_fds (sock, sock, 0, root, &to_server, &from_server, 1);
 
     /* if we have proxy then connect to the proxy first */
-    if (root->proxy_hostname)
+    if (proxy_hostname)
     {
 #define CONNECT_STRING "CONNECT %s:%d HTTP/1.0\r\n\r\n"
 	/* Send a "CONNECT" command to proxy: */
