Properly handle empty responses - holymoly - A tor enabled gopher client written in CHICKEN scheme
(HTM) git clone git://vernunftzentrum.de/holymoly.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit bd2c6f35b61ce2fa3ad044f44f2613cbd4065f7c
(DIR) parent 952bbbec802d000e6df8e215c476e20abcd27612
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
Date: Fri, 3 Aug 2018 10:28:11 +0200
Properly handle empty responses
Diffstat:
holymoly.scm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/holymoly.scm b/holymoly.scm
@@ -175,9 +175,11 @@
(read-lines i))))
(close-input-port i)
(close-output-port o)
- (if (null? response)
- '("iGot an empty response from server\tfoo\tserver\t70\r\n")
- response)))
+ (cond ((null? response)
+ '("iGot an empty response from server\tfoo\tserver\t70\r\n"))
+ (until-eof? response)
+ ((pair? response) (butlast response))
+ (else (error "Unknown return type of response")))))
(e (exn i/o net)
(endwin)
(new-status "Network error: ~a" ((condition-property-accessor 'exn 'message) e))