summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Leeds <matthew.leeds@endlessm.com>2020-03-19 16:33:49 -0700
committerAlexander Larsson <alexl@redhat.com>2020-03-30 11:21:49 +0200
commitad803b986248eb3ae460d3b77f3ff59c9ff869ee (patch)
tree29b618990ac368f34adf007e5ae7d4a4e5372eb4
parent53142f3d6a65cccba57b1898db07ae33333c1ffa (diff)
downloadflatpak-ad803b986248eb3ae460d3b77f3ff59c9ff869ee.tar.gz
flatpak-utils-http.c: Use more specific GIOError codes
Instead of defaulting to G_IO_ERROR_FAILED, use more specific codes when we can. These were copied from libostree. (cherry picked from commit 0b25455af11ee8588f8e31da3d44849f8934160e)
-rw-r--r--common/flatpak-utils-http.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/flatpak-utils-http.c b/common/flatpak-utils-http.c
index 2ff30366..f965d798 100644
--- a/common/flatpak-utils-http.c
+++ b/common/flatpak-utils-http.c
@@ -432,11 +432,33 @@ load_uri_callback (GObject *source_object,
code = FLATPAK_OCI_ERROR_NOT_CHANGED;
break;
+ case 403:
case 404:
case 410:
code = G_IO_ERROR_NOT_FOUND;
break;
+ case 408:
+ code = G_IO_ERROR_TIMED_OUT;
+ break;
+
+ case SOUP_STATUS_CANCELLED:
+ code = G_IO_ERROR_CANCELLED;
+ break;
+
+ case SOUP_STATUS_CANT_RESOLVE:
+ case SOUP_STATUS_CANT_CONNECT:
+ code = G_IO_ERROR_HOST_NOT_FOUND;
+ break;
+
+ case SOUP_STATUS_IO_ERROR:
+#if !GLIB_CHECK_VERSION(2, 44, 0)
+ code = G_IO_ERROR_BROKEN_PIPE;
+#else
+ code = G_IO_ERROR_CONNECTION_CLOSED;
+#endif
+ break;
+
default:
code = G_IO_ERROR_FAILED;
}