From: kaliko Date: Sun, 11 Oct 2015 09:49:30 +0000 (+0200) Subject: Fixed http client not honoring HTTP_PROXY (Closes #3) X-Git-Tag: 0.14.0~3 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;ds=sidebyside;h=f3df46ac87d5f9d1824156d9fed605dd03f3ccde;p=mpd-sima.git Fixed http client not honoring HTTP_PROXY (Closes #3) --- diff --git a/data/man/mpd-sima.1 b/data/man/mpd-sima.1 index c139e79..596f9ad 100644 --- a/data/man/mpd-sima.1 +++ b/data/man/mpd-sima.1 @@ -2,12 +2,12 @@ .\" Title: mpd-sima .\" Author: Jack Kaliko .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/20/2015 +.\" Date: 10/11/2015 .\" Manual: mpd-sima 0.14.0 User Manual .\" Source: mpd-sima .\" Language: English .\" -.TH "MPD\-SIMA" "1" "09/20/2015" "mpd-sima" "mpd-sima 0.14.0 User Manual" +.TH "MPD\-SIMA" "1" "10/11/2015" "mpd-sima" "mpd-sima 0.14.0 User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -253,6 +253,13 @@ syntax as documented in mpc manual, cf\&. .br To use a password, provide a value of the form "password@host"\&. .RE +.PP +\fBHTTP_PROXY\fR, \fBHTTPS_PROXY\fR +.RS 4 +mpd\-sima honors +\fBHTTP_PROXY\fR +environment variables\&. +.RE .SH "CONFIGURATION" .PP mpd_sima\&.cfg diff --git a/data/man/mpd_sima.1.xml b/data/man/mpd_sima.1.xml index c0b59d4..16810bd 100644 --- a/data/man/mpd_sima.1.xml +++ b/data/man/mpd_sima.1.xml @@ -241,6 +241,12 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + + HTTP_PROXY, HTTPS_PROXY + + &dhutils; honors HTTP_PROXY environment variables. + + diff --git a/doc/Changelog b/doc/Changelog index 03d5ee3..ccfe3c6 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -8,6 +8,7 @@ MPD_sima v0.14.0 * Fixed http cache for lastFM * Cleanup code (removed users similarities) * Make "var-dir" option default name instead of "var_dir" + * Honor HTTP_PROXY env. var. -- kaliko jack UNRELEASED diff --git a/sima/lib/http.py b/sima/lib/http.py index 0c1b396..10fae9c 100644 --- a/sima/lib/http.py +++ b/sima/lib/http.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2014 Jack Kaliko +# Copyright (c) 2014-2015 Jack Kaliko # Copyright (c) 2012, 2013 Eric Larson # # This program is free software: you can redistribute it and/or modify @@ -301,7 +301,8 @@ class HttpClient: def fetch_ws(self, prepreq): """fetch from web service""" sess = Session() - resp = sess.send(prepreq, timeout=SOCKET_TIMEOUT) + settings = sess.merge_environment_settings(prepreq.url, {}, None, False, None) + resp = sess.send(prepreq, timeout=SOCKET_TIMEOUT, **settings) if resp.status_code == 304: self.stats.update(etag=self.stats.get('etag')+1) resp = self.controller.update_cached_response(prepreq, resp)