mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-09 12:35:48 +01:00
- fixed "osc -H ..." in combination with a proxy
This commit is contained in:
parent
9034b27814
commit
8c506e5929
20
osc/conf.py
20
osc/conf.py
@ -531,12 +531,20 @@ def init_basicauth(config):
|
|||||||
# this is so ugly but httplib doesn't use
|
# this is so ugly but httplib doesn't use
|
||||||
# a logger object or such
|
# a logger object or such
|
||||||
def new_method(self, *args, **kwargs):
|
def new_method(self, *args, **kwargs):
|
||||||
self._orig_stdout = sys.stdout
|
# check if this is a recursive call (note: we do not
|
||||||
sys.stdout = StringIO()
|
# have to care about thread safety)
|
||||||
meth(self, *args, **kwargs)
|
is_rec_call = getattr(self, '_orig_stdout', None) is not None
|
||||||
hdr = sys.stdout.getvalue()
|
try:
|
||||||
sys.stdout = self._orig_stdout
|
if not is_rec_call:
|
||||||
del self._orig_stdout
|
self._orig_stdout = sys.stdout
|
||||||
|
sys.stdout = StringIO()
|
||||||
|
meth(self, *args, **kwargs)
|
||||||
|
hdr = sys.stdout.getvalue()
|
||||||
|
finally:
|
||||||
|
# restore original stdout
|
||||||
|
if not is_rec_call:
|
||||||
|
sys.stdout = self._orig_stdout
|
||||||
|
del self._orig_stdout
|
||||||
for i in hdrs:
|
for i in hdrs:
|
||||||
if ishdr:
|
if ishdr:
|
||||||
hdr = re.sub(r'%s:[^\\r]*\\r\\n' % i, '', hdr)
|
hdr = re.sub(r'%s:[^\\r]*\\r\\n' % i, '', hdr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user