Displaying 5 results from an estimated 5 matches for "display_curl_error".
2020 Jan 08
1
[nbdkit PATCH] curl: use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T when available
...curl_off_t o;
+#endif
h = calloc (1, sizeof *h);
if (h == NULL) {
@@ -377,6 +384,21 @@ curl_open (int readonly)
goto err;
}
+#ifdef HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
+ r = curl_easy_getinfo (h->c, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &o);
+ if (r != CURLE_OK) {
+ display_curl_error (h, r, "could not get length of remote file [%s]", url);
+ goto err;
+ }
+
+ if (o == -1) {
+ nbdkit_error ("could not get length of remote file [%s], "
+ "is the URL correct?", url);
+ goto err;
+ }
+
+ h->exportsize = o;
+#else
r =...
2020 Jul 14
0
[PATCH nbdkit RFC 2/2] curl: Implement authorization scripts.
...-/* The per-connection handle. */
-struct curl_handle {
- CURL *c;
- bool accept_range;
- int64_t exportsize;
- char errbuf[CURL_ERROR_SIZE];
- char *write_buf;
- uint32_t write_count;
- const char *read_buf;
- uint32_t read_count;
-};
-
/* Translate CURLcode to nbdkit_error. */
#define display_curl_error(h, r, fs, ...) \
do { \
@@ -450,7 +456,12 @@ curl_open (int readonly)
/* Get the file size and also whether the remote HTTP server
* supports byte ranges.
+ *
+ * We must run the auth-script if necessary...
2020 Jul 14
3
[PATCH nbdkit RFC 0/2] curl: Implement authorization scripts.
This is an RFC only, at the very least it lacks tests.
This implements a rather complex new feature in nbdkit-curl-plugin
allowing you to specify an external shell script that can be used to
fetch an authorization token for services which requires a token or
cookie for access, especially if that token must be renewed
periodically. The motivation can be seen in the changes to the docs
in patch 2.
2020 Jul 15
0
[PATCH nbdkit v2] curl: Implement header and cookie scripts.
...-/* The per-connection handle. */
-struct curl_handle {
- CURL *c;
- bool accept_range;
- int64_t exportsize;
- char errbuf[CURL_ERROR_SIZE];
- char *write_buf;
- uint32_t write_count;
- const char *read_buf;
- uint32_t read_count;
-};
-
/* Translate CURLcode to nbdkit_error. */
#define display_curl_error(h, r, fs, ...) \
do { \
@@ -450,7 +490,11 @@ curl_open (int readonly)
/* Get the file size and also whether the remote HTTP server
* supports byte ranges.
+ *
+ * We must run the scripts if necessary and...
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.