This function returns the number of characters copied into the
string buffer, not including the terminating null character. If the
lpszNormalized parameter is NULL, it will return the length
of the normalized URL but will not copy any characters. If the
function fails, it will return FTP_ERROR. To get extended error
information, call FtpGetLastError.
This function will accept a standard FTP, FTPS or SFTP URL and
return a canonical version of that URL. Normalization will remove
extraneous path delimiters and collapse the path if there are references
to parent directories. If non-standard port numbers are included in
the URL, they will be preserved. For example, if the following URL
is provided to the function:
ftps://ftp.example.com:21/file/..//data/filename.txt
It will return the following as the normalized URL:
ftpes://ftp.example.com/data/filename.txt
Because the original URL specified a secure connection on port 21,
this is inferred to mean the connection will use explicit TLS and not
an implicit connection. This is why the scheme is changed from
ftps:// to ftpes:// and the port number is
removed, since port 21 is the default port for an explicit TLS
connection. In addition, the path is collapsed and the extraneous path
delimiters are removed.
This function is primarily intended to normalize URLs which may be
entered by a user or read from a configuration file. It is not
necessary to call this function prior to calling FtpConnectUrl
because it will always be normalized internally prior to the
connection being established. If you wish to check a URL to ensure it
is valid and the server name can be resolved to an IP address, use the
FtpValidateUrl function.
If you need to normalize a remote file path, use the
FtpNormalizePath function.