[Twisted-Python] Using ProxyClient

DF-- dj.foguelman at gmail.com
Tue Aug 7 16:41:50 EDT 2012

Hi Guys!

I'm new to the twisted framework and I'm using it to write a simple
HTTPProxy with rewrite capabilities.

While calling ProxyCiient.handleHeader method, it seems that Content-Length
field is being added. Notice that I say "add" instead of "set":

    def handleHeader(self, key, value):
        *if key.lower() in ['server', 'date', 'content-type']:*
            self.father.responseHeaders.setRawHeaders(key, [value])
            *self.father.responseHeaders.addRawHeader(key, value)*

Look at this headers that I get if I use handleHeader method:

HTTP/1.1 200 OK
*Content-Length: 3025
Content-Length: 53*
Host: localhost:8001
Accept: */*
Server: Coco el servidor
Connection: close
Date: Tue, 07 Aug 2012 20:35:13 GMT
User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k
zlib/ libidn/1.15
Content-Type: text/html

So question is, am I using it properly? I'm adjusting the content length
field as the data changed.

Thanks in advanced, Daniel

 "En economía no hay nada misterioso ni inaccesible al entendimiento del
hombre de la calle. Si hay un misterio, reside él en el oculto propósito
que puede perseguir el economista y que no es otro que la disimulación del
interés concreto a que se sirve."

A. Jauretche
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120807/89d6f5fc/attachment.htm 

More information about the Twisted-Python mailing list