Re: Python-list Digest, Vol 112, Issue 114
I finally write some back (self.transport.write()), and shutdown the
> ---------- ÒÑ×ª·¢ÓÊ¼þ ----------
> From: Ulrich Eckhardt <firstname.lastname@example.org>
> To: email@example.com
> Date: Tue, 15 Jan 2013 13:46:52 +0100
> Subject: Re: interrupt the file sending if the file size over the
> quota...some errors here...
> Am 15.01.2013 10:46, schrieb Levi Nie:
>> i want to interrupt the file sending. but i can't change the client. so i
>> need change the server.
>> All things go well, but the message i wanna response seem not work.
> Ahem, what? It doesn't work, so does it sit on the couch all day?
> is the self.transport.loseConnection(**) (the last line) blocking the
>> in fact, i work on Cumulus(nimbus project) which based on twisted. And i
>> use s3cmd as the client.
> I'm wondering if questions concerning twisted don't have a better forum.
> In any case, I can only comment on the general approach. For that, there
> are two things you can do:
> 1. When receiving the the request header, you have a content length. If
> that exceeds the allowed amount, shutdown() receiving and send an according
> HTTP response before closing the connection.
> 2. If the data exceeds the amount advertised by the content length, close
> the connection and discard the request. If you want to be nice, send an
> according response before closing, but I personally wouldn't go to that
> effort for broken HTTP clients.
> Concerning the question why your client hangs, it could also be the
> sending. If you try to send something before receiving the full request,
> client and server could enter a deadlock where each side waits for the
> other to receive some data. For that reason, you should shutdown()
> receiving in such a case.
|All times are GMT. The time now is 10:22 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.