Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36890

Re: Python-list Digest, Vol 112, Issue 114

References <mailman.2552.1358265303.2938.python-list@python.org>
Date 2013-01-16 17:57 +0800
Subject Re: Python-list Digest, Vol 112, Issue 114
From Levi Nie <levinie001@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.566.1358330272.2939.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

TKS, Ulrich.
    I finally write some back (self.transport.write()), and shutdown the
connections.

>
> ---------- 已转发邮件 ----------
> From: Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com>
> To: python-list@python.org
> Cc:
> 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
>> messages?
>> 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.
>
> HTH
>
> Uli
>
>
>
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python-list Digest, Vol 112, Issue 114 Levi Nie <levinie001@gmail.com> - 2013-01-16 17:57 +0800

csiph-web