"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "common/flatpak-utils-http.c" between
flatpak-1.15.1.tar.xz and flatpak-1.15.2.tar.xz

About: Flatpak is a Linux application sandboxing and distribution framework. Pre-release.

flatpak-utils-http.c  (flatpak-1.15.1.tar.xz):flatpak-utils-http.c  (flatpak-1.15.2.tar.xz)
skipping to change at line 461 skipping to change at line 461
GError **error) GError **error)
{ {
CURLcode res; CURLcode res;
g_autofree char *auth_header = NULL; g_autofree char *auth_header = NULL;
g_autofree char *cache_header = NULL; g_autofree char *cache_header = NULL;
g_autoptr(auto_curl_slist) header_list = NULL; g_autoptr(auto_curl_slist) header_list = NULL;
g_autoptr(GMutexLocker) curl_lock = g_mutex_locker_new (&session->lock); g_autoptr(GMutexLocker) curl_lock = g_mutex_locker_new (&session->lock);
long response; long response;
CURL *curl = session->curl; CURL *curl = session->curl;
g_debug ("Loading %s using curl", uri); g_info ("Loading %s using curl", uri);
curl_easy_setopt (curl, CURLOPT_URL, uri); curl_easy_setopt (curl, CURLOPT_URL, uri);
curl_easy_setopt (curl, CURLOPT_WRITEDATA, (void *)data); curl_easy_setopt (curl, CURLOPT_WRITEDATA, (void *)data);
curl_easy_setopt (curl, CURLOPT_HEADERDATA, (void *)data); curl_easy_setopt (curl, CURLOPT_HEADERDATA, (void *)data);
if (data->flags & FLATPAK_HTTP_FLAGS_HEAD) if (data->flags & FLATPAK_HTTP_FLAGS_HEAD)
curl_easy_setopt (curl, CURLOPT_NOBODY, 1L); curl_easy_setopt (curl, CURLOPT_NOBODY, 1L);
else else
curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L);
skipping to change at line 550 skipping to change at line 550
data->progress (data->downloaded_bytes, data->user_data); data->progress (data->downloaded_bytes, data->user_data);
curl_easy_getinfo (session->curl, CURLINFO_RESPONSE_CODE, &response); curl_easy_getinfo (session->curl, CURLINFO_RESPONSE_CODE, &response);
data->status = response; data->status = response;
if ((data->flags & FLATPAK_HTTP_FLAGS_NOCHECK_STATUS) == 0 && if ((data->flags & FLATPAK_HTTP_FLAGS_NOCHECK_STATUS) == 0 &&
!check_http_status (data->status, error)) !check_http_status (data->status, error))
return FALSE; return FALSE;
g_debug ("Received %" G_GUINT64_FORMAT " bytes", data->downloaded_bytes); g_info ("Received %" G_GUINT64_FORMAT " bytes", data->downloaded_bytes);
/* This is not really needed, but the auto-pointer confuses some compilers in the CI */ /* This is not really needed, but the auto-pointer confuses some compilers in the CI */
g_clear_pointer (&curl_lock, g_mutex_locker_free); g_clear_pointer (&curl_lock, g_mutex_locker_free);
return TRUE; return TRUE;
} }
#endif /* HAVE_CURL */ #endif /* HAVE_CURL */
#if defined(HAVE_SOUP) #if defined(HAVE_SOUP)
skipping to change at line 810 skipping to change at line 810
static gboolean static gboolean
flatpak_download_http_uri_once (FlatpakHttpSession *http_session, flatpak_download_http_uri_once (FlatpakHttpSession *http_session,
LoadUriData *data, LoadUriData *data,
const char *uri, const char *uri,
GError **error) GError **error)
{ {
SoupSession *soup_session = (SoupSession *)http_session; SoupSession *soup_session = (SoupSession *)http_session;
g_autoptr(SoupRequestHTTP) request = NULL; g_autoptr(SoupRequestHTTP) request = NULL;
SoupMessage *m; SoupMessage *m;
g_debug ("Loading %s using libsoup", uri); g_info ("Loading %s using libsoup", uri);
request = soup_session_request_http (soup_session, request = soup_session_request_http (soup_session,
(data->flags & FLATPAK_HTTP_FLAGS_HEAD) ! = 0 ? "HEAD" : "GET", (data->flags & FLATPAK_HTTP_FLAGS_HEAD) ! = 0 ? "HEAD" : "GET",
uri, error); uri, error);
if (request == NULL) if (request == NULL)
return FALSE; return FALSE;
m = soup_request_http_get_message (request); m = soup_request_http_get_message (request);
if (data->flags & FLATPAK_HTTP_FLAGS_ACCEPT_OCI) if (data->flags & FLATPAK_HTTP_FLAGS_ACCEPT_OCI)
skipping to change at line 875 skipping to change at line 875
while (data->error == NULL && !data->done) while (data->error == NULL && !data->done)
g_main_context_iteration (data->context, TRUE); g_main_context_iteration (data->context, TRUE);
if (data->error) if (data->error)
{ {
g_propagate_error (error, g_steal_pointer (&data->error)); g_propagate_error (error, g_steal_pointer (&data->error));
return FALSE; return FALSE;
} }
g_debug ("Received %" G_GUINT64_FORMAT " bytes", data->downloaded_bytes); g_info ("Received %" G_GUINT64_FORMAT " bytes", data->downloaded_bytes);
return TRUE; return TRUE;
} }
#endif /* HAVE_SOUP */ #endif /* HAVE_SOUP */
/* Check whether a particular operation should be retried. This is entirely /* Check whether a particular operation should be retried. This is entirely
* based on how it failed (if at all) last time, and whether the operation has * based on how it failed (if at all) last time, and whether the operation has
* some retries left. The retry count is set when the operation is first * some retries left. The retry count is set when the operation is first
* created, and must be decremented by the caller. (@n_retries_remaining == 0) * created, and must be decremented by the caller. (@n_retries_remaining == 0)
skipping to change at line 906 skipping to change at line 906
/* Return TRUE for transient errors. */ /* Return TRUE for transient errors. */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT) || if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_NOT_FOUND) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_NOT_FOUND) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED) ||
g_error_matches (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND) || g_error_matches (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND) ||
g_error_matches (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_TEMPORARY_FAILU RE)) g_error_matches (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_TEMPORARY_FAILU RE))
{ {
g_debug ("Should retry request (remaining: %u retries), due to transient e g_info ("Should retry request (remaining: %u retries), due to transient er
rror: %s", ror: %s",
n_retries_remaining, error->message); n_retries_remaining, error->message);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
GBytes * GBytes *
flatpak_load_uri_full (FlatpakHttpSession *http_session, flatpak_load_uri_full (FlatpakHttpSession *http_session,
const char *uri, const char *uri,
FlatpakHTTPFlags flags, FlatpakHTTPFlags flags,
 End of changes. 5 change blocks. 
7 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)