From 5e8faaf7103aed2a8098880e1f2410961546df21 Mon Sep 17 00:00:00 2001 From: data-man Date: Mon, 14 May 2018 19:13:11 +0300 Subject: [PATCH 1/3] Fixes #2753 --- lib/pure/net.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/net.nim b/lib/pure/net.nim index fc04ef1af4..ce769cb6a6 100644 --- a/lib/pure/net.nim +++ b/lib/pure/net.nim @@ -1148,7 +1148,7 @@ proc waitFor(socket: Socket, waited: var float, timeout, size: int, return 1 let sslPending = SSLPending(socket.sslHandle) if sslPending != 0: - return sslPending + return min(sslPending, size) var startTime = epochTime() let selRet = select(socket, timeout - int(waited * 1000.0)) From 606d8b2f6d0ed4c26d44d2b07b8fef39cabc0b3c Mon Sep 17 00:00:00 2001 From: data-man Date: Tue, 15 May 2018 00:12:44 +0300 Subject: [PATCH 2/3] Added test --- tests/stdlib/thttpclient.nim | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/stdlib/thttpclient.nim b/tests/stdlib/thttpclient.nim index fff02722a9..c28f091003 100644 --- a/tests/stdlib/thttpclient.nim +++ b/tests/stdlib/thttpclient.nim @@ -154,8 +154,20 @@ proc ipv6Test() = serverFd.closeSocket() client.close() +proc longTimeoutTest() = +# Issue #2753 + try: + var client = newHttpClient(timeout = 1000) + var resp = client.request("https://au.yahoo.com") + client.close() + except AssertionError: + doAssert false, "Exceptions should not be raised" + except: + discard + syncTest() waitFor(asyncTest()) ipv6Test() +longTimeoutTest() echo "OK" From 722462ae299775a65f5f8204fac7bc47611568db Mon Sep 17 00:00:00 2001 From: data-man Date: Thu, 7 Jun 2018 01:18:08 +0300 Subject: [PATCH 3/3] Removed test for live website --- tests/stdlib/thttpclient.nim | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/stdlib/thttpclient.nim b/tests/stdlib/thttpclient.nim index c28f091003..fff02722a9 100644 --- a/tests/stdlib/thttpclient.nim +++ b/tests/stdlib/thttpclient.nim @@ -154,20 +154,8 @@ proc ipv6Test() = serverFd.closeSocket() client.close() -proc longTimeoutTest() = -# Issue #2753 - try: - var client = newHttpClient(timeout = 1000) - var resp = client.request("https://au.yahoo.com") - client.close() - except AssertionError: - doAssert false, "Exceptions should not be raised" - except: - discard - syncTest() waitFor(asyncTest()) ipv6Test() -longTimeoutTest() echo "OK"