Added debugging message

1) Added debugging message in s3fs_getattr
   If s3fs runs with "f2" option for deep debugging message, s3fs_getattr
   puts debugging message as file's uid/gid/mode.

2) Added curldbg option
   Added new option "curldbg" which is for debugging curl http/https
   information.
   It implements by CURLOPT_VERBOSE on curl_easy_setopt function.



git-svn-id: http://s3fs.googlecode.com/svn/trunk@474 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
ggtakec@gmail.com 2013-08-23 16:28:50 +00:00
parent 1a4e525465
commit 3dda0b20d4
3 changed files with 20 additions and 1 deletions

View File

@ -143,6 +143,7 @@ string S3fsCurl::default_acl = "private";
bool S3fsCurl::is_use_rrs = false;
bool S3fsCurl::is_use_sse = false;
bool S3fsCurl::is_content_md5 = false;
bool S3fsCurl::is_verbose = false;
string S3fsCurl::AWSAccessKeyId;
string S3fsCurl::AWSSecretAccessKey;
long S3fsCurl::ssl_verify_hostname = 1; // default(original code...)
@ -641,6 +642,13 @@ bool S3fsCurl::SetContentMd5(bool flag)
return old;
}
bool S3fsCurl::SetVerbose(bool flag)
{
bool old = S3fsCurl::is_verbose;
S3fsCurl::is_verbose = flag;
return old;
}
bool S3fsCurl::SetAccessKey(const char* AccessKeyId, const char* SecretAccessKey)
{
if(!AccessKeyId || '\0' == AccessKeyId[0] || !SecretAccessKey || '\0' == SecretAccessKey[0]){
@ -924,6 +932,9 @@ bool S3fsCurl::ResetHandle(void)
if(S3fsCurl::is_dns_cache && S3fsCurl::hCurlShare){
curl_easy_setopt(hCurl, CURLOPT_SHARE, S3fsCurl::hCurlShare);
}
if(S3fsCurl::is_verbose){
curl_easy_setopt(hCurl, CURLOPT_VERBOSE, true);
}
S3fsCurl::curl_times[hCurl] = time(0);
S3fsCurl::curl_progress[hCurl] = progress_t(-1, -1);
@ -1204,7 +1215,6 @@ int S3fsCurl::RequestPerform(void)
curl_easy_getinfo(hCurl, CURLINFO_EFFECTIVE_URL , &ptr_url);
DPRNNN("connecting to URL %s", SAFESTRPTR(ptr_url));
}
// curl_easy_setopt(curl, CURLOPT_VERBOSE, true);
// 1 attempt + retries...
for(int retrycnt = S3fsCurl::retries; 0 < retrycnt; retrycnt--){

View File

@ -136,6 +136,7 @@ class S3fsCurl
static bool is_use_rrs;
static bool is_use_sse;
static bool is_content_md5;
static bool is_verbose;
static std::string AWSAccessKeyId;
static std::string AWSSecretAccessKey;
static long ssl_verify_hostname;
@ -230,6 +231,8 @@ class S3fsCurl
static bool SetUseSse(bool flag);
static bool GetUseSse(void) { return S3fsCurl::is_use_sse; }
static bool SetContentMd5(bool flag);
static bool SetVerbose(bool flag);
static bool GetVerbose(void) { return S3fsCurl::is_verbose; }
static bool SetAccessKey(const char* AccessKeyId, const char* SecretAccessKey);
static bool IsSetAccessKeyId(void) { return (0 < S3fsCurl::AWSAccessKeyId.size() && 0 < S3fsCurl::AWSSecretAccessKey.size()); }
static long SetSslVerifyHostname(long value);

View File

@ -694,6 +694,8 @@ static int s3fs_getattr(const char* path, struct stat* stbuf)
FdManager::get()->Close(ent);
}
}
FPRNINFO("[path=%s] uid=%u, gid=%u, mode=%04o", path, (unsigned int)(stbuf->st_uid), (unsigned int)(stbuf->st_gid), stbuf->st_mode);
return result;
}
@ -3268,6 +3270,10 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
foreground2 = true;
return 0;
}
if(strstr(arg, "curldbg") != 0){
S3fsCurl::SetVerbose(true);
return 0;
}
if(strstr(arg, "accessKeyId=") != 0){
fprintf(stderr, "%s: option accessKeyId is no longer supported\n",