#!/usr/bin/perl
use v5.12;
use warnings;
$|=1;
my $boundary=join('-','cut','here',$$,time(),rand());
print
"Status: 200 OK\r\n",
"MIME-Version: 1.0\r\n",
"Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n",
"\r\n";
for (1..3) {
my $now=localtime;
my $text1=<<__END_OF_HTML__;
Testing multipart/mixed
Testing multipart/mixed
__END_OF_HTML__
my $text2=<<__END_OF_HTML__;
- Counter
- $_
- Server time
- $now
__END_OF_HTML__
print
"--$boundary\r\n",
"Content-Type: text/html; charset=windows-1252\r\n",
"Content-Length: ",length("$text1$text2"),"\r\n",
"X-My-Counter: $_\r\n",
"\r\n",
$text1;
sleep 1;
print $text2;
sleep 1;
}
print
"--$boundary--\r\n";