#11168 closed defect (fixed)
linksleeve error when hitting timeout
Reported by: | Christian Boos | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | plugin - spam-filter |
Component: | plugin/spamfilter | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In the t.e.o logs for this Trac, I see a bunch of these:
Trac[filtersystem] ERROR: Filter strategy <tracspamfilter.filters.linksleeve.LinkSleeveFilterStrategy object at 0x7fe55c8315d0> raised exception: TimeoutHTTPConnection instance has no attribute 'getreply' Traceback (most recent call last): File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/TracSpamFilter-0.8.0dev_r11751-py2.6.egg/tracspamfilter/filtersystem.py", line 213, in test retval = strategy.test(req, author, content, ip) File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/TracSpamFilter-0.8.0dev_r11751-py2.6.egg/tracspamfilter/filters/linksleeve.py", line 46, in test if TimeoutServerProxy('http://www.linksleeve.org/slv.php').slv(content) != 1: File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "/usr/lib/python2.6/xmlrpclib.py", line 1237, in request errcode, errmsg, headers = h.getreply() AttributeError: TimeoutHTTPConnection instance has no attribute 'getreply'
(running TracSpamFilter-0.8.0dev_r11751-py2.6.egg
)
Attachments (0)
Change History (8)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Milestone: | → plugin - spam-filter |
---|
Done (running 0.8.0dev-r11782 + patch). Let's see how it behaves now.
follow-up: 7 comment:3 by , 12 years ago
Hm, no, same error:
[pid 13715 139956728231680] 2013-04-28 07:14:49,452 Trac[filtersystem] ERROR: Filter strategy <tracspamfilter.filters.linksleeve.LinkSleeveFilterStrategy object at 0x7f4a46cc37d0> raised exception: TimeoutHTTPConnection instance has no attribute 'getreply' Traceback (most recent call last): File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/TracSpamFilter-0.8.0dev_r11782-py2.6.egg/tracspamfilter/filtersystem.py", line 213, in test retval = strategy.test(req, author, content, ip) File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/TracSpamFilter-0.8.0dev_r11782-py2.6.egg/tracspamfilter/filters/linksleeve.py", line 46, in test if TimeoutServerProxy('http://www.linksleeve.org/slv.php').slv(content) != 1: File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "/usr/lib/python2.6/xmlrpclib.py", line 1237, in request errcode, errmsg, headers = h.getreply() AttributeError: TimeoutHTTPConnection instance has no attribute 'getreply'
I'm now trying this:
-
tracspamfilter/timeoutserverproxy.py
20 20 class TimeoutHTTPConnection(httplib.HTTPConnection): 21 21 def __init__(self,host,timeout=3): 22 22 httplib.HTTPConnection.__init__(self,host,timeout=timeout) 23 24 # in python 2.6, xmlrpclib expects to use an httplib.HTTP 25 # instance and will call getreply() and getfile() 26 27 def getreply(self): 28 response = self.getresponse() 29 self.file = response.fp 30 return response.status, response.reason, response.msg 31 32 def getfile(self): 33 return self.file 23 34 35 24 36 class TimeoutTransport(Transport): 25 37 def __init__(self, timeout=3, *l, **kw): 26 38 Transport.__init__(self,*l,**kw) 27 39 self.timeout=timeout 40 28 41 def make_connection(self, host): 29 42 conn = TimeoutHTTPConnection(host,self.timeout) 30 43 return conn 31 44 45 32 46 class TimeoutServerProxy(ServerProxy): 33 47 def __init__(self,uri,timeout=3,*l,**kw): 34 48 kw['transport']=TimeoutTransport(timeout=timeout, use_datetime=kw.get('use_datetime',0))
… and while trying to spam this ticket, I got a "LinkSleeve says this is spam" message on the rejection page, without a backtrace in the log, so I think it must work.
comment:5 by , 12 years ago
Yes, for me (well, here on t.e.o) it works. I was giving it a few more days to see if anything else popped up in the .log, but it seems alright.
I can directly commit the patch from there, if that's OK for you.
comment:8 by , 12 years ago
Owner: | changed from | to
---|
Please try following and tell me results.
tracspamfilter/timeoutserverproxy.py