From b4bc2eadd3c98eb10f70ec7f67d97819f955ae8f Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Sat, 15 Dec 2007 19:24:01 -0800 Subject: [PATCH] Add proper version numbers to the user-agent string. --- HTTPDownloader.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/HTTPDownloader.py b/HTTPDownloader.py index 140aace..7e5a06c 100644 --- a/HTTPDownloader.py +++ b/HTTPDownloader.py @@ -1,11 +1,15 @@ from twisted.internet import reactor, defer, protocol from twisted.internet.protocol import ClientFactory +from twisted import version as twisted_version from twisted.web2.client.interfaces import IHTTPClientManager from twisted.web2.client.http import ProtocolError, ClientRequest, HTTPClientProtocol +from twisted.web2 import stream as stream_mod, http_headers +from twisted.web2 import version as web2_version from twisted.trial import unittest from zope.interface import implements -from twisted.web2 import stream as stream_mod, http_headers + +from apt_dht_conf import version class HTTPClientManager(ClientFactory): """A manager for all HTTP requests to a single site. @@ -108,7 +112,8 @@ class HTTPClientManager(ClientFactory): def setCommonHeaders(self): headers = http_headers.Headers() headers.setHeader('Host', self.host) - headers.setHeader('User-Agent', 'apt-dht/0.0.0 (twisted.web2 0.2.0+svn20070403)') + headers.setHeader('User-Agent', 'apt-dht/%s (twisted/%s twisted.web2/%s)' % + (version.short(), twisted_version.short(), web2_version.short())) return headers def get(self, path, method="GET"): -- 2.39.5