[ostree] fetcher: Honor http_proxy environment variable
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] fetcher: Honor http_proxy environment variable
- Date: Tue, 1 Apr 2014 23:12:59 +0000 (UTC)
commit edc866520661d78704fb18e8866bdac56fe27a3e
Author: Colin Walters <walters verbum org>
Date: Tue Apr 1 19:12:39 2014 -0400
fetcher: Honor http_proxy environment variable
https://bugzilla.gnome.org/show_bug.cgi?id=706809
src/libostree/ostree-fetcher.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c
index 6b55378..c3e5803 100644
--- a/src/libostree/ostree-fetcher.c
+++ b/src/libostree/ostree-fetcher.c
@@ -147,6 +147,7 @@ static void
ostree_fetcher_init (OstreeFetcher *self)
{
gint max_conns;
+ const char *http_proxy;
g_queue_init (&self->pending_queue);
self->session = soup_session_async_new_with_options (SOUP_SESSION_USER_AGENT, "ostree ",
@@ -156,6 +157,22 @@ ostree_fetcher_init (OstreeFetcher *self)
SOUP_SESSION_TIMEOUT, 60,
SOUP_SESSION_IDLE_TIMEOUT, 60,
NULL);
+
+ http_proxy = g_getenv ("http_proxy");
+ if (http_proxy)
+ {
+ SoupURI *proxy_uri = soup_uri_new (http_proxy);
+ if (!proxy_uri)
+ {
+ g_warning ("Invalid proxy URI '%s'", http_proxy);
+ }
+ else
+ {
+ g_object_set (self->session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
+ soup_uri_free (proxy_uri);
+ }
+ }
+
self->requester = (SoupRequester *)soup_session_get_feature (self->session, SOUP_TYPE_REQUESTER);
g_object_get (self->session, "max-conns-per-host", &max_conns, NULL);
self->max_outstanding = 3 * max_conns;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]