[ostree] fetcher: Return NOT_FOUND when the HTTP code is 410 or 404



commit b6d77f6ad623e22e02b3a1f3e46acdc3ed776fe5
Author: Vivek Dasmohapatra <vivek collabora co uk>
Date:   Mon Aug 19 18:13:44 2013 +0100

    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 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c
index e1f3db2..b9af77c 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]