void testIoPut() { Qiniu_Error err; Qiniu_Client client; Qiniu_RS_PutPolicy putPolicy; Qiniu_RS_GetPolicy getPolicy; char* uptoken; char* dntoken; Qiniu_Client_InitMacAuth(&client, 1024, NULL); Qiniu_Zero(putPolicy); putPolicy.scope = bucket; uptoken = Qiniu_RS_PutPolicy_Token(&putPolicy, NULL); Qiniu_RS_Delete(&client, bucket, key); clientIoPutFile(uptoken); Qiniu_RS_Delete(&client, bucket, key); clientIoPutBuffer(uptoken); free(uptoken); Qiniu_Zero(getPolicy); getPolicy.scope = "*/*"; dntoken = Qiniu_RS_GetPolicy_Token(&getPolicy, NULL); clientIoGet(dntoken); free(dntoken); Qiniu_Client_Cleanup(&client); }
void testResumableIoPut(void) { Qiniu_Client client; Qiniu_RS_PutPolicy putPolicy; Qiniu_RS_GetPolicy getPolicy; char* uptoken; char* dnBaseUrl; char* dnRequest; Qiniu_Client_InitMacAuth(&client, 1024, NULL); Qiniu_Zero(putPolicy); putPolicy.scope = bucket; uptoken = Qiniu_RS_PutPolicy_Token(&putPolicy, NULL); Qiniu_RS_Delete(&client, bucket, key); clientIoPutFile(uptoken); Qiniu_RS_Delete(&client, bucket, key); clientIoPutBuffer(uptoken); Qiniu_Free(uptoken); Qiniu_Zero(getPolicy); dnBaseUrl = Qiniu_RS_MakeBaseUrl(domain, key); dnRequest = Qiniu_RS_GetPolicy_MakeRequest(&getPolicy, dnBaseUrl, NULL); clientIoGet(dnRequest); Qiniu_Free(dnRequest); Qiniu_Free(dnBaseUrl); Qiniu_Client_Cleanup(&client); }