From 6e0094bce9b7d75eb0cf2813b56c80563963bfff Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Tue, 19 Nov 2019 08:07:15 -0800 Subject: [PATCH 1/2] Queue the recursive call to innerComplete() I believe this fixes [Issue #14](https://github.com/PerfectlySoft/Perfect-CURL/issues/14), but please take a look. --- Sources/PerfectCURL/CURLResponse.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/PerfectCURL/CURLResponse.swift b/Sources/PerfectCURL/CURLResponse.swift index c167673..ebb15f9 100644 --- a/Sources/PerfectCURL/CURLResponse.swift +++ b/Sources/PerfectCURL/CURLResponse.swift @@ -200,7 +200,9 @@ extension CURLResponse { } if notDone { curl.ioWait { - self.innerComplete(callback) + Threading.dispatch { + self.innerComplete(callback) + } } } else { postFields = nil From d0a415cc6e3dc776341e464deb77f4167349d95d Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Tue, 19 Nov 2019 08:15:37 -0800 Subject: [PATCH 2/2] Forgot the import --- Sources/PerfectCURL/CURLResponse.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/PerfectCURL/CURLResponse.swift b/Sources/PerfectCURL/CURLResponse.swift index ebb15f9..530b68d 100644 --- a/Sources/PerfectCURL/CURLResponse.swift +++ b/Sources/PerfectCURL/CURLResponse.swift @@ -19,6 +19,7 @@ import cURL import Foundation +import PerfectThread enum ResponseReadState { case status, headers, body