Skip to content Skip to sidebar Skip to footer

Twisted Web - Keep Request Data After Responding To Client

I have a front-end web server written in Twisted Web, that interfaces with another web server. Clients upload files to my front-end server, which then sends the files along to the

Solution 1:

You need to actually copy the file into a buffer in memory or into a tempfile on disk before you finish the request object (which is what happens when you redirect).

So you are starting your thread and handing it the request object, it's maybe opening a connection to your backend server and beginning to copy when you redirect which finishes the request and closes any associated tempfiles and you're in trouble.

Instead of passing the whole request to your thread a quick test would be trying to just pass the content of the request to your thread:

thread.start_new_thread(self.upload, (request.content.read(),))

Post a Comment for "Twisted Web - Keep Request Data After Responding To Client"