MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / parse227

Function parse227

tools/python-3.11.9-amd64/Lib/ftplib.py:834–850  ·  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

832_227_re = None
833
834def parse227(resp):
835 '''Parse the '227' response for a PASV request.
836 Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
837 Return ('host.addr.as.numbers', port#) tuple.'''
838 if resp[:3] != '227':
839 raise error_reply(resp)
840 global _227_re
841 if _227_re is None:
842 import re
843 _227_re = re.compile(r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)', re.ASCII)
844 m = _227_re.search(resp)
845 if not m:
846 raise error_proto(resp)
847 numbers = m.groups()
848 host = '.'.join(numbers[:4])
849 port = (int(numbers[4]) << 8) + int(numbers[5])
850 return host, port
851
852
853def 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