Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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:

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 Dirk Stöcker, 7 years ago

Please try following and tell me results.

  • tracspamfilter/timeoutserverproxy.py

     
    2828    def make_connection(self, host):
    2929        conn = TimeoutHTTPConnection(host,self.timeout)
    3030        return conn
     31    # python 2.6, in 2.7 _conn is directly a HTTPConnection
     32    def getreply(self):
     33        response = self._conn.getresponse()
     34        return response.status, response.reason, response.msg
    3135
    3236class TimeoutServerProxy(ServerProxy):
    3337    def __init__(self,uri,timeout=3,*l,**kw):

comment:2 by Christian Boos, 7 years ago

Milestone: plugin - spam-filter

Done (running 0.8.0dev-r11782 + patch). Let's see how it behaves now.

comment:3 by Christian Boos, 7 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

     
    2020class TimeoutHTTPConnection(httplib.HTTPConnection):
    2121    def __init__(self,host,timeout=3):
    2222        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
    2334
     35
    2436class TimeoutTransport(Transport):
    2537    def __init__(self, timeout=3, *l, **kw):
    2638        Transport.__init__(self,*l,**kw)
    2739        self.timeout=timeout
     40
    2841    def make_connection(self, host):
    2942        conn = TimeoutHTTPConnection(host,self.timeout)
    3043        return conn
    3144
     45
    3246class TimeoutServerProxy(ServerProxy):
    3347    def __init__(self,uri,timeout=3,*l,**kw):
    3448        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:4 by Dirk Stöcker, 7 years ago

Verified? Should I add the patch?

Last edited 7 years ago by Dirk Stöcker (previous) (diff)

comment:5 by Christian Boos, 7 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:6 by Dirk Stöcker, 7 years ago

Sure.

in reply to:  3 comment:7 by Christian Boos, 7 years ago

Resolution: fixed
Status: newclosed

Applied in r11796.

comment:8 by Christian Boos, 7 years ago

Owner: changed from Dirk Stöcker to Christian Boos

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.