emptygif
ਭਾਸ਼ਾ: ਪੰਜਾਬੀ

ਸਾਰੀਆਂ ਭਾਸ਼ਾਵਾਂ ਅਤੇ ਫਰੇਮਵਰਕ

Hunchentoot Common Lisp

Hunchentoot ਲਈ Common Lisp ਸਨਿੱਪਟ, ਜੋ /pixel.gif ਦੀਆਂ ਬੇਨਤੀਆਂ ਦਾ ਜਵਾਬ ਖਾਲੀ GIF ਨਾਲ ਦਿੰਦਾ ਹੈ; GIF ਸ਼ੁਰੂਆਤ ’ਤੇ ਇੱਕ ਵਾਰ ਡੀਕੋਡ ਹੁੰਦੀ ਹੈ।

Hunchentoot Common Lisp

ਇੰਸਟਾਲ
(ql:quickload '(:hunchentoot :cl-base64))
ਫਾਈਲ
server.lisp
ਚਲਾਓ
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))

ਅਸੀਂ ਇਹ ਸਨਿੱਪਟ ਚਲਾਇਆ ਅਤੇ ਇਸ ਵੱਲੋਂ ਵਾਪਸ ਕੀਤੀਆਂ ਬਾਈਟਾਂ ਦੀ ਤੁਲਨਾ ਕੀਤੀ।

ਜਾਂਚੋ

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

ਅਧਿਕਾਰਤ ਸਾਈਟ: Hunchentoot