From 2eb8391e81148a22f8948f90dd364596216e6f60 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 14 Dec 2009 18:09:25 +0100 Subject: [PATCH] [guillaume] add user-agent when downloading a remote image. Fixes #5513 --- src/htmltextview.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/htmltextview.py b/src/htmltextview.py index 35a289ebb..e91af9462 100644 --- a/src/htmltextview.py +++ b/src/htmltextview.py @@ -489,7 +489,9 @@ class HtmlHandler(xml.sax.handler.ContentHandler): # Wait maximum 1s for connection socket.setdefaulttimeout(1) try: - f = urllib2.urlopen(attrs['src']) + req = urllib2.Request(attrs['src']) + req.add_header('User-Agent', 'Gajim ' + gajim.version) + f = urllib2.urlopen(req) except Exception, ex: gajim.log.debug('Error loading image %s ' % attrs['src'] + str(ex)) pixbuf = None