mfconn_create_signed_get: add more verbosity to error conditions

This commit is contained in:
josch
2014-12-19 07:57:01 +01:00
parent 862bdcff80
commit f788706680
16 changed files with 97 additions and 17 deletions

View File

@@ -57,6 +57,10 @@ int mfconn_api_device_get_changes(mfconn * conn, uint64_t revision,
api_call = mfconn_create_signed_get(conn, 0, "device/get_changes.php",
"?revision=%" PRIu64
"&response_format=json", revision);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval =

View File

@@ -61,6 +61,10 @@ int mfconn_api_device_get_patch(mfconn * conn, mfpatch * patch,
"&target_revision=%" PRIu64
"&response_format=json", quickkey,
source_revision, target_revision);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, _decode_device_get_patch,

View File

@@ -41,6 +41,10 @@ int mfconn_api_device_get_status(mfconn * conn, uint64_t * revision)
for (i = 0; i < mfconn_get_max_num_retries(conn); i++) {
api_call = mfconn_create_signed_get(conn, 0, "device/get_status.php",
"?response_format=json");
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval =

View File

@@ -82,6 +82,11 @@ int mfconn_api_device_get_updates(mfconn * conn, const char *quickkey,
quickkey, revision,
target_revision);
}
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, _decode_device_get_updates,
(void *)patches);

View File

@@ -45,6 +45,10 @@ int mfconn_api_file_delete(mfconn * conn, const char *quickkey)
api_call = mfconn_create_signed_get(conn, 0, "file/delete.php",
"?quick_key=%s"
"&response_format=json", quickkey);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval =

View File

@@ -58,6 +58,10 @@ int mfconn_api_file_get_info(mfconn * conn, mffile * file,
api_call = mfconn_create_signed_get(conn, 0, "file/get_info.php",
"?quick_key=%s"
"&response_format=json", quickkey);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, _decode_file_get_info, file);

View File

@@ -56,6 +56,10 @@ int mfconn_api_file_get_links(mfconn * conn, mffile * file,
api_call = mfconn_create_signed_get(conn, 0, "file/get_links.php",
"?quick_key=%s"
"&response_format=json", quickkey);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, _decode_file_get_links, file);

View File

@@ -59,6 +59,10 @@ int mfconn_api_folder_create(mfconn * conn, const char *parent,
"?foldername=%s&response_format=json",
name);
}
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, mfapi_decode_common,

View File

@@ -46,6 +46,10 @@ int mfconn_api_folder_delete(mfconn * conn, const char *folderkey)
"?folder_key=%s"
"&response_format=json",
folderkey);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, mfapi_decode_common,

View File

@@ -99,6 +99,10 @@ mfconn_api_folder_get_content(mfconn * conn, const int mode,
"&response_format=json",
folderkey, content_type);
}
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
if (mode == 0)

View File

@@ -61,6 +61,10 @@ mfconn_api_folder_get_info(mfconn * conn, mffolder * folder,
"&response_format=json",
folderkey);
}
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, _decode_folder_get_info, folder);

View File

@@ -89,6 +89,10 @@ mfconn_api_upload_patch(mfconn * conn, const char *quickkey,
"&quickkey=%s", source_hash,
target_hash, target_size,
quickkey);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
custom_headers = curl_slist_append(custom_headers,
"x-filename: dummy.patch");

View File

@@ -56,6 +56,10 @@ mfconn_api_upload_poll_upload(mfconn * conn, const char *upload_key,
"upload/poll_upload.php",
"?response_format=json"
"&key=%s", upload_key);
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_unsigned_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, _decode_upload_poll_upload,

View File

@@ -90,7 +90,10 @@ mfconn_api_upload_simple(mfconn * conn, const char *folderkey,
"?response_format=json"
"&folder_key=%s", folderkey);
}
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
// make sure that we are at the beginning of the file
rewind(fh);

View File

@@ -40,6 +40,10 @@ int mfconn_api_user_get_info(mfconn * conn)
api_call = mfconn_create_signed_get(conn, 0, "user/get_info.php",
"?response_format=json");
if (api_call == NULL) {
fprintf(stderr, "mfconn_create_signed_get failed\n");
return -1;
}
http = http_create();
retval = http_get_buf(http, api_call, _decode_user_get_info, NULL);