[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

PATCH: using the env-var http_proxy

From: Joerg Beyer <job_at_webde-ag.de>
Date: 2001-12-07 07:53:40 CET

     Hi,

last night I built my own svn. Since I have an application level
gateway between me and the internet (nice name for a squid :-), I
need svn to respect the http_proxy environment variable. The patch
is easy, but only helps in the case where you use http, so it don't
helps if you use https.

In case anybody else could use it I send the patch.

Feel free to use it or correct me if you dont like anything about it.

hope this helps
Joerg

--- subversion/libsvn_ra_dav/session.c_orig Fri Dec 7 20:02:52 2001
+++ subversion/libsvn_ra_dav/session.c Fri Dec 7 20:17:24 2001
@@ -103,6 +103,7 @@ svn_ra_dav__open (void **session_baton,
ne_session *sess, *sess2;
struct uri uri = { 0 };
svn_ra_session_t *ras;
+ char* proxy = 0;

/* Sanity check the URI */
if (uri_parse(repository, &uri, NULL)
@@ -123,6 +124,28 @@ svn_ra_dav__open (void **session_baton,
/* Create two neon session objects, and set their properties... */
sess = ne_session_create();
sess2 = ne_session_create();
+
+ proxy = getenv("http_proxy");
+ if (proxy)
+ {
+ proxy = strdup(proxy);
+ // if the env-var named http_proxy is set to something like
+ // "http://myproxy.mydomain.com:3128" then we could use it.
+ if (strncmp(proxy,"http://",7) == 0)
+ {
+ char* host = &proxy[7];
+ char* colon = index(host,':');
+ if (colon)
+ {
+ int proxy_port = atoi(&colon[1]);
+ *colon = 0; // split of the hostname part
+ //fprintf(stderr,"using a proxy (%s, %d)\n",host,proxy_port);
+ ne_session_proxy(sess , host, proxy_port);
+ ne_session_proxy(sess2, host, proxy_port);
+ }
+ }
+ free(proxy);
+ }

#if 0
/* #### enable this block for debugging output on stderr. */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:51 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.