file upload with twisted
When i send a http request with a big file, can i check the content-length then enable or disable the file upload? I use the s3cmd client sent the request. And i need disable the file upload if the file size is over the quota. how can i do this?
On Jan 4, 2013, at 5:50 PM, Levi Nie
When i send a http request with a big file, can i check the content-length then enable or disable the file upload?
I use the s3cmd client sent the request. And i need disable the file upload if the file size is over the quota.
how can i do this?
This s3cmd? https://github.com/s3tools/s3cmd/blob/master/s3cmd It doesn't look like it uses Twisted, so I don't think this is a question for this list.
I resolve same problem in self project, reimplement method
handleContentChunk in server.Request
My code:
<code># For maximum
handleContentChunkLength = 0
def handleContentChunk(self, data):
"""
Write a chunk of data.
"""
self.handleContentChunkLength += len(data)
if self.handleContentChunkLength >= WEB_LIMIT_REQUEST_SIZE:
self.transport.write(b"HTTP/1.1 413 Request Entity Too Large\r\n\r\n")
self.transport.loseConnection()
# Raise to log error
raise ValueError('Maximum length equal')
self.content.write(data)</code>
On Sat, Jan 5, 2013 at 10:14 AM, Glyph
On Jan 4, 2013, at 5:50 PM, Levi Nie
wrote: When i send a http request with a big file, can i check the content-length then enable or disable the file upload?
I use the s3cmd client sent the request. And i need disable the file upload if the file size is over the quota.
how can i do this?
This s3cmd? https://github.com/s3tools/s3cmd/blob/master/s3cmd
It doesn't look like it uses Twisted, so I don't think this is a question for this list.
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
участники (3)
-
Glyph
-
Levi Nie
-
Аркадий Левин