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

Function parse257

tools/python-3.11.9-amd64/Lib/ftplib.py:874–893  ·  view source on GitHub ↗

Parse the '257' response for a MKD or PWD request. This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.

(resp)

Source from the content-addressed store, hash-verified

872
873
874def parse257(resp):
875 '''Parse the '257' response for a MKD or PWD request.
876 This is a response to a MKD or PWD request: a directory name.
877 Returns the directoryname in the 257 reply.'''
878 if resp[:3] != '257':
879 raise error_reply(resp)
880 if resp[3:5] != ' "':
881 return '' # Not compliant to RFC 959, but UNIX ftpd does this
882 dirname = ''
883 i = 5
884 n = len(resp)
885 while i < n:
886 c = resp[i]
887 i = i+1
888 if c == '"':
889 if i >= n or resp[i] != '"':
890 break
891 i = i+1
892 dirname = dirname + c
893 return dirname
894
895
896def print_line(line):

Callers 2

mkdMethod · 0.85
pwdMethod · 0.85

Calls 1

error_replyClass · 0.85

Tested by

no test coverage detected