summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2018-01-10 16:02:59 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-11 14:06:16 +0000
commitfdf7e2c560719d7e18f31c90b04a24349c6cc0e2 (patch)
tree5a6dd8d69d095c55db75914f3790e995f66ab05c
parent0be95ded9914eaa903fe9e5d38cf5c97b4567ac4 (diff)
downloadostree-fdf7e2c560719d7e18f31c90b04a24349c6cc0e2.tar.gz
lib/fetcher: Add version to USER_AGENT string
This came up in allowing Fedora infrastructure to work around a libcurl bug with HTTP2: https://pagure.io/atomic-wg/issue/405 Closes: https://github.com/ostreedev/ostree/issues/1405 Closes: #1406 Approved by: jlebon
-rw-r--r--src/libostree/ostree-fetcher-curl.c2
-rw-r--r--src/libostree/ostree-fetcher-soup.c2
-rw-r--r--src/libostree/ostree-fetcher-util.h6
3 files changed, 8 insertions, 2 deletions
diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c
index 272d609a..2d01257d 100644
--- a/src/libostree/ostree-fetcher-curl.c
+++ b/src/libostree/ostree-fetcher-curl.c
@@ -714,7 +714,7 @@ initiate_next_curl_request (FetcherRequest *req,
curl_easy_setopt (req->easy, CURLOPT_URL, uri);
}
- curl_easy_setopt (req->easy, CURLOPT_USERAGENT, "ostree ");
+ curl_easy_setopt (req->easy, CURLOPT_USERAGENT, OSTREE_FETCHER_USERAGENT_STRING);
if (self->extra_headers)
curl_easy_setopt (req->easy, CURLOPT_HTTPHEADER, self->extra_headers);
diff --git a/src/libostree/ostree-fetcher-soup.c b/src/libostree/ostree-fetcher-soup.c
index e023d34e..cab8dff6 100644
--- a/src/libostree/ostree-fetcher-soup.c
+++ b/src/libostree/ostree-fetcher-soup.c
@@ -479,7 +479,7 @@ ostree_fetcher_session_thread (gpointer data)
g_main_context_push_thread_default (mainctx);
/* We retain ownership of the SoupSession reference. */
- closure->session = soup_session_async_new_with_options (SOUP_SESSION_USER_AGENT, "ostree ",
+ closure->session = soup_session_async_new_with_options (SOUP_SESSION_USER_AGENT, OSTREE_FETCHER_USERAGENT_STRING,
SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_REQUESTER,
diff --git a/src/libostree/ostree-fetcher-util.h b/src/libostree/ostree-fetcher-util.h
index 29293816..48528e0f 100644
--- a/src/libostree/ostree-fetcher-util.h
+++ b/src/libostree/ostree-fetcher-util.h
@@ -25,6 +25,12 @@
G_BEGIN_DECLS
+/* We used to only send "ostree/" but now include the version
+ * https://github.com/ostreedev/ostree/issues/1405
+ * This came up in allowing Fedora infrastructure to work around a libcurl bug with HTTP2.
+ */
+#define OSTREE_FETCHER_USERAGENT_STRING (PACKAGE_NAME "/" PACKAGE_VERSION)
+
static inline gboolean
_ostree_fetcher_tmpf_from_flags (OstreeFetcherRequestFlags flags,
int dfd,