|
SmartFTP FTP Library
|
import "sfFTPLib.idl";
Public Member Functions | |
| HRESULT | IsExtension ([in] BSTR extension, [out, retval] VARIANT_BOOL *retval) |
| Checks if the connected server supports a specific SFTP protocol extension. | |
Properties | |
| BSTR | EOL [get] |
| Retrieves the line ending sequence explicitly reported by the server's operating system. | |
| ISFTPVendorId | VendorId [get] |
| Retrieves the software identification data reported by the remote SFTP server. | |
| long | MaxReadSize [get, set] |
| Retrieves the maximum amount of data (in bytes) the SFTP server will return in a single read operation. | |
| HRESULT ISFTPServerState::IsExtension | ( | [in] BSTR | extension, |
| [out, retval] VARIANT_BOOL * | retval ) |
Checks if the connected server supports a specific SFTP protocol extension.
The Mechanism: During the initial version negotiation (Handshake), the server sends a list of supported extensions (Name-Data pairs). These extensions define capabilities beyond the standard SFTP protocol version.
Usage (Feature Detection): Before attempting to use advanced features, use this method to verify support. For example:
Format: Extension names are typically formatted as name (standard IETF extensions) or name@domain (vendor-specific extensions). The comparison is case-sensitive.
| [in] | extension | The exact name of the extension to query (e.g., "posix-rename@openssh.com"). |
| [out] | retval | Returns VARIANT_TRUE if the server advertised this extension; otherwise VARIANT_FALSE. |
|
getproperty |
Retrieves the line ending sequence explicitly reported by the server's operating system.
The Negotiation: In SFTP protocol versions 4, 5, and 6, the server can include a newline extension in its version packet. This informs the client exactly which character sequence defines the end of a line (e.g., \n for Unix/Linux, \r\n for Windows).
Usage: This value is used to automatically configure text-mode transfers. If the connection's ISFTPConnection::ServerLineTerminator property is empty (the default), the component uses this value to perform the correct translation.
Protocol Limitations (OpenSSH): SFTP Version 3 (used by standard OpenSSH) does not support this extension. In those cases, this property may return an empty string or a default value (usually \n) inferred from the server's OS string.
| [out] | retval | Receives the server's newline string (e.g., "\n" or "\r\n"). |
|
getsetproperty |
Retrieves the maximum amount of data (in bytes) the SFTP server will return in a single read operation.
Sets the maximum amount of data (in bytes) the SFTP server will return in a single read operation.
The Mechanism: This property governs the maximum payload size the server will construct within an SSH_FXP_DATA response packet.
Usage: Read this property to determine the current upper limit enforced by the server on client read requests.
Protocol Note: To ensure packets do not exceed the SSH protocol's mandatory minimum packet size support (35,000 bytes) after adding SFTP headers and cryptographic overhead, a standard safe value is often 32768 (32 KB).
| [out] | retval | Receives a long integer indicating the current maximum read size (in bytes) configured on the server. |
The Mechanism: If an SFTP client requests a chunk of data larger than this configured value, the server will automatically truncate the read operation to return exactly MaxReadSize bytes.
Usage: Set this property to enforce strict memory and packet size limits on incoming client requests. Increasing this value can improve throughput on high-latency, high-bandwidth networks by reducing round-trips, but it increases the memory allocation required per concurrent client connection.
Interoperability Note: Setting this value too close to the OpenSSH hard limit (256 KB) can cause sudden connection drops if intermediate firewalls, proxies, or load balancers strictly enforce the RFC 35,000-byte cap. For maximum compatibility across unpredictable network routes, cap this limit at 32768 (32 KB).
| [in] | newValue | A long integer specifying the new maximum read size (in bytes) to enforce for client read requests. |
|
getproperty |
Retrieves the software identification data reported by the remote SFTP server.
The Source: This object is populated automatically during the SFTP Protocol Version Exchange. It reflects the data found in the vendor-id extension structure within the SSH_FXP_VERSION packet sent by the server.
Usage: Read this property to fingerprint the server implementation (e.g., "Bitvise"). This is critical for applying compatibility workarounds. For example, if VendorName is "LegacyServer" and ProductVersion is "1.0", you might choose to disable newer features like CopyFile or CheckFile that are known to be broken on that version.
OpenSSH Note: Standard OpenSSH servers (and many strictly RFC-compliant v3 servers) do not send this extension. In those cases, this object will contain empty strings and 0 values.
| [out] | retval | Receives the ISFTPVendorId object containing the server's reported identity. |