File: push.cgi

package info (click to toggle)
wn 2.0.5-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,208 kB
  • ctags: 1,499
  • sloc: ansic: 14,439; sh: 2,430; perl: 1,360; makefile: 291
file content (25 lines) | stat: -rwxr-xr-x 738 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/local/bin/perl
# This is a sample of the Netscape "server push" feature.  This CGI script
# will only work properly when viewed with a Netscape 1.1 or later browser.

require "ctime.pl";

# This makes i/o non-buffered.  It must be non-buffered for server push
$| = 1;

print "Content-type: multipart/x-mixed-replace; boundary=ThisRandomString\n";

print "\n--ThisRandomString\n";
for (1..4) {
    print "Content-type: text/html\n\n";
    print "<h2>Current time on the server updated every 5 seconds</h2>\n";
    print "<b>Time: ", &ctime( time), "</b>\n";

    close (PS);
    print "\n--ThisRandomString\n";
    sleep (5);
}
    print "Content-type: text/html\n\n";
    print "All done\n";
    print "\n--ThisRandomString--\n";