diff --git a/curl_default_function.e b/curl_default_function.e index b8ddb07c..f6248443 100644 --- a/curl_default_function.e +++ b/curl_default_function.e @@ -35,7 +35,7 @@ feature -- Command -- Redefine local l_c_string: C_STRING - l_string: STRING + l_string: CURL_STRING l_identified: IDENTIFIED do Result := a_size * a_nmemb @@ -85,9 +85,8 @@ feature {NONE} -- Implementation local l_c_string: C_STRING do - print ("%N" + a_text) create l_c_string.share_from_pointer_and_count (a_char_pointer, a_size) - print ("%N" + l_c_string.string) + print ("%N" + a_text + "%N" + l_c_string.string) end indexing diff --git a/curl_easy_externals.e b/curl_easy_externals.e index 42932207..73259dab 100644 --- a/curl_easy_externals.e +++ b/curl_easy_externals.e @@ -54,6 +54,16 @@ feature -- Command setopt_void_star (a_curl_handle, a_opt, a_form.item) end + setopt_slist (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_slist: POINTER) is + -- Declared as curl_easy_setopt(). + require + exists: a_curl_handle /= default_pointer + valid: a_opt = {CURL_OPT_CONSTANTS}.curlopt_httpheader + exists: a_curl_slist /= default_pointer + do + setopt_void_star (a_curl_handle, a_opt, a_curl_slist) + end + setopt_curl_string (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_string: CURL_STRING) is -- Declared as curl_easy_setopt(). require diff --git a/curl_externals.e b/curl_externals.e index 274b9d4d..d834c389 100644 --- a/curl_externals.e +++ b/curl_externals.e @@ -52,6 +52,22 @@ feature -- Command end end + slist_append (a_list: POINTER; a_string: STRING_GENERAL): POINTER is + -- Declared as curl_slist_append (). + require + exists: a_list /= default_pointer + not_void: a_string /= Void + local + l_c_string: C_STRING + l_api: POINTER + do + l_api := api_loader.safe_load_api (module_name, "curl_slist_append") + if l_api /= default_pointer then + create l_c_string.make (a_string) + Result := c_slist_append (l_api, a_list, l_c_string.item) + end + end + feature -- Query is_dynamic_library_exists: BOOLEAN is @@ -64,6 +80,9 @@ feature {CURL_FORM} -- Internal command formfree (a_curl_form: POINTER) is -- Declared as curl_formfree (). + -- See: http://curl.askapache.com/libcurl/c/curl_formfree.html + -- curl_formfree() is used to clean up data previously built/appended with curl_formadd(3). + -- This must be called when the data has been used, which typically means after the curl_easy_perform(3) has been called. require exists: a_curl_form /= default_pointer local diff --git a/curl_form.e b/curl_form.e index 360257a4..6d26c2e6 100644 --- a/curl_form.e +++ b/curl_form.e @@ -62,6 +62,13 @@ feature -- Command end end + release_item is + -- Release item + -- NOT free memory! This is useful if Current generated by {CURL_EXTERNALS}.formadd_string_string. + do + item := default_pointer + end + feature {CURL_EXTERNALS} -- Internal command set_item (a_item: POINTER) is diff --git a/curl_opt_constants.e b/curl_opt_constants.e index c748e999..f31c55a8 100644 --- a/curl_opt_constants.e +++ b/curl_opt_constants.e @@ -184,6 +184,28 @@ feature -- Enumerations. ]" end + curlopt_referer: INTEGER is + -- Declared as CURLOPT_REFERER + external + "C inline use " + alias + "[ + return CURLOPT_REFERER; + ]" + end + + curlopt_httpget: INTEGER is + -- Declared as CURLOPT_HTTPGET + -- Pass a long. If the long is non-zero, this forces the HTTP request to get back to GET. usable if a POST, HEAD, PUT or a custom request have been used previously using the same curl handle. + -- When setting CURLOPT_HTTPGET to a non-zero value, it will automatically set CURLOPT_NOBODY to 0 (since 7.14.1). + external + "C inline use " + alias + "[ + return CURLOPT_HTTPGET; + ]" + end + is_valid (a_integer: INTEGER): BOOLEAN is -- If `a_integer' value vaild? do @@ -203,7 +225,9 @@ feature -- Enumerations. a_integer = curlopt_writefunction or a_integer = curlopt_progressfunction or a_integer = curlopt_progressdata or - a_integer = curlopt_noprogress + a_integer = curlopt_noprogress or + a_integer = curlopt_referer or + a_integer = curlopt_httpget end indexing