[wp-trac] [WordPress Trac] #51170: FTP automatic updates are not RFC 959 compliant for NLST command
WordPress Trac
noreply at wordpress.org
Sat Mar 26 18:39:17 UTC 2022
#51170: FTP automatic updates are not RFC 959 compliant for NLST command
------------------------------+-----------------------
Reporter: giox069 | Owner: afragen
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.0
Component: Filesystem API | Version: 3.7
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses:
------------------------------+-----------------------
Comment (by pbiron):
I just found a [https://stackoverflow.com/a/16224707 StackOverflow reply]
where someone who claims to be the author of particular FTP server
software mentions that his FTP server specifically returns an error if the
`SIZE` command is issued when `TYPE` is not `BINARY` :-(
He quotes from the section about the `SIZE` command in the
[https://datatracker.ietf.org/doc/html/rfc3659#section-4.2 RFC]:
4.2. Error Responses
Where the command is correctly parsed but the size is not available,
perhaps because the pathname identifies no existing entity or because
the entity named cannot be transferred in the current MODE and TYPE
(or at all), then a 550 reply should be sent.
....
The presence of the 550 error response to a SIZE
command MUST NOT be taken by the client as an indication that the
file cannot be transferred in the current MODE and TYPE. A server
may generate this error for other reasons -- for instance if the
processing overhead is considered too great.
note: the server responding with anything other than a `213` response code
will result in `ftp_size()` returning `-1`...see the
[https://github.com/php/php-
src/blob/efbb2198d4e5a01167d1a8c2937b848f75ac4d19/ext/ftp/ftp.c#L1120 PHP
source for ftp_size()].
So, maybe using `ftp_size()` to check for file existence is **not** a
viable approach? Of course, I'm not saying that we shouldn't use
it...just try to make sure we don't introduce other problems with this
"fix".
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51170#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list