Displaying 3 results from an estimated 3 matches for "headers_from_script".
2020 Jul 15
0
[PATCH nbdkit v2] curl: Implement header and cookie scripts.
...st = 0;
+static time_t cookie_last = 0;
+static bool header_script_has_run = false;
+static bool cookie_script_has_run = false;
+static unsigned header_iteration = 0;
+static unsigned cookie_iteration = 0;
+
+/* Last set of headers and cookies generated by the scripts. */
+static struct curl_slist *headers_from_script = NULL;
+static char *cookies_from_script = NULL;
+
+void
+scripts_unload (void)
+{
+ curl_slist_free_all (headers_from_script);
+ free (cookies_from_script);
+}
+
+static int run_header_script (struct curl_handle *);
+static int run_cookie_script (struct curl_handle *);
+
+/* This is called from...
2020 Jul 15
2
[PATCH nbdkit v2] curl: Implement header and cookie scripts.
Evolution of this patch series:
https://www.redhat.com/archives/libguestfs/2020-July/thread.html#00073
Instead of auth-script, this implements header-script and
cookie-script. It can be used for similar purposes but the
implementation is somewhat saner.
Rich.
2020 Jul 20
1
Re: [PATCH nbdkit v2] curl: Implement header and cookie scripts.
...d cookies in the handle.
> + *
> + * When calling CURLOPT_HTTPHEADER we have to keep the list around
> + * because unfortunately curl doesn't take a copy. Since we don't
> + * know which other threads might be using it, we must make a copy
> + * of the global list (headers_from_script) per handle
> + * (h->headers_copy). For CURLOPT_COOKIE, curl internally takes a
> + * copy so we don't need to do this.
The comment on memory life cycles is very helpful (and I suspect you
went through several iterations before figuring out an arrangement that
works)
> +...