In the OSS MEDIA C SDK, the upload and download features that depend on the OSS C SDK and OSS MEDIA C SDK are implemented by calling the OSS C SDK interfaces.
Yes. Use “a” mode when calling oss_media_file_open, then you can call the oss_media_file_write interface multiple times to implement append write.
The role ARN represents the ID of the role. It is provided by Alibaba Cloud RAM. To get the ARN, go to the RAM console. On the left-side navigation pane, click Roles. Locate the role and click Manage. Go to the Basic Information page, you can see Arn. The value is in a format similar to acs:ram::xxxx:role/yyyyy. If no role is created, you must create a new user role on the Manage Roles page and grant the permissions with the AliyunSTSAssumeRoleAccess and other corresponding roles. For more information, see RAM Documents.
Modify the sample/config.c object and add your own AccessKey ID, AccessKey Secret and bucket values. After compilation, a sample executable file appears in the bin directory.
Check whether the host value is similar to oss-cn-hangzhou.aliyuncs.com. This is a known problem of the C SDK, which is to be repaired in later versions.
Errors are reported during sample running: error: Couldn’t resolve host name and [code=-990, message=HttpIoError]
Modify the sample/config.c object and configure your own parameter values, then re-compile the SDK again. Follow the same process for testing.
What are the differences and notes for AccessKey ID, AccessKey Secret and token configuration on the client and server?
On the server, you must configure the AccessKey ID and AccessKey Secret. The two values have two sources: first, the AccessKeys of the master account; second, the AccessKeys of the subaccount generated by the master account.
The two configuration methods on the client are: The first method is the same as that on the server. Only the AccessKey ID and AccessKey Secret of the master account or subaccount are configured. The second method is to configure three values: AccessKey ID, AccessKey Secret and a token. But all the three values are temporary AccessKeys and tokens obtained by the server through oss_media_get_token or oss_media_get_token_from_policy and have a validity period. After the validity period elapses, the values are unavailable.
The following error is prompted during sample execution to get the token: http_code=500, error_code=GetSTSTokenError, error_message=Internal Error
This is because, the installed libcurl does not support the HTTPS protocol, thus the STS service is unavailable. The specific process is that no SSL development packages such as openssl-devel are installed, and no SSL can be found during libcurl compilation. As a result, libcurl automatically disables the HTTPS protocol, and thus the compiled libcurl library does not support HTTPS, which leads to the STS access failure.
The solution is to first install SSL development packages such as openssl-devel and re-install libcurl. When installing libcurl, check whether HTTPS is included in Protocols in the last line after ./configure execution. If HTTPS is included, it indicates that the installation was correct.