From 337da5936888541549fa3f5d20df104a6952275e Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sat, 13 May 2017 15:47:39 +0000 Subject: [PATCH] Not fallback to HTTP - #596 --- doc/man/s3fs.1 | 3 --- src/s3fs.cpp | 29 +++-------------------------- src/s3fs_util.cpp | 8 ++------ 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/doc/man/s3fs.1 b/doc/man/s3fs.1 index 1d05aa5..68f62f9 100644 --- a/doc/man/s3fs.1 +++ b/doc/man/s3fs.1 @@ -190,9 +190,6 @@ If the disk free space is smaller than this value, s3fs do not use diskspace as .TP \fB\-o\fR url (default="https://s3.amazonaws.com") sets the url to use to access Amazon S3. If you want to use HTTP, then you can set "url=http://s3.amazonaws.com". -If you start s3fs without specifying the url option, s3fs will check the bucket using https://s3.amazonaws.com. -And when bucket check fails, s3fs retries the bucket check using http://s3.amazonaws.com. -This is the function left behind for backward compatibility. If you do not use https, please specify the URL with the url option. .TP \fB\-o\fR endpoint (default="us-east-1") diff --git a/src/s3fs.cpp b/src/s3fs.cpp index eeb360f..eee909c 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -89,7 +89,6 @@ bool foreground = false; bool nomultipart = false; bool pathrequeststyle = false; bool complement_stat = false; -bool is_changed_default_host = false; // for checking default http protocol std::string program_name; std::string service_path = "/"; std::string host = "https://s3.amazonaws.com"; @@ -176,7 +175,7 @@ static bool parse_xattr_keyval(const std::string& xattrpair, string& key, PXATTR static size_t parse_xattrs(const std::string& strxattrs, xattrs_t& xattrs); static std::string build_xattrs(const xattrs_t& xattrs); static int s3fs_utility_mode(void); -static int s3fs_check_service(bool need_try_http = true); +static int s3fs_check_service(void); static int check_for_aws_format(void); static int check_passwd_file_perms(void); static int read_passwd_file(void); @@ -3750,7 +3749,7 @@ static bool check_region_error(const char* pbody, string& expectregion) return true; } -static int s3fs_check_service(bool need_try_http) +static int s3fs_check_service(void) { S3FS_PRN_INFO("check services."); @@ -3762,7 +3761,6 @@ static int s3fs_check_service(bool need_try_http) S3fsCurl s3fscurl; int res; - string bup_endpoint = endpoint; if(0 > (res = s3fscurl.CheckBucket())){ // get response code long responseCode = s3fscurl.GetLastResponseCode(); @@ -3821,26 +3819,7 @@ static int s3fs_check_service(bool need_try_http) // another error S3FS_PRN_CRIT("unable to connect(host=%s) - result of checking service.", host.c_str()); } - - // [NOTE] - // If using default host(https://s3.amazonaws.com), try to change https to http protocol - // (old version default protocol) and try to connect. - // - if(need_try_http && !is_changed_default_host){ - // host is set second default value(http) - S3FS_PRN_CRIT("Retry checking the bucket with HTTP(http://s3.amazonaws.com), not HTTPS(https://s3.amazonaws.com)."); - host = "http://s3.amazonaws.com"; - endpoint = bup_endpoint; - - // check http protocol - int result = s3fs_check_service(false); - if(EXIT_SUCCESS == result){ - S3FS_PRN_CRIT("Switch to HTTP protocol instead of HTTPS. You should use the host or url option and specify the HTTP protocol endpoint."); - } - return result; - }else{ - return EXIT_FAILURE; - } + return EXIT_FAILURE; } } @@ -4589,7 +4568,6 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar } if(0 == STR2NCMP(arg, "host=")){ host = strchr(arg, '=') + sizeof(char); - is_changed_default_host = true; return 0; } if(0 == STR2NCMP(arg, "servicepath=")){ @@ -4710,7 +4688,6 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar } if(0 == STR2NCMP(arg, "url=")){ host = strchr(arg, '=') + sizeof(char); - is_changed_default_host = true; // strip the trailing '/', if any, off the end of the host // string size_t found, length; diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index f27b6e2..7759c2e 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -1129,12 +1129,8 @@ void show_help (void) " url (default=\"https://s3.amazonaws.com\")\n" " - sets the url to use to access Amazon S3. If you want to use HTTP,\n" " then you can set \"url=http://s3.amazonaws.com\".\n" - " If you start s3fs without specifying the url option, s3fs will\n" - " check the bucket using https://s3.amazonaws.com. And when bucket\n" - " check fails, s3fs retries the bucket check using\n" - " http://s3.amazonaws.com. This is the function left behind for\n" - " backward compatibility. If you do not use https, please specify\n" - " the URL with the url option.\n" + " If you do not use https, please specify the URL with the url\n" + " option.\n" "\n" " endpoint (default=\"us-east-1\")\n" " - sets the endpoint to use on signature version 4\n"