mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
Allow to create new files (but changing them is not allowed yet)
- since mediafire cannot deal with empty files, we put new files into a temporary location and upload them once they get closed - add create and write functions to fuse - pass a file handle to mfconn_api_upload_simple instead of a path - allow calc_sha256 to also compute the file size - error out when the key returned by upload/simple is empty - make valgrind.supp more lenient
This commit is contained in:
@@ -277,7 +277,7 @@ http_read_file_cb(char *data, size_t size, size_t nmemb, void *user_ptr)
|
||||
}
|
||||
|
||||
int
|
||||
http_post_file(mfhttp * conn, const char *url, const char *path,
|
||||
http_post_file(mfhttp * conn, const char *url, FILE * fh,
|
||||
const char *filename, uint64_t filesize, const char *fhash,
|
||||
int (*data_handler) (mfhttp * conn, void *data), void *data)
|
||||
{
|
||||
@@ -318,10 +318,9 @@ http_post_file(mfhttp * conn, const char *url, const char *path,
|
||||
curl_easy_setopt(conn->curl_handle, CURLOPT_WRITEDATA, (void *)conn);
|
||||
curl_easy_setopt(conn->curl_handle, CURLOPT_POSTFIELDSIZE, filesize);
|
||||
|
||||
conn->stream = fopen(path, "r");
|
||||
conn->stream = fh;
|
||||
fprintf(stderr, "POST: %s\n", url);
|
||||
retval = curl_easy_perform(conn->curl_handle);
|
||||
fclose(conn->stream);
|
||||
curl_slist_free_all(custom_headers);
|
||||
if (retval != CURLE_OK) {
|
||||
fprintf(stderr, "error curl_easy_perform %s\n\r", conn->error_buf);
|
||||
|
||||
Reference in New Issue
Block a user