Пример #1
0
 def _makeDataConnection(self):
     # Establish a passive data connection (i.e. client connecting to
     # server).
     responseLines = wait(self.client.queueStringCommand("PASV"))
     host, port = ftp.decodeHostPort(responseLines[-1][4:])
     downloader = wait(protocol.ClientCreator(reactor, _BufferingProtocol).connectTCP("127.0.0.1", port))
     return downloader
Пример #2
0
 def _makeDataConnection(self):
     responseLines = wait(self.client.queueStringCommand('PASV'))
     host, port = ftp.decodeHostPort(responseLines[-1][4:])
     downloader = wait(
         protocol.ClientCreator(reactor,
                                _BufferingProtocol).connectTCP('127.0.0.1',
                                                               port)
     )
     return downloader
Пример #3
0
 def _makeDataConnection(self):
     # Establish a passive data connection (i.e. client connecting to
     # server).
     responseLines = wait(self.client.queueStringCommand('PASV'))
     host, port = ftp.decodeHostPort(responseLines[-1][4:])
     downloader = wait(
         protocol.ClientCreator(reactor, _BufferingProtocol).connectTCP(
             '127.0.0.1', port))
     return downloader
Пример #4
0
 def testDecodeHostPort(self):
     self.assertEquals(ftp.decodeHostPort('25,234,129,22,100,23'),
                       ('25.234.129.22', 25623))
     nums = range(6)
     for i in range(6):
         badValue = list(nums)
         badValue[i] = 256
         s = ','.join(map(str, badValue))
         self.assertRaises(ValueError, ftp.decodeHostPort, s)
Пример #5
0
 def testDecodeHostPort(self):
     self.assertEquals(ftp.decodeHostPort('25,234,129,22,100,23'),
             ('25.234.129.22', 25623))
     nums = range(6)
     for i in range(6):
         badValue = list(nums)
         badValue[i] = 256
         s = ','.join(map(str, badValue))
         self.assertRaises(ValueError, ftp.decodeHostPort, s)
Пример #6
0
    def testPASV(self):
        # Login
        self._anonymousLogin()

        # Issue a PASV command, and extract the host and port from the response
        responseLines = wait(self.client.queueStringCommand('PASV'))
        host, port = ftp.decodeHostPort(responseLines[-1][4:])

        # Make sure the server is listening on the port it claims to be
        self.assertEqual(port, self.serverProtocol.dtpPort.getHost().port)

        # Semi-reasonable way to force cleanup
        self.serverProtocol.connectionLost(error.ConnectionDone())
Пример #7
0
    def testPASV(self):
        # Login
        self._anonymousLogin()

        # Issue a PASV command, and extract the host and port from the response
        responseLines = wait(self.client.queueStringCommand('PASV'))
        host, port = ftp.decodeHostPort(responseLines[-1][4:])

        # Make sure the server is listening on the port it claims to be
        self.assertEqual(port, self.serverProtocol.dtpPort.getHost().port)

        # Semi-reasonable way to force cleanup
        self.serverProtocol.connectionLost(error.ConnectionDone())
Пример #8
0
    def testPASV(self):
        # Login
        self._anonymousLogin()

        # Issue a PASV command, and extract the host and port from the response
        responseLines = wait(self.client.queueStringCommand('PASV'))
        host, port = ftp.decodeHostPort(responseLines[-1][4:])

        # Make sure the server is listening on the port it claims to be
        self.assertEqual(port, self.serverProtocol.dtpPort.getHost().port)

        # Hack: clean up the DTP port directly
        d = self.serverProtocol.dtpPort.stopListening()
        if d is not None:
            wait(d)
        self.serverProtocol.dtpFactory = None
Пример #9
0
 def testPASV(self):
     self._anonymousLogin()
     responseLines = wait(self.client.queueStringCommand('PASV'))
     host, port = ftp.decodeHostPort(responseLines[-1][4:])
     self.assertEqual(port, self.serverProtocol.dtpPort.getHost().port)
     self.serverProtocol.connectionLost(error.ConnectionDone())
Пример #10
0
 def testDecodeHostPort(self):
     self.assertEquals(ftp.decodeHostPort('25,234,129,22,100,23'),
             ('25.234.129.22', 25623))
Пример #11
0
 def testDecodeHostPort(self):
     self.assertEquals(ftp.decodeHostPort('25,234,129,22,100,23'),
                       ('25.234.129.22', 25623))
Пример #12
0
 def testDecodeHostPort(self):
     data = "999 The magic address is (123,234,56,78,11,22)"
     host, port = ftp.decodeHostPort(data)
     self.failUnlessEqual(host, '123.234.56.78')
     self.failUnlessEqual(port, (11*256) + 22)
Пример #13
0
 def gotPASV(responseLines):
     host, port = ftp.decodeHostPort(responseLines[-1][4:])
     cc = protocol.ClientCreator(reactor, _BufferingProtocol)
     return cc.connectTCP('127.0.0.1', port)
Пример #14
0
 def gotPASV(responseLines):
     host, port = ftp.decodeHostPort(responseLines[-1][4:])
     cc = protocol.ClientCreator(reactor, _BufferingProtocol)
     return cc.connectTCP('127.0.0.1', port)