Hunchentoot Common Lisp
/pixel.gif 요청에 빈 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