Twisted Web代理帮助!

2 投票
1 回答
1457 浏览
提问于 2025-04-16 00:56

我写了一个用Twisted框架做的Python HTTP代理,但每次通过这个代理访问网页时,都会出现下面的错误信息。

Traceback (most recent call last):
  File "C:\ZBrownTechnology\Web Lock\Proxy.py", line 57, in <module>
    reactor.run()
  File "C:\Python26\lib\site-packages\twisted\internet\base.py", line 1165, in run
    self.mainLoop()
  File "C:\Python26\lib\site-packages\twisted\internet\base.py", line 1177, in mainLoop
    self.doIteration(t)
  File "C:\Python26\lib\site-packages\twisted\internet\selectreactor.py", line 140, in doSelect
   _logrun(selectable, _drdw, selectable, method, dict)
--- <exception caught here> ---
  File "C:\Python26\lib\site-packages\twisted\python\log.py", line 84, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
  File "C:\Python26\lib\site-packages\twisted\python\log.py", line 69, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "C:\Python26\lib\site-packages\twisted\python\context.py", line 59, in ca
llWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "C:\Python26\lib\site-packages\twisted\python\context.py", line 37, in callWithContext
    return func(*args,**kw)
  File "C:\Python26\lib\site-packages\twisted\internet\selectreactor.py", line 156, in _doReadOrWrite
    self._disconnectSelectable(selectable, why, method=="doRead")
  File "C:\Python26\lib\site-packages\twisted\internet\posixbase.py", line 250,
in _disconnectSelectable
    selectable.readConnectionLost(f)
  File "C:\Python26\lib\site-packages\twisted\internet\tcp.py", line 508, in readConnectionLost
    self.connectionLost(reason)
  File "C:\Python26\lib\site-packages\twisted\internet\tcp.py", line 677, in connectionLost
    Connection.connectionLost(self, reason)
  File "C:\Python26\lib\site-packages\twisted\internet\tcp.py", line 519, in connectionLost
    protocol.connectionLost(reason)
  File "C:\Python26\lib\site-packages\twisted\web\http.py", line 489, in connectionLost
    self.handleResponseEnd()
  File "C:\Python26\lib\site-packages\twisted\web\proxy.py", line 88, in handleResponseEnd
    self.father.finish()
  File "C:\Python26\lib\site-packages\twisted\web\http.py", line 900, in finish
    "Request.finish called on a request after its connection was lost; "
exceptions.RuntimeError: Request.finish called on a request after its connection
 was lost; use Request.notifyFinish to keep track of this.

这是什么意思呢?我该怎么解决?是模块的问题,还是我代码里的问题?我是在Windows XP上用Python 2.6。

1 个回答

3

这是一个在 twisted.web.proxy 中的已知问题。这个问题一般来说不会造成太大影响。如果这个问题给你带来了麻烦,欢迎你考虑贡献一个修复补丁来解决它!

撰写回答