/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: Andrew Bennetts
  • Date: 2009-01-12 06:17:23 UTC
  • mfrom: (3923.5.6 call_with_body_stream)
  • mto: This revision was merged to the branch mainline in revision 3981.
  • Revision ID: andrew.bennetts@canonical.com-20090112061723-y4s1s29mf2fq1ops
Merge updated call_with_body_bytes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1238
1238
        self._write_protocol_version()
1239
1239
        self._write_headers(self._headers)
1240
1240
        self._write_structure(args)
1241
 
        self._write_chunked_body_start()
1242
 
        # XXX: handle errors while iterating the body stream
1243
 
        # XXX: notice if the server has sent an early error reply before we
1244
 
        #      have finished sending the stream.  We would notice at the end
1245
 
        #      anyway, but if the medium can deliver it early then it's good to
1246
 
        #      short-circuit the whole request...
1247
 
        for part in stream:
1248
 
            self._write_prefixed_body(part)
1249
 
            self.flush()
1250
 
        self._write_success_status()
 
1241
        # TODO: notice if the server has sent an early error reply before we
 
1242
        #       have finished sending the stream.  We would notice at the end
 
1243
        #       anyway, but if the medium can deliver it early then it's good
 
1244
        #       to short-circuit the whole request...
 
1245
        try:
 
1246
            for part in stream:
 
1247
                self._write_prefixed_body(part)
 
1248
                self.flush()
 
1249
        except Exception:
 
1250
            # Iterating the stream failed.  Cleanly abort the request.
 
1251
            self._write_error_status()
 
1252
            # Currently the client unconditionally sends ('error',) as the
 
1253
            # error args.
 
1254
            self._write_structure(('error',))
1251
1255
        self._write_end()
1252
1256
        self._medium_request.finished_writing()
1253
1257