[Secure-testing-commits] r9011 - bin

nion at alioth.debian.org nion at alioth.debian.org
Sat Jun 7 09:12:39 UTC 2008


Author: nion
Date: 2008-06-07 09:12:39 +0000 (Sat, 07 Jun 2008)
New Revision: 9011

Modified:
   bin/report-vuln
Log:
use urllib instead of httplib as it takes care of http_proxy by itself

Modified: bin/report-vuln
===================================================================
--- bin/report-vuln	2008-06-07 08:26:50 UTC (rev 9010)
+++ bin/report-vuln	2008-06-07 09:12:39 UTC (rev 9011)
@@ -13,7 +13,7 @@
 # }
 # export http_proxy if you need to use an http proxy to report bugs
 
-import sys, re, httplib, os
+import sys, re, urllib, os
 
 def gen_index(ids):
 	ret = ''
@@ -23,24 +23,16 @@
 
 	return ret
 
-def do_httpconnect(id):
-	proxy = os.getenv('http_proxy')
-	if proxy:
-		if proxy.lower().startswith('http://'):
-			proxy = proxy.replace('http://', '')
-
-	url = '/cgi-bin/cvename.cgi?name=' + id
-	host = 'cve.mitre.org'
-	if proxy != None:
-		host = proxy
-		url = 'http://cve.mitre.org' + url
-
+def http_get(id):
+	param = urllib.urlencode({'name' : id})
+	resp = ''
 	try:
-		conn = httplib.HTTPConnection(host)
-		conn.request('GET', url)
-		resp = conn.getresponse()
+		f = urllib.urlopen('http://cve.mitre.org/cgi-bin/cvename.cgi?%s' % param)
+		resp = f.read()
 	except Exception, e:
 		error('on doing HTTP request' + str(e))
+	
+	f.close()
 
 	return resp
 
@@ -50,9 +42,9 @@
 	r = re.compile('.*<th\ colspan=.*>Description<.*')
 	tag = re.compile('.*</?tr>.*')
 	ret = ''
-	resp = do_httpconnect(id)
+	resp = http_get(id)
 
-	for line in resp.read().rsplit('\n'):
+	for line in resp.rsplit('\n'):
 		if r.match(line):
 			desc = True
 			continue




More information about the Secure-testing-commits mailing list