~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Ian Clatworthy
  • Date: 2009-09-09 15:30:59 UTC
  • mto: (4634.37.2 prepare-2.0)
  • mto: This revision was merged to the branch mainline in revision 4689.
  • Revision ID: ian.clatworthy@canonical.com-20090909153059-sb038agvd38ci2q8
more link fixes in the User Guide

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
20
20
    http://www.python.org/dev/peps/pep-0333/
21
21
"""
22
22
 
23
 
from __future__ import absolute_import
24
 
 
25
23
from cStringIO import StringIO
26
24
 
27
 
from bzrlib.smart import medium
 
25
from bzrlib.smart import protocol, medium
28
26
from bzrlib.transport import chroot, get_transport
29
27
from bzrlib.urlutils import local_path_to_url
30
28
 
103
101
            backing_transport.  This is used to interpret relpaths received from
104
102
            the client.
105
103
        """
106
 
        # Use a ChrootServer so that this web application won't
 
104
        # Use a ChrootTransportDecorator so that this web application won't
107
105
        # accidentally let people access locations they shouldn't.
108
106
        # e.g. consider a smart server request for "get /etc/passwd" or
109
107
        # something.
110
108
        self.chroot_server = chroot.ChrootServer(backing_transport)
111
 
        self.chroot_server.start_server()
 
109
        self.chroot_server.setUp()
112
110
        self.backing_transport = get_transport(self.chroot_server.get_url())
113
111
        self.root_client_path = root_client_path
114
112
        # While the chroot server can technically be torn down at this point,
116
114
        # protocol dictionary, we don't *just in case* there are parts of
117
115
        # bzrlib that will invoke 'get_transport' on urls rather than cloning
118
116
        # around the existing transport.
119
 
        #self.chroot_server.stop_server()
 
117
        #self.chroot_server.tearDown()
120
118
 
121
119
    def __call__(self, environ, start_response):
122
120
        """WSGI application callable."""
178
176
    def make_request(self, transport, write_func, request_bytes, rcp):
179
177
        protocol_factory, unused_bytes = medium._get_protocol_factory_for_bytes(
180
178
            request_bytes)
181
 
        server_protocol = protocol_factory(
182
 
            transport, write_func, rcp, self.backing_transport)
 
179
        server_protocol = protocol_factory(transport, write_func, rcp)
183
180
        server_protocol.accept_bytes(unused_bytes)
184
181
        return server_protocol