<div dir="ltr">i want to interrupt the file sending. but i can&#39;t change the client. so i need change the server.<div style>All things go well, but the message i wanna response seem not work.</div><div style>is the self.transport.loseConnection() (the last line) blocking the messages?</div>
<div style>in fact, i work on Cumulus(nimbus project) which based on twisted. And i use s3cmd as the client.</div><div style><br></div><div style>here is the my code:</div><div style><br></div><div style>        def headerReceived(self,line):</div>
<div>        pycb.log(logging.INFO, &quot;===== def headerReceived of cumulus.py&quot;)</div><div>        http.HTTPChannel.headerReceived(self,line)</div><div>        pycb.log(logging.INFO, &quot;===== self.length is %s&quot;%self.length)</div>
<div>        </div><div>        header, data = line.split(&#39;:&#39;, 1)</div><div>        header = header.lower()</div><div>        data = data.strip()</div><div>        if header==&#39;authorization&#39;:</div><div>            self.authorization=data</div>
<div>            </div><div>        </div><div>        if self.length and self.authorization:</div><div>            user_id = self.authorization.split(&#39;:&#39;)[0].split()[1].strip()</div><div>            user = pycb.config.auth.get_user(user_id)</div>
<div>    </div><div>            pycb.log(logging.INFO, &quot;===== user who put this object is %s&quot;%user)</div><div>            </div><div>            remaining_quota = user.get_remaining_quota()</div><div>            pycb.log(logging.INFO, &quot;===== remaining_quota is %s&quot;%remaining_quota)</div>
<div>            quota_check=self.length-remaining_quota</div><div>            pycb.log(logging.INFO, &quot;===== quota_check=self.length-remaining_quota of cumulus.py&quot;)</div><div>            </div><div>            if quota_check&gt;0:</div>
<div>                requestId = str(uuid.uuid1()).replace(&quot;-&quot;, &quot;&quot;)</div><div>                ex=cbException(&#39;AccountProblem&#39;)</div><div>                </div><div>                m_msg = &quot;HTTP/1.1 %s %s\r\n&quot; % (ex.httpCode, ex.httpDesc)</div>
<div>                self.transport.write(m_msg)</div><div>                </div><div>                m_msg = &quot;%s: %s\r\n&quot; % ((&#39;x-amz-request-id&#39;, requestId))</div><div>                self.transport.write(m_msg)</div>
<div>                #req.setHeader(&#39;x-amz-request-id&#39;, requestId)</div><div>                </div><div>                m_msg = &quot;%s: %s\r\n&quot; % ((&#39;x-amz-id-2&#39;, str(uuid.uuid1())))</div><div>                self.transport.write(m_msg)</div>
<div>                </div><div>                e_msg = ex.make_xml_string(self._path, str(uuid.uuid1()))</div><div>                pycb.log(logging.INFO, &quot;===== e_msg is %s&quot;%e_msg)</div><div>                #self.transport.write(&quot;\r\n&quot;)</div>
<div>                self.transport.write(e_msg)</div><div>                pycb.log(logging.INFO, &quot;===== self.transport.write(e_msg)&quot;)</div><div>                </div><div>                </div><div>                self.transport.loseConnection()</div>
</div>