You're viewing a comment by Peteris Krumins and its responses.

April 29, 2010, 17:11

Can you show me how to do it in 3 loc of Twisted?

Comment Responses

May 06, 2010, 19:41

from twisted.web import proxy, http
from twisted.internet import reactor

class ProxyFactory(http.HTTPFactory):
protocol = proxy.Proxy

reactor.listenTCP(8080, ProxyFactory())
reactor.run()

jherber Permalink
October 20, 2010, 02:18

Bah, this is pre-packaged class, not the actual proxy implemented in Twisted.

tom Permalink
December 28, 2011, 03:39

Um, what did you think the node.js one was? Did you not see the require('http') and require('sys') at the top?

Alexei Colin Permalink
July 13, 2013, 23:42

This twisted proxy supports HTTP 1.0 only.
They added a HTTP11ClientProtocol [1] in Twisted, but building a proxy on top of that would require a bunch more lines.

[1] http://twistedmatrix.com/documents/current/api/twisted.web._newclient.HTTP11ClientProtocol.html

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.