mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +01:00
Fixed #862645 - unquoted spaces getting sent in HTTP request
This commit is contained in:
parent
b6c780cff3
commit
1474c16a5f
@ -41,6 +41,7 @@ import re
|
|||||||
import sets
|
import sets
|
||||||
import getopt
|
import getopt
|
||||||
import socket
|
import socket
|
||||||
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from itertools import imap, ifilter
|
from itertools import imap, ifilter
|
||||||
@ -354,7 +355,7 @@ class Http(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
acronym = privmsgs.getArgs(args)
|
acronym = privmsgs.getArgs(args)
|
||||||
url = 'http://www.acronymfinder.com/' \
|
url = 'http://www.acronymfinder.com/' \
|
||||||
'af-query.asp?String=exact&Acronym=%s' % acronym
|
'af-query.asp?String=exact&Acronym=%s' % urllib.quote(acronym)
|
||||||
request = urllib2.Request(url, headers={'User-agent':
|
request = urllib2.Request(url, headers={'User-agent':
|
||||||
'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)'})
|
'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)'})
|
||||||
html = webutils.getUrl(request)
|
html = webutils.getUrl(request)
|
||||||
|
@ -93,6 +93,8 @@ class HttpTest(PluginTestCase, PluginDocumentation):
|
|||||||
self.assertRegexp('acronym ASAP', 'as soon as possible')
|
self.assertRegexp('acronym ASAP', 'as soon as possible')
|
||||||
self.assertNotRegexp('acronym asap', 'Definition')
|
self.assertNotRegexp('acronym asap', 'Definition')
|
||||||
self.assertNotRegexp('acronym UNIX', 'not an acronym')
|
self.assertNotRegexp('acronym UNIX', 'not an acronym')
|
||||||
|
# Used to pass requests with spaces ... make sure that stays fixed
|
||||||
|
self.assertNotError('acronym W T F')
|
||||||
|
|
||||||
def testNetcraft(self):
|
def testNetcraft(self):
|
||||||
self.assertNotError('netcraft slashdot.org')
|
self.assertNotError('netcraft slashdot.org')
|
||||||
|
Loading…
Reference in New Issue
Block a user