improved util_capture_header when deactivating the capturing

Thu, 15 Oct 2015 19:04:49 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 15 Oct 2015 19:04:49 +0200
changeset 176
747f3796eddd
parent 175
9e14d920a7d0
child 177
3c0734eeab33

improved util_capture_header when deactivating the capturing

libidav/methods.c file | annotate | diff | comparison | revisions
libidav/utils.c file | annotate | diff | comparison | revisions
--- a/libidav/methods.c	Thu Oct 15 17:45:00 2015 +0200
+++ b/libidav/methods.c	Thu Oct 15 19:04:49 2015 +0200
@@ -103,12 +103,11 @@
         }
     }
     
+    // deactivate header capturing and free captured map
+    util_capture_header(handle, NULL);
     ucx_map_free_content(respheaders, free);
     ucx_map_free(respheaders);
     
-    curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, NULL);
-    curl_easy_setopt(handle, CURLOPT_HEADERDATA, NULL);
-    
     return ret;
 }
 
--- a/libidav/utils.c	Thu Oct 15 17:45:00 2015 +0200
+++ b/libidav/utils.c	Thu Oct 15 19:04:49 2015 +0200
@@ -323,14 +323,13 @@
 }
 
 void util_capture_header(CURL *handle, UcxMap* map) {
-    if(!map) {
-        // deactivate capturing
+    if(map) {
+        curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, util_header_callback);
+        curl_easy_setopt(handle, CURLOPT_HEADERDATA, map);
+    } else {
         curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, NULL);
-        return;
+        curl_easy_setopt(handle, CURLOPT_HEADERDATA, NULL);
     }
-    
-    curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, util_header_callback);
-    curl_easy_setopt(handle, CURLOPT_HEADERDATA, map);
 }
 
 char* util_resource_name(char *url) {

mercurial