~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/wsgi.py

  • Committer: Jonathan Lange
  • Date: 2007-04-23 01:30:35 UTC
  • mto: This revision was merged to the branch mainline in revision 2446.
  • Revision ID: jml@canonical.com-20070423013035-zuqiamuro8h1hba9
Can also set the bug config options in branch.conf

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
        relpath = environ['bzrlib.relpath']
115
115
        transport = self.backing_transport.clone(relpath)
116
116
        out_buffer = StringIO()
 
117
        smart_protocol_request = self.make_request(transport, out_buffer.write)
117
118
        request_data_length = int(environ['CONTENT_LENGTH'])
118
119
        request_data_bytes = environ['wsgi.input'].read(request_data_length)
119
 
        smart_protocol_request = self.make_request(
120
 
            transport, out_buffer.write, request_data_bytes)
 
120
        smart_protocol_request.accept_bytes(request_data_bytes)
121
121
        if smart_protocol_request.next_read_size() != 0:
122
122
            # The request appears to be incomplete, or perhaps it's just a
123
123
            # newer version we don't understand.  Regardless, all we can do
131
131
        start_response('200 OK', headers)
132
132
        return [response_data]
133
133
 
134
 
    def make_request(self, transport, write_func, request_bytes):
135
 
        # XXX: This duplicates the logic in
136
 
        # SmartServerStreamMedium._build_protocol.
137
 
        if request_bytes.startswith(protocol.REQUEST_VERSION_TWO):
138
 
            protocol_class = protocol.SmartServerRequestProtocolTwo
139
 
            request_bytes = request_bytes[len(protocol.REQUEST_VERSION_TWO):]
140
 
        else:
141
 
            protocol_class = protocol.SmartServerRequestProtocolOne
142
 
        server_protocol = protocol_class(transport, write_func)
143
 
        server_protocol.accept_bytes(request_bytes)
144
 
        return server_protocol
 
134
    def make_request(self, transport, write_func):
 
135
        return protocol.SmartServerRequestProtocolOne(transport, write_func)