Hi , I am writing amazon webservice but i am getting error S3StatusConnectionFailed when i use s3_put_object , I am able to create a bucket but when i want to upload file on bucket then i am getting error S3StatusConnectionFailed , what is this error i am not able to find solution pls help.
my code
const char filename[] = "c:\url_20091119102308.xml";
const char objName[] = "url_20091119102308.xml";
uint64_t contentLength = 0;
const char *cacheControl = 0, *contentType = 0, *md5 = 0;
const char *contentDispositionFilename = 0, *contentEncoding = 0;
int64_t expires = -1;
int metaPropertiesCount = 0;
S3NameValue metaProperties[S3_MAX_METADATA_COUNT] = {0};
int noStatus = 0;
put_object_callback_data data;
/*char *param = 0;
cacheControl = "Cache-Control";*/
contentType = "application/xml";
//contentDispositionFilename = filename;
//md5 = "base64-encoded";
//metaProperties[S3_MAX_METADATA_COUNT].name = "x-amz-meta-foo";*/
data.infile = 0;
data.gb = 0;
data.noStatus = 0;//noStatus;
if (filename)
{
if (!contentLength)
{
struct stat statbuf;
// Stat the file to get its length
if (stat(filename, &statbuf) == -1)
{
fprintf(stderr, "\nERROR: Failed to stat file %s: ",
filename);
perror(0);
exit(-1);
}
contentLength = statbuf.st_size;
}
// Open the file
if (!(data.infile = fopen(filename, "r" FOPEN_EXTRA_FLAGS)))
{
fprintf(stderr, "\nERROR: Failed to open input file %s: ",
filename);
perror(0);
exit(-1);
}
}
data.contentLength = data.originalContentLength = contentLength;
S3BucketContext bucketContext =
{
bucketName,
protocolG,
uriStyleG,
"mykeyid",
"key"
};
S3PutProperties putProperties =
{
contentType,
md5,
cacheControl,
contentDispositionFilename,
contentEncoding,
expires,
cannedAcl,
metaPropertiesCount,
metaProperties
};
S3PutObjectHandler putObjectHandler =
{
{ &responsePropertiesCallback, &responseCompleteCallback },
&putObjectDataCallback
};
nRetry = 0;
do {
PUTOBJECT procPutObject = (PUTOBJECT)GetProcAddress(hModule,"S3_put_object");
(procPutObject)(&bucketContext,filename, contentLength, &putProperties, 0,
&putObjectHandler, &data);
STATUSRETRY procStatusRetry = (STATUSRETRY)GetProcAddress(hModule,"S3_status_is_retryable");
S3Status status;
nRetry = (procStatusRetry)(status);
} while (nRetry && should_retry());