PSGI / Plack Perl
PSGI / Plack के लिए Perl स्निपेट, जो /pixel.gif पर आने वाली रिक्वेस्ट का जवाब empty GIF से देता है। GIF स्टार्टअप पर एक ही बार डिकोड होता है।
PSGI / Plack Perl
use strict;
use warnings;
use MIME::Base64 qw(decode_base64);
my $gif = decode_base64('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
my $app = sub {
my $env = shift;
return [404, ['Content-Type' => 'text/plain'], ['Not Found']]
unless $env->{REQUEST_METHOD} eq 'GET' && $env->{PATH_INFO} eq '/pixel.gif';
return [
200,
[
'Content-Type' => 'image/gif',
'Content-Length' => length($gif),
'Cache-Control' => 'no-store',
],
[$gif],
];
};
हमने यह स्निपेट चलाया और इसके लौटाए बाइट्स की तुलना की।
जाँचें
curl -sI http://localhost:8080/pixel.gif