~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/smart.py

Merge bzr.urllib.keepalive

Show diffs side-by-side

added added

removed removed

Lines of Context:
518
518
 
519
519
    def accept_and_serve(self):
520
520
        conn, client_addr = self._server_socket.accept()
 
521
        # For WIN32, where the timeout value from the listening socket
 
522
        # propogates to the newly accepted socket.
 
523
        conn.setblocking(True)
521
524
        conn.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
522
525
        from_client = conn.makefile('r')
523
526
        to_client = conn.makefile('w')
549
552
    """
550
553
 
551
554
    def __init__(self):
552
 
        self._homedir = os.getcwd()
 
555
        self._homedir = urlutils.local_path_to_url(os.getcwd())[7:]
553
556
        # The server is set up by default like for ssh access: the client
554
557
        # passes filesystem-absolute paths; therefore the server must look
555
558
        # them up relative to the root directory.  it might be better to act
556
559
        # a public server and have the server rewrite paths into the test
557
560
        # directory.
558
 
        SmartTCPServer.__init__(self, transport.get_transport("file:///"))
 
561
        SmartTCPServer.__init__(self,
 
562
            transport.get_transport(urlutils.local_path_to_url('/')))
559
563
        
560
564
    def setUp(self):
561
565
        """Set up server for testing"""
567
571
    def get_url(self):
568
572
        """Return the url of the server"""
569
573
        host, port = self._server_socket.getsockname()
570
 
        # XXX: I think this is likely to break on windows -- self._homedir will
571
 
        # have backslashes (and maybe a drive letter?).
572
 
        #  -- Andrew Bennetts, 2006-08-29
573
574
        return "bzr://%s:%d%s" % (host, port, urlutils.escape(self._homedir))
574
575
 
575
576
    def get_bogus_url(self):