예제 #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
파일: test_ftp.py 프로젝트: fxia22/ASM_xf
 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)