/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/transport/http/wsgi.py

Improvement thanks to John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
        request_data_length = int(environ['CONTENT_LENGTH'])
103
103
        request_data_bytes = environ['wsgi.input'].read(request_data_length)
104
104
        smart_protocol_request.accept_bytes(request_data_bytes)
105
 
        assert smart_protocol_request.next_read_size() == 0, (
106
 
            "not finished reading, but all data sent to protocol.")
107
 
        response_data = out_buffer.getvalue()
 
105
        if smart_protocol_request.next_read_size() != 0:
 
106
            # The request appears to be incomplete, or perhaps it's just a
 
107
            # newer version we don't understand.  Regardless, all we can do
 
108
            # is return an error response in the format of our version of the
 
109
            # protocol.
 
110
            response_data = 'error\x01incomplete request\n'
 
111
        else:
 
112
            response_data = out_buffer.getvalue()
108
113
        headers = [('Content-type', 'application/octet-stream')]
109
114
        headers.append(("Content-Length", str(len(response_data))))
110
115
        start_response('200 OK', headers)