From 9e3a93885f988d00e8521533d646c02df9d90bcb Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 28 Sep 2024 15:39:43 +0200 Subject: [PATCH] - simulated a server that send data slowly (but not slow enough to trigger a timeout). --- src/gemini/dummy-server.lisp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gemini/dummy-server.lisp b/src/gemini/dummy-server.lisp index f78c34a..183fe99 100644 --- a/src/gemini/dummy-server.lisp +++ b/src/gemini/dummy-server.lisp @@ -59,6 +59,22 @@ and key stored in the file pointed by the filesystem path request client-cert-fingerprint) (cond + ((cl-ppcre:scan "slow" request) + (format t "slow...~%") + (let ((response (format nil + "~a text/gemini~a~a" + (code gemini-client::+20+) + #\return #\newline))) + (format t "sending: ~a~%" response) + (write-sequence (text-utils:string->octets response) + stream) + (loop for i from 0 below 10000 do + (sleep 1) + (write-sequence (text-utils:string->octets (format nil "~a~%" i)) + stream) + (finish-output stream)) + (close stream) + (get-data))) ((cl-ppcre:scan "timeout" request) (format t "timeout...~%") (sleep 3600))