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

Discussion in 'Python' started by Levi Nie, Jan 16, 2013.

  1. Levi Nie

    Levi Nie Guest

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

    >
    > ---------- ÒÑת·¢Óʼþ ----------
    > From: Ulrich Eckhardt <>
    > To:
    > 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
    >
    >
    >
    >
    Levi Nie, Jan 16, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew James

    Re: Python-list Digest, Vol 17, Issue 54

    Andrew James, Feb 3, 2005, in forum: Python
    Replies:
    2
    Views:
    303
    Steve Holden
    Feb 3, 2005
  2. Charles Hartman

    Re: Python-list Digest, Vol 18, Issue 208

    Charles Hartman, Mar 14, 2005, in forum: Python
    Replies:
    10
    Views:
    505
    Roy Smith
    Mar 16, 2005
  3. Charles Hartman

    Re: Python-list Digest, Vol 18, Issue 391

    Charles Hartman, Mar 24, 2005, in forum: Python
    Replies:
    1
    Views:
    314
    Peter Hansen
    Mar 25, 2005
  4. Replies:
    2
    Views:
    280
  5. Niklas Berliner

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

    Niklas Berliner, Jan 10, 2013, in forum: Python
    Replies:
    0
    Views:
    131
    Niklas Berliner
    Jan 10, 2013
Loading...

Share This Page