📄 index.pl
字号:
#!/usr/bin/perl -I ../../## index.pl a cgi Perl script to be used for testing of OpenCDN# It publish an announcement page in which content origins# are obtained from the RRDM Origin registration informations# Depending on the value of $req = <SetUp|TearDown># it will invoke the SetUp or TearDown XML-RPC method# to be executed on the RRDM entity## The oCDN package is released under the terms of the Perl Artistic Licence# (see http://www.perl.com/pub/a/language/misc/Artistic.html) by their# Copyright Holders, hosted at the University of Roma "La Sapienza",# at http://labtel.ing.uniroma1.it/opencdn#use RPC::XML;use RPC::XML::Client;use etc::CommConf qw($rrdm_addr $rrdm_port);use lib::CommLib qw(node_log);print "Content-type: text/html\n\n";print <<ENDHTML;<html> <head> <title>OpenCDN Request Test Page</title> <meta content=""> <style></style> </head> <body> <table width=\"98%\"> <tbody> <tr> <td width="70%"> <h1>OpenCDN Request Test Page</h1> <p>A Content Delivery Network for Live Streaming to the massess is under development.<br> Would you try if it works for you ? If so, please </p> </td> <td align="center" valign="center"> <table width="85%" cellspacing="8" cellpadding="3" border="1"> <tbody> <tr> <td width="50%" align="center" nowrap> <a href="../help.html">Help</br> </td> <td width="50%" align="center" nowrap> <a href="test.pl">Fake CDN</br> </td> </tr> <tr> <td width="50%" align="center" nowrap> <a href="../rrdm_status.html">Status</a></br> </td> <td width="50%" align="center" nowrap> <a href="http://labtel.ing.uniroma1.it/opencdn">About</br> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <form action="request.pl" method="GET"> <!--<input type="hidden" name="rrdm_port" value=4000>--> <table width="98%" cellspacing="10" cellpadding="1"> <tbody> <tr> <td colspan="2" bgcolor="#99ffff"> select one of these actions: </td> </tr> <tr> <td valign="top" nowrap> <input type="radio" checked name="req" value="SetUp">Service Request </td> <td> Asks to the Request Routing and Distribution Managment to set up distribution (if none exists yet) of the Program selected below, and returns the best surrogate URI, from where you can pick up the content </td> </tr> <tr> <td valign="top" nowrap> <input type="radio" name="req" value="TearDown">Teardown Request </td> <td> Dismantles OpenCDN distribution for the given Program. </td> </tr> <tr> <td colspan="2" bgcolor="#99ffff"> then, choose the Program Source: </td> </tr> <tr> <td align="center"> <select name="program">ENDHTML# Queryes RRDM for a list of available contents - only 6 secs timeout!$cli = RPC::XML::Client->new("http://$rrdm_addr:$rrdm_port", 'useragent', ['timeout', 3]);$risp = $cli -> simple_request('Status', 'origin'); if ((keys %{$risp})) { my $prog, $tag, $transport, $ip, $port, $desc; foreach $prog (sort keys %$risp) { $tag = ${$risp}{$prog}{'tag'}; if ($prog && $tag) { print "<option value=\"$prog\" label=\"$tag\">$tag</option>", "\n"; } else { # due to apache ownership privilegs of cgi, the following will work # only if $log_to has been set to 'syslog' in etc/CommConf.pm CommLib::node_log ("Empty program/tag detected :((", 1, 'p'); } } } else { print "<option value=\"no program\" label=\"no program\">no content available</option>", "\n"; }print <<ENDHTML; </select> </td> <td> More informations about the contents available can be found in the <a href="rrdm_status.pl?req=origin">Origin Status</a> page </td> </tr> <tr> <td colspan="2" bgcolor="#99ffff"> and finally start the game ! </td> </tr> <tr> <td align="center"> <input type="submit"> </td> <td> <!--<input type="hidden" name="is_forked" value="on"> (check this <input type="checkbox" checked name="is_forked" value="on"> if a forked RRDM is in use)--> </td> </tr> </tbody> </table> <hr> <i>Version 0.7.1 - Comments to <a href="mailto:alef\@infocom.uniroma1.it?subject=Open CDN">alef\@infocom.uniroma1.it</a></i> </form> <br><br><br><br><br><br><br><br> </body></html>ENDHTMLexit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -