MCPcopy Index your code
hub / github.com/python/cpython / parse227

Function parse227

Lib/ftplib.py:812–828  ·  view source on GitHub ↗

Parse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.

(resp)

Source from the content-addressed store, hash-verified

810_227_re = None
811
812def parse227(resp):
813 '''Parse the '227' response for a PASV request.
814 Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
815 Return ('host.addr.as.numbers', port#) tuple.'''
816 if resp[:3] != '227':
817 raise error_reply(resp)
818 global _227_re
819 if _227_re is None:
820 import re
821 _227_re = re.compile(r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)', re.ASCII)
822 m = _227_re.search(resp)
823 if not m:
824 raise error_proto(resp)
825 numbers = m.groups()
826 host = '.'.join(numbers[:4])
827 port = (int(numbers[4]) << 8) + int(numbers[5])
828 return host, port
829
830
831def parse229(resp, peer):

Callers 2

makepasvMethod · 0.85
ftpcpFunction · 0.85

Calls 6

error_replyClass · 0.85
error_protoClass · 0.70
compileMethod · 0.45
searchMethod · 0.45
groupsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…