854 DavLock *lock = dav_get_lock(sn, res->path); |
854 DavLock *lock = dav_get_lock(sn, res->path); |
855 char *locktoken = lock ? lock->token : NULL; |
855 char *locktoken = lock ? lock->token : NULL; |
856 |
856 |
857 // store content |
857 // store content |
858 if(data->content) { |
858 if(data->content) { |
|
859 curl_easy_setopt(sn->handle, CURLOPT_XFERINFOFUNCTION, dav_session_put_progress); |
|
860 curl_easy_setopt(sn->handle, CURLOPT_XFERINFODATA, res); |
|
861 curl_easy_setopt(sn->handle, CURLOPT_NOPROGRESS, 0L); |
|
862 |
859 int encryption = DAV_ENCRYPT_CONTENT(sn) && sn->key; |
863 int encryption = DAV_ENCRYPT_CONTENT(sn) && sn->key; |
860 CURLcode ret; |
864 CURLcode ret; |
861 if(encryption) { |
865 if(encryption) { |
862 AESEncrypter *enc = NULL; |
866 AESEncrypter *enc = NULL; |
863 CxBuffer *buf = NULL; |
867 CxBuffer *buf = NULL; |
898 |
902 |
899 // add crypto properties |
903 // add crypto properties |
900 // TODO: store the properties later |
904 // TODO: store the properties later |
901 if(resource_add_crypto_info(sn, res->href, res->name, enc_hash)) { |
905 if(resource_add_crypto_info(sn, res->href, res->name, enc_hash)) { |
902 free(enc_hash); |
906 free(enc_hash); |
|
907 curl_easy_setopt(sn->handle, CURLOPT_XFERINFOFUNCTION, NULL); |
|
908 curl_easy_setopt(sn->handle, CURLOPT_NOPROGRESS, 1L); |
903 return 1; |
909 return 1; |
904 } |
910 } |
905 resource_add_string_property(res, DAV_NS, "crypto-hash", enc_hash); |
911 resource_add_string_property(res, DAV_NS, "crypto-hash", enc_hash); |
906 free(enc_hash); |
912 free(enc_hash); |
907 } else if((sn->flags & DAV_SESSION_STORE_HASH) == DAV_SESSION_STORE_HASH) { |
913 } else if((sn->flags & DAV_SESSION_STORE_HASH) == DAV_SESSION_STORE_HASH) { |
946 data->content, |
952 data->content, |
947 data->read, |
953 data->read, |
948 data->seek, |
954 data->seek, |
949 data->length); |
955 data->length); |
950 } |
956 } |
|
957 |
|
958 curl_easy_setopt(sn->handle, CURLOPT_XFERINFOFUNCTION, NULL); |
|
959 curl_easy_setopt(sn->handle, CURLOPT_NOPROGRESS, 1L); |
951 |
960 |
952 long status = 0; |
961 long status = 0; |
953 curl_easy_getinfo(sn->handle, CURLINFO_RESPONSE_CODE, &status); |
962 curl_easy_getinfo(sn->handle, CURLINFO_RESPONSE_CODE, &status); |
954 if(ret == CURLE_OK && (status >= 200 && status < 300)) { |
963 if(ret == CURLE_OK && (status >= 200 && status < 300)) { |
955 res->session->error = 0; |
964 res->session->error = 0; |