emptygif
Idioma: Español

Todos los lenguajes y frameworks

Hunchentoot Common Lisp

Un fragmento en Common Lisp para Hunchentoot que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.

Hunchentoot Common Lisp

Instalar
(ql:quickload '(:hunchentoot :cl-base64))
Archivo
server.lisp
Ejecutar
sbcl --load server.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))

Ejecutamos este fragmento y comparamos los bytes que devolvió.

Comprobar

curl -sI http://localhost:8080/pixel.gif

Sitio oficial: Hunchentoot