அனைத்து மொழிகளும் ஃப்ரேம்வொர்க்குகளும்
Dream OCaml
/pixel.gif க்கு வரும் ரெக்வெஸ்ட்களுக்கு empty GIF மூலம் பதிலளிக்கும், Dream க்கான OCaml ஸ்னிப்பெட். GIF ஸ்டார்ட்அப்பில் ஒருமுறை மட்டுமே டீகோட் செய்யப்படுகிறது.
Dream OCaml
(* dune: (executable (name pixel) (libraries dream base64)) *)
let gif = Base64.decode_exn "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
let () =
Dream.run ~interface:"0.0.0.0" ~port:8080
@@ Dream.logger
@@ Dream.router
[
Dream.get "/pixel.gif" (fun _ ->
Dream.respond
~headers:[ ("Content-Type", "image/gif"); ("Cache-Control", "no-store") ]
gif);
]
ஃப்ரேம்வொர்க்கின் தற்போதைய டாக்குமென்டேஷனுடன் ஒப்பிட்டுச் சரிபார்க்கப்பட்டது.
சரிபார்
curl -sI http://localhost:8080/pixel.gif