Discussion:
[Twisted-Python] please can haz code review -> Tor-ified Twisted Python HTTP proxy server - txtorhttpproxy
David Stainton
2015-08-11 10:46:09 UTC
Permalink
Dear Twisted/Tor developers,

I am motivated by language security concerns. I think Twisted Python
can often implement excellent replacements for our old crufty C
implementations. In this case I'd like to stop using C programs
running as root (or not root) to torify http connections... like
privoxy, polipo, apt tor transport etc.

Last year I wrote this little tor http proxy; yes it also handles RFC
2817 proxy CONNECT method as well:
https://github.com/david415/txtorhttpproxy

I wrote an AgentProxy that can proxy any sort of twisted http agent:
https://github.com/david415/txtorhttpproxy/blob/master/txtorhttpproxy/proxy.py

It used to use more terrible underscore imports but Leif fixed the
bit-rot and made it work with Twisted 15:
https://github.com/david415/txtorhttpproxy/commit/38f1a0cfab586f7a8965a47e9c8f951b351426a2

Is this project worthy of your precious 10 minutes to review it... so
I can improve the code quality?

If I get rid of this last terrible import:
from twisted.web._newclient import ResponseDone

then I'm not sure how to detect when to call the finish() method here:
https://github.com/david415/txtorhttpproxy/blob/master/txtorhttpproxy/proxy.py#L38-L52


Sincerely,
David Stainton
Aaron Gallagher
2015-08-12 05:06:02 UTC
Permalink
Post by David Stainton
from twisted.web._newclient import ResponseDone
https://github.com/david415/txtorhttpproxy/blob/master/txtorhttpproxy/proxy.py#L38-L52
import twisted.web.client
twisted.web.client.ResponseDone is twisted.web._newclient.ResponseDone
True
Post by David Stainton
twisted.__version__
'11.0.0'

I couldn't get 9.0 to compile in the five seconds I tried, but 11.0 is
still pretty old. I think it always was re-exported like this.
David Stainton
2015-08-13 11:58:01 UTC
Permalink
Dear Aaon Gallagher,

Thanks for the helpful observation. i'm going to make the correction
soon and then we'll be underscore free.
Post by Aaron Gallagher
Post by David Stainton
from twisted.web._newclient import ResponseDone
https://github.com/david415/txtorhttpproxy/blob/master/txtorhttpproxy/proxy.py#L38-L52
import twisted.web.client
twisted.web.client.ResponseDone is twisted.web._newclient.ResponseDone
True
Post by David Stainton
twisted.__version__
'11.0.0'
I couldn't get 9.0 to compile in the five seconds I tried, but 11.0 is
still pretty old. I think it always was re-exported like this.
Loading...