Hunchentoot Common Lisp
/pixel.gif కు వచ్చే రిక్వెస్ట్లకు empty GIF తో జవాబిచ్చే, Hunchentoot కోసం Common Lisp స్నిపెట్. GIF స్టార్టప్లో ఒక్కసారే డీకోడ్ అవుతుంది.
Hunchentoot Common Lisp
(ql:quickload '(:hunchentoot :cl-base64))
(defparameter *gif*
(cl-base64:base64-string-to-usb8-array "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="))
(hunchentoot:define-easy-handler (pixel :uri "/pixel.gif") ()
(setf (hunchentoot:content-type*) "image/gif"
(hunchentoot:header-out :cache-control) "no-store")
*gif*)
(hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 8080))
మేము ఈ స్నిపెట్ను రన్ చేసి, అది తిరిగి ఇచ్చిన బైట్లను పోల్చి చూశాం.
చెక్ చేయండి
curl -sI http://localhost:8080/pixel.gif