From b6d77f6ad623e22e02b3a1f3e46acdc3ed776fe5 Mon Sep 17 00:00:00 2001 From: Vivek Dasmohapatra Date: Mon, 19 Aug 2013 18:13:44 +0100 Subject: [PATCH] fetcher: Return NOT_FOUND when the HTTP code is 410 or 404 This will be used by the pull code to download optional data. --- src/libostree/ostree-fetcher.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c index e1f3db2a..b9af77c5 100644 --- a/src/libostree/ostree-fetcher.c +++ b/src/libostree/ostree-fetcher.c @@ -214,7 +214,17 @@ on_request_sent (GObject *object, msg = soup_request_http_get_message ((SoupRequestHTTP*) object); if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { - g_set_error (&local_error, G_IO_ERROR, G_IO_ERROR_FAILED, + GIOErrorEnum code; + switch (msg->status_code) + { + case 404: + case 410: + code = G_IO_ERROR_NOT_FOUND; + break; + default: + code = G_IO_ERROR_FAILED; + } + g_set_error (&local_error, G_IO_ERROR, code, "Server returned status %u: %s", msg->status_code, soup_status_get_phrase (msg->status_code)); g_simple_async_result_take_error (pending->result, local_error);