On Tue, Feb 12, 2013 at 2:30 PM, Paul Wiseman <poalman@gmail.com> wrote:


I'm trying to reproduce it with a small twisted client and server,
using a PUT request to send to the server but I can't seem to close
the connection uncleanly. How would you recommend I do that? I've
tried adding request.finish() on a callLater but that seems to finish
the connection in a clean way. How can I close the connection in the
way you suggest?

Maybe don't even go with real HTTP server, but something like:

class HTTP(Protocol):
    def connectionMade(self):
        time.sleep(1)
        self.transport.write("HTTP/1.0 200 OK\r\nContent-Length: 300000: \r\n\r\n")
        self.transport.loseConnection()

Or some variation on that, where you can control exactly where things break.

--
Itamar Turner-Trauring, Future Foundries LLC
http://futurefoundries.com/ — Twisted consulting, training and support.