[guillaume] add user-agent when downloading a remote image. Fixes #5513

This commit is contained in:
Yann Leboulanger 2009-12-14 18:09:25 +01:00
parent 4b07509d5e
commit 2eb8391e81
1 changed files with 3 additions and 1 deletions

View File

@ -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