Patch by Jui-Nan Lin to enable utf8 support.

This commit is contained in:
braga
2006-06-06 16:57:31 +00:00
parent 6da21560a3
commit 954007ec31
3 changed files with 20 additions and 0 deletions

View File

@@ -253,6 +253,10 @@ structure. Otherwise those links will very probably be broken.
.B user=<user:password> .B user=<user:password>
Specify user and password to use for server authentication. Overrides Specify user and password to use for server authentication. Overrides
netrc configuration. netrc configuration.
.TP
.B utf8
Try to transfer file list with UTF-8 encoding. Send OPTS UTF8 ON at the
beginning of file list transfer.
.SH FUSE OPTIONS .SH FUSE OPTIONS
.TP .TP
.B "-d" .B "-d"

15
ftpfs.c
View File

@@ -260,6 +260,7 @@ static struct fuse_opt ftpfs_opts[] = {
FTPFS_OPT("sslv3", ssl_version, CURL_SSLVERSION_SSLv3), FTPFS_OPT("sslv3", ssl_version, CURL_SSLVERSION_SSLv3),
FTPFS_OPT("ipv4", ip_version, CURL_IPRESOLVE_V4), FTPFS_OPT("ipv4", ip_version, CURL_IPRESOLVE_V4),
FTPFS_OPT("ipv6", ip_version, CURL_IPRESOLVE_V6), FTPFS_OPT("ipv6", ip_version, CURL_IPRESOLVE_V6),
FTPFS_OPT("utf8", tryutf8, 1),
FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP),
@@ -1008,6 +1009,7 @@ static void usage(const char* progname) {
" sslv3 use SSLv3 (SSL)\n" " sslv3 use SSLv3 (SSL)\n"
" ipv4 resolve name to IPv4 address\n" " ipv4 resolve name to IPv4 address\n"
" ipv6 resolve name to IPv6 address\n" " ipv6 resolve name to IPv6 address\n"
" utf8 try to transfer file list with utf-8 encoding\n"
"\n", progname); "\n", progname);
} }
@@ -1020,6 +1022,19 @@ static void set_common_curl_stuff(CURL* easy) {
curl_easy_setopt_or_die(easy, CURLOPT_NOSIGNAL, 1); curl_easy_setopt_or_die(easy, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt_or_die(easy, CURLOPT_CUSTOMREQUEST, "LIST -a"); curl_easy_setopt_or_die(easy, CURLOPT_CUSTOMREQUEST, "LIST -a");
if (ftpfs.tryutf8) {
// We'll let the slist leak, as it will still be accessible within
// libcurl. If we ever want to add more commands to CURLOPT_QUOTE, we'll
// have to think of a better strategy.
struct curl_slist *slist = NULL;
// Adding the QUOTE here will make this command be sent with every request.
// This is necessary to ensure that the server is still in UTF8 mode after
// we get disconnected and automatically reconnect.
slist = curl_slist_append(slist, "OPTS UTF8 ON");
curl_easy_setopt_or_die(easy, CURLOPT_QUOTE, slist);
}
if (ftpfs.verbose) { if (ftpfs.verbose) {
curl_easy_setopt_or_die(easy, CURLOPT_VERBOSE, TRUE); curl_easy_setopt_or_die(easy, CURLOPT_VERBOSE, TRUE);
} }

View File

@@ -61,6 +61,7 @@ struct ftpfs {
size_t symlink_prefix_len; size_t symlink_prefix_len;
curl_version_info_data* curl_version; curl_version_info_data* curl_version;
int safe_nobody; int safe_nobody;
int tryutf8;
}; };
extern struct ftpfs ftpfs; extern struct ftpfs ftpfs;