From c17324b5ea8ccca9cbd66635c448b750615eb9fe Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Thu, 14 Apr 2016 09:42:04 +0100
Subject: [PATCH] Fixes for HTTP cancellation.

(Forgot to stage these from previous commit)
---
 simgear/io/HTTPRepository.cxx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx
index a82931d9..fe9b1349 100644
--- a/simgear/io/HTTPRepository.cxx
+++ b/simgear/io/HTTPRepository.cxx
@@ -105,11 +105,7 @@ namespace simgear
         {
         }
 
-        virtual void cancel()
-        {
-            _directory = 0;
-            abort("Repository cancelled request");
-        }
+        virtual void cancel();
 
         size_t contentSize() const
         {
@@ -633,6 +629,12 @@ HTTPRepository::failure() const
     return _d->status;
 }
 
+    void HTTPRepoGetRequest::cancel()
+    {
+        _directory->repository()->http->cancelRequest(this, "Reposiotry cancelled");
+        _directory = 0;
+    }
+
     class FileGetRequest : public HTTPRepoGetRequest
     {
     public:
@@ -652,7 +654,7 @@ HTTPRepository::failure() const
                 file.reset(new SGFile(pathInRepo.str()));
                 if (!file->open(SG_IO_OUT)) {
                   SG_LOG(SG_TERRASYNC, SG_WARN, "unable to create file " << pathInRepo);
-                  abort("Unable to create output file");
+                  _directory->repository()->http->cancelRequest(this, "Unable to create output file");
                 }
 
                 sha1_init(&hashContext);
-- 
2.39.5