[Twisted-web] Close TCP Connection Using web resource.Resource

Drew Smathers drew.smathers at gmail.com
Fri May 8 19:44:34 EDT 2009


On Thu, May 7, 2009 at 3:22 PM, Michael Toop <michaelt at voxtelecom.co.za> wrote:
> Hi Drew,
>
>  Thanks for the feedback.
>
>  There are no headers in our server that annotate this.  Great idea though, I didn't realise that this was an option.  What I will try is insert the "Connection: close" header in & see if the client responds with this (hopefully Twisted will then in turn close the connection).
>
>  FYI here are the headers in current server:
>
> Client:
> HTTP/1.1
> Content-Type: text/xml; charset=ISO-8859-1
> Host: vvvaacs.co.za
> User-Agent: Thomson_cwmp-engine/r6.2.W.1
> SOAPAction:
> Transfer-Encoding: chunked
>
> Server:
> HTTP/1.1 200 OK
> Transfer-Encoding: chunked
> Date: Thu, 07 May 2009 12:42:00 GMT
> Content-Type: text/xml; charset=iso-8859-1
> Server: TwistedWeb/8.2.0
>
> Thanks,
>
> Michael
>

Hi Michael,

It might be easier to just force the channel to be non-persistent
before calling finish()  vs. trying to inject request headers:

  request.channel.persistent = 0
  request.finish()

-Drew



More information about the Twisted-web mailing list