draft-ietf-urn-ietf-07.txt   draft-ietf-urn-ietf-08.txt 
Internet-Draft Ryan Moats Internet-Draft Ryan Moats
draft-ietf-urn-ietf-07.txt AT&T draft-ietf-urn-ietf-08.txt AT&T
Expires in six months October 1998 Expires in six months November 1998
A URN Namespace for IETF Documents A URN Namespace for IETF Documents
Filename: draft-ietf-urn-ietf-07.txt Filename: draft-ietf-urn-ietf-08.txt
Status of This Memo Status of This Memo
This document is an Internet-Draft. Internet-Drafts are working This document is an Internet-Draft and is in full conformance with
documents of the Internet Engineering Task Force (IETF), its all provisions of Section 10 of RFC2026.
areas, and its working groups. Note that other groups may also
distribute working documents as Internet-Drafts. Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that
other groups may also distribute working documents as Internet-
Drafts.
Internet-Drafts are draft documents valid for a maximum of six Internet-Drafts are draft documents valid for a maximum of six
months and may be updated, replaced, or obsoleted by other months and may be updated, replaced, or obsoleted by other
documents at any time. It is inappropriate to use Internet- documents at any time. It is inappropriate to use Internet-
Drafts as reference material or to cite them other than as ``work Drafts as reference material or to cite them other than as ``work
in progress.'' in progress.''
The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt
The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html.
To learn the current status of any Internet-Draft, please check To learn the current status of any Internet-Draft, please check
the ``1id-abstracts.txt'' listing contained in the Internet- the ``1id-abstracts.txt'' listing contained in the Internet-
Drafts Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net Drafts Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net
(Europe), munnari.oz.au (Pacific Rim), ftp.ietf.org (US East (Europe), munnari.oz.au (Pacific Rim), ftp.ietf.org (US East
Coast), or ftp.isi.edu (US West Coast). Coast), or ftp.isi.edu (US West Coast).
Abstract Abstract
A system for Uniform Resource Names (URNs) must be capable of A system for Uniform Resource Names (URNs) must be capable of
supporting new naming systems. As an example of proposing a new supporting new naming systems. As an example of proposing a new
namespace, this document proposes the 'ietf' namespace. This namespace, this document proposes the "ietf" namespace. This
namespace consists of the RFC family of documents (RFCs, STDs, FYIs, namespace consists of the RFC family of documents (RFCs, STDs, FYIs,
and BCPs) developed by the IETF and published by the RFC Editor, the and BCPs) developed by the IETF and published by the RFC Editor, the
minutes of working groups (WG) and birds of a feather (BOF) meetings minutes of working groups (WG) and birds of a feather (BOF) meetings
that occur during IETF conferences, and the Internet Drafts published that occur during IETF conferences, and the Internet Drafts published
by the Internet Drafts Editor. Both the current URN framework and by the Internet Drafts Editor. Both the current URN framework and
URN syntax support this namespace. URN syntax support this namespace.
0.1 Changes from -02
This document has been restructured to use the template proposed in
draft-ietf-urn-nid-req-03.txt. Example Perl scripts for resolving
this namespace have been supplied in an Appendix.
0.2 Changes from -03
Text was added to the template clarifying persistence and uniqueness.
Support for the BCP document series added to the examples and the
ABNF.
0.3 Changes from -04
More clarifications for the persistence section. In addition,
cleaned up some typos and ensured that the Appendix examples are
functional
0.4 Changes from -05
Based on a number of requests, i-ds have been added to the structure
and resolvers. In addition, some examples have been added.
0.4 Changes from -06
Some changes of the template to conform with draft-ietf-urn-nid-req-
06.txt. Minor editing of some of the sections for more clarity.
1. Introduction 1. Introduction
This document proposes the "ietf" namespace, which consists of the This document proposes the "ietf" namespace, which consists of the
RFC family of documents (RFCs, STDs, FYIs, and BCPs) developed by the RFC family of documents (RFCs, STDs, FYIs, and BCPs) developed by the
IETF and published by the RFC editor and the minutes of working IETF and published by the RFC editor and the minutes of working
groups (WG) and birds of a feather (BOF) meetings that occur during groups (WG) and birds of a feather (BOF) meetings that occur during
IETF conferences. IETF conferences.
The namespace specification is for a formal namespace. The namespace specification is for a formal namespace.
2. Specification Template 2. Specification Template
Namespace ID: Namespace ID:
"ietf" requested. "ietf" requested.
Registration Information: Registration Information:
Registration version number: 1 Registration version number: 1
Registration date: 1998-10-09 Registration date: 1999-04-22
Declared registrant of the namespace: Declared registrant of the namespace:
Ryan Moats Ryan Moats
jayhawk@att.com jayhawk@att.com
AT&T
15621 Drexel Circle
Omaha, NE 68135-2358
Declaration of structure: Declaration of structure:
The identifier has the following ABNF [2] specification: The identifier has the following ABNF [2] specification:
NSS = (family ":" number) / ("mtg-" number "-" wgbofname) NSS = (family ":" number) / ("mtg-" number "-" wgbofname)
( "id:" name) ( "id:" name)
family = "rfc" / "std" / "fyi" / "bcp" family = "rfc" / "std" / "fyi" / "bcp"
number = 1*DIGIT number = 1*DIGIT
wgbofname = 1*LETDIGIT wgbofname = 1*(DIGIT/ALPHA)
name = id draft name beginning with "draft-" and trailing name = "draft-" draft-name "-" draft-version
type removed (e.g. ietf-urn-ietf-06)
LETDIGIT = DIGIT / %x41-%x5a / %x61-%x7a draft-name = draft-ietf / draft-individual / draft-rfced
DIGIT = %x30-%x39 draft-ietf = "ietf-" wgbofname "-" draft-title
draft-individual = draft-author "-" draft-title
draft-rfced = "rfced-" draft-title
draft-title = draft-namepart *( "-" draft-namepart )
draft-author = 1*(DIGIT/ALPHA)
draft-nameart = 1*(DIGIT/ALPHA)
wgbofname = 1*(DIGIT/ALPHA)
number = 1*DIGIT
draft-version = 2*DIGIT
If the IESG (or it successor) adds a new document If the IESG (or it successor) adds a new document
series, this ABNF specification will need to be series, this ABNF specification will need to be
updated. Further, if a working group or BOF is updated. Further, if a working group or BOF is
created that used characters outside the range of this created that used characters outside the range of this
ABNF specification, this specification will need to be ABNF specification, this specification will need to be
updated. Any system intended to resolve names for updated. Any system intended to resolve names for
this namespace should be written with the awareness this namespace should be written with the awareness
that this could occur at any time. that this could occur at any time.
Relevant ancillary documentation:
The intended RFC document is currently
draft-ietf-urn-ietf-08.
Identifier uniqueness considerations: Identifier uniqueness considerations:
Because the rfc-editor assigns the RFC number uniquely Because the rfc-editor assigns the RFC number uniquely
these URNs are unique. Since the mapping between RFCs these URNs are unique. Since the mapping between RFCs
and other rfc-editor document series (STDs, FYIs or and other rfc-editor document series (STDs, FYIs or
BCPs) is not necessarily one-to-one, uniqueness of BCPs) is not necessarily one-to-one, uniqueness of
STDs, FYIs and BCPs are defined based on the document STDs, FYIs and BCPs are defined based on the document
mappings maintained by the RFC Editor (the index files mappings maintained by the RFC Editor (the index files
"rfc-index.txt", "fyi-index.txt", "bcp-index.txt", "rfc-index.txt", "fyi-index.txt", "bcp-index.txt",
"std-index.txt") are defined to be the definitive "std-index.txt") are defined to be the definitive
skipping to change at page 5, line 13 skipping to change at page 4, line 50
Rules for Lexical Equivalence: Rules for Lexical Equivalence:
The entire URN is case-insensitive. The entire URN is case-insensitive.
Conformance with URN Syntax: Conformance with URN Syntax:
There are no additional characters reserved. There are no additional characters reserved.
Validation mechanism: Validation mechanism:
None specified. None additional to resolution specified
Scope: Scope:
Global. Global.
3. Examples 3. Examples
The following are examples of URNs that a resolver for this namespace The following are examples of URNs that a resolver for this namespace
can resolve: can resolve:
urn:ietf:rfc:2141 urn:ietf:rfc:2141
urn:ietf:std:50 urn:ietf:std:50
urn:ietf:id:ietf-urn-ietf-06.txt urn:ietf:id:ietf-urn-ietf-06
urn:ietf:mtg-41-urn urn:ietf:mtg-41-urn
4. Security Considerations 4. Security Considerations
Because this namespace defines no additional reserved characters, it Because this namespace defines no additional reserved characters, it
does not add any security considerations beyond those inherent from does not add any security considerations beyond those inherent from
the existence of the reserved characters from [1]. Further, none of the existence of the reserved characters from [1]. Further, none of
the reserved characters from [1] are used in the definition of the the reserved characters from [1] are used in the definition of the
NSS. This means that resolvers for this namespace may be considered NSS. This means that resolvers for this namespace may be considered
"secure" in the sense that any escaping of characters in the NSS MUST "secure" in the sense that any escaping of characters in the NSS MUST
skipping to change at page 5, line 49 skipping to change at page 5, line 37
5. Acknowledgments 5. Acknowledgments
Thanks to various members of the URN working group for comments on Thanks to various members of the URN working group for comments on
earlier drafts of this document. The work described in this document earlier drafts of this document. The work described in this document
is partially supported by the National Science Foundation, is partially supported by the National Science Foundation,
Cooperative Agreement NCR-9218179. Cooperative Agreement NCR-9218179.
6. References 6. References
Request For Comments (RFC) and Internet Draft documents are available Request For Comments (RFC) and Internet Draft documents are available
from <URL:ftp://ftp.internic.net> and numerous mirror sites. from numerous mirror sites.
[1] R. Moats, "URN Syntax," RFC 2141, May 5, 1997. [1] R. Moats, "URN Syntax," RFC 2141, May 5, 1997.
[2] D. Crocker, P. Overell, "Augmented BNF for Syntax [2] D. Crocker, P. Overell, "Augmented BNF for Syntax
Specifications: ABNF," RFC 2234, November 1997. Specifications: ABNF," RFC 2234, November 1997.
7. Author's Address 7. Author's Address
Ryan Moats Ryan Moats
AT&T AT&T
skipping to change at page 6, line 42 skipping to change at page 6, line 29
# #
my(%cite) = ( my(%cite) = (
bcp => "/ftp/rfc/bcp-index.txt", bcp => "/ftp/rfc/bcp-index.txt",
fyi => "/ftp/fyi/fyi-index.txt", fyi => "/ftp/fyi/fyi-index.txt",
id => "/ftp/internet-drafts/1id-abstracts.txt", id => "/ftp/internet-drafts/1id-abstracts.txt",
rfc => "/ftp/rfc/rfc-index.txt", rfc => "/ftp/rfc/rfc-index.txt",
std => "/ftp/std/std-index.txt" std => "/ftp/std/std-index.txt"
); );
my(%number2date) = ( my(%number2date) = (
41 => "98apr", 44 => "99mar",
43 => "98dec", 42 => "98aug", 41 => "98apr",
40 => "97dec", 39 => "97aug", 38 => "97apr", 40 => "97dec", 39 => "97aug", 38 => "97apr",
37 => "96dec", 36 => "96jun", 35 => "96mar", 37 => "96dec", 36 => "96jun", 35 => "96mar",
34 => "95dec", 33 => "95jul", 32 => "95apr", 34 => "95dec", 33 => "95jul", 32 => "95apr",
31 => "94dec", 30 => "94jul", 29 => "94mar", 31 => "94dec", 30 => "94jul", 29 => "94mar",
28 => "93nov", 27 => "93jul", 26 => "93mar", 28 => "93nov", 27 => "93jul", 26 => "93mar",
25 => "92nov", 24 => "92jul", 23 => "92mar", 25 => "92nov", 24 => "92jul", 23 => "92mar",
22 => "91nov", 21 => "91jul", 20 => "91mar", 22 => "91nov", 21 => "91jul", 20 => "91mar",
19 => "90dec" ); 19 => "90dec" );
my($wgpath) = "/ftp/ietf"; my($wgpath) = "/ftp/ietf";
skipping to change at page 7, line 4 skipping to change at page 6, line 41
40 => "97dec", 39 => "97aug", 38 => "97apr", 40 => "97dec", 39 => "97aug", 38 => "97apr",
37 => "96dec", 36 => "96jun", 35 => "96mar", 37 => "96dec", 36 => "96jun", 35 => "96mar",
34 => "95dec", 33 => "95jul", 32 => "95apr", 34 => "95dec", 33 => "95jul", 32 => "95apr",
31 => "94dec", 30 => "94jul", 29 => "94mar", 31 => "94dec", 30 => "94jul", 29 => "94mar",
28 => "93nov", 27 => "93jul", 26 => "93mar", 28 => "93nov", 27 => "93jul", 26 => "93mar",
25 => "92nov", 24 => "92jul", 23 => "92mar", 25 => "92nov", 24 => "92jul", 23 => "92mar",
22 => "91nov", 21 => "91jul", 20 => "91mar", 22 => "91nov", 21 => "91jul", 20 => "91mar",
19 => "90dec" ); 19 => "90dec" );
my($wgpath) = "/ftp/ietf"; my($wgpath) = "/ftp/ietf";
my($urn) = $ENV{'QUERY_STRING'}; my($urn) = $ENV{'QUERY_STRING'};
my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
(&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(i); (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
(&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(72)/i); (&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
(&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(9*)-( (&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i);
120&urn_error("400 Bad Request0); &urn_error("400 Bad Request\n");
sub resolvemtg { sub resolvemtg {
my($ietfnum, $sesnam) = @_; my($ietfnum, $sesnam) = @_;
&urn_error("404 Not Found0) if (!defined $number2date{$ietfnum}); &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
my($date)=$number2date{$ietfnum}; my($date)=$number2date{$ietfnum};
my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
print "Status: 200 OK70; print "Status: 200 OK\r\n";
print "Content-type: text/html70; print "Content-type: text/html\r\n\r\n";
print "<HTML>0TITLE>Citation for $urn</TITLE>0; print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
print "<BODY>0; print "<BODY>\n";
print "<H1><A HREF= print "<H1><A HREF=\"$link\">$urn</A>:</H1>\n";
print "Minutes of the $sesnam working group from the " . &end($ietfnum) print "Minutes of the $sesnam working group from the " . &end($ietfnum)
. " IETF"; . " IETF";
print "</BODY>0/HTML>0; print "</BODY>\n</HTML>\n";
return; return;
} }
my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
print "Status: 200 OK70; print "Status: 200 OK\r\n";
print "Content-type: text/html70; print "Content-type: text/html\r\n\r\n";
print "<HTML>0TITLE>Citation for $urn</TITLE>0; print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
print "<BODY>0; print "<BODY>\n";
print "<H1><A HREF= print "<H1><A HREF=\"$link\">$urn</A>:</H1>\n";
print "Minutes of the $sesnam working group from the " . &end($ietfnum) print "Minutes of the $sesnam working group from the " . &end($ietfnum)
. " IETF"; . " IETF";
print "</BODY>0/HTML>0; print "</BODY>\n</HTML>\n";
return; return;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
sub end { sub end {
my($inarg)=@_; my($inarg)=@_;
return $inarg . "st" if ($inarg =~ /1$/); return $inarg . "st" if ($inarg =~ /1$/);
return $inarg . "nd" if ($inarg =~ /2$/); return $inarg . "nd" if ($inarg =~ /2$/);
return $inarg . "rd" if ($inarg =~ /3$/); return $inarg . "rd" if ($inarg =~ /3$/);
return $inarg . "th"; return $inarg . "th";
} }
sub resolverfc { sub resolverfc {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($scheme, $value) = @_; my($scheme, $value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
if (!defined $cite{$scheme}) { if (!defined $cite{$scheme}) {
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
$flag = 0; $flag = 0;
open(INPUT, "$cite{$scheme}"); open(INPUT, "$cite{$scheme}");
while (<INPUT>) { while (<INPUT>) {
$flag = 1 if (/^0*$value /); $flag = 1 if (/^0*$value /);
if ($flag == 1) { if ($flag == 1) {
last if (/^$/); last if (/^$/);
chop; chop;
push @bib,$_; push @bib,$_;
} }
} }
if ($scheme ne "rfc") { if ($scheme ne "rfc") {
print "Status: 200 OK70; print "Status: 200 OK\r\n";
print "Content-type: text/html70; print "Content-type: text/html\r\n\r\n";
$bib[0] =~ s/^[0-9]*/<B>/; $bib[0] =~ s/^[0-9]*\s*/<B>/;
for ($i=0; $i<=$#bib; $i+=1) { for ($i=0; $i<=$#bib; $i+=1) {
last if ($bib[$i] =~ s/./.</B>/); last if ($bib[$i] =~ s/\./.<\/B>/);
} }
for ($i=0;$i<=$#bib;$i+=1) { for ($i=0;$i<=$#bib;$i+=1) {
$k=$bib[$i]; $k=$bib[$i];
while ($k =~ /(fyi|std|rfc|bcp)([0-9]+)(.*)/i) { while ($k =~ /(fyi|std|rfc|bcp)([0-9]+)(.*)/i) {
push @ref,"$1$2"; push @ref,"$1$2";
$k=$3; $k=$3;
} }
$done=""; $done="";
foreach $j (@ref) { foreach $j (@ref) {
next if ($done =~ $j); next if ($done =~ $j);
$done .= "$j "; $done .= "$j ";
$l = $j; $l = $j;
$l =~ tr/A-Z/a-z/; $l =~ tr/A-Z/a-z/;
$link=&make_link("$l"); $link=&make_link("$l");
$bib[$i] =~ s/$j/<A HREF="$link">$j</A>/g; $bib[$i] =~ s/$j/<A HREF="$link">$j<\/A>/g;
} }
} }
print "<HTML>0TITLE>Citation for $urn</TITLE>0; print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
print "<BODY>0; print "<BODY>\n";
$link=&make_link("$scheme$value"); $link=&make_link("$scheme$value");
print "<H1><A HREF= print "<H1><A HREF=\"$link\">$scheme$value</A>:</H1>\n";
foreach $i (@bib) { foreach $i (@bib) {
print "$i0; print "$i\n";
} }
print "</BODY>0/HTML>0; print "</BODY>\n</HTML>\n";
} else { } else {
print "Status: 200 OK70; print "Status: 200 OK\r\n";
print "Content-type: text/html70; print "Content-type: text/html\r\n\r\n";
$bib[0] =~ s/^[0-9]*//; $bib[0] =~ s/^[0-9]*\s*//;
$j=0; $j=0;
for ($i=0; $i<=$#bib; $i+=1) { for ($i=0; $i<=$#bib; $i+=1) {
$j += ($bib[$i] =~ s/, "/, <B>"/); $j += ($bib[$i] =~ s/, "/, <B>"/);
$j += ($bib[$i] =~ s/",/"</B>,/); $j += ($bib[$i] =~ s/",/"<\/B>,/);
} }
for ($i=0;$i<=$#bib;$i+=1) { for ($i=0;$i<=$#bib;$i+=1) {
$k=$bib[$i]; $k=$bib[$i];
while ($k =~ /(fyistdrfc|bcp)([0-9]+)(.*)/i) { while ($k =~ /(fyi\s|std\s|rfc|bcp)([0-9]+)(.*)/i) {
push @ref,"$1$2"; push @ref,"$1$2";
$k=$3; $k=$3;
} }
$done=""; $done="";
foreach $j (@ref) { foreach $j (@ref) {
next if ($done =~ $j); next if ($done =~ $j);
$done .= "$j "; $done .= "$j ";
$l = $j; $l = $j;
$l =~ s//g; $l =~ s/\s//g;
$l =~ tr/A-Z/a-z/; $l =~ tr/A-Z/a-z/;
$link=&make_link("$l"); $link=&make_link("$l");
$bib[$i] =~ s/$j/<A HREF="$link">$j</A>/g; $bib[$i] =~ s/$j/<A HREF="$link">$j<\/A>/g;
} }
} }
print "<HTML>0TITLE>Citation for $urn</TITLE>0; print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
print "<BODY>0; print "<BODY>\n";
$link=&make_link("$scheme$value"); $link=&make_link("$scheme$value");
print "<H1><A HREF= print "<H1><A HREF=\"$link\">$scheme$value</A>:</H1>\n";
foreach $i (@bib) { foreach $i (@bib) {
print "$i0; print "$i\n";
} }
print "</BODY>0/HTML>0; print "</BODY>\n</HTML>\n";
} }
} }
sub make_link { sub make_link {
my($sc); my($sc);
my($inarg)=@_; my($inarg)=@_;
($sc=$1) if ($inarg =~ /([a-z]*)/); ($sc=$1) if ($inarg =~ /([a-z]*)/);
return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps"); return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps");
return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html"); return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html");
return "/$sc/$inarg.txt"; return "/$sc/$inarg.txt";
} }
sub urn_error { sub urn_error {
my($code) = @_; #store failure code here... my($code) = @_; #store failure code here...
print "Status: $code"; print "Status: $code";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2C $code</title></head>0; print "<head><title>URN Resolution: I2C $code</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN to URC resolution failed for the URN:</h1>0; print "<h1>URN to URC resolution failed for the URN:</h1>\n";
print "<hr><h3>$urn</h3>0; print "<hr><h3>$urn</h3>\n";
print "</body>0; print "</body>\n";
print "</html>0; print "</html>\n";
exit; exit;
}; };
sub resolveid { sub resolveid {
my($flag,@bib,$i,$k,$j,$count,@ref); my($flag,@bib,$i,$k,$j,$count,@ref);
my($l,$link, $hdr, $done); my($l,$link, $hdr, $done);
my($value) = @_; my($value) = @_;
my($scheme) = "id"; my($scheme) = "id";
open(INPUT, "$cite{$scheme}"); open(INPUT, "$cite{$scheme}");
while (<INPUT>) { while (<INPUT>) {
skipping to change at page 10, line 28 skipping to change at page 10, line 18
my($flag,@bib,$i,$k,$j,$count,@ref); my($flag,@bib,$i,$k,$j,$count,@ref);
my($l,$link, $hdr, $done); my($l,$link, $hdr, $done);
my($value) = @_; my($value) = @_;
my($scheme) = "id"; my($scheme) = "id";
open(INPUT, "$cite{$scheme}"); open(INPUT, "$cite{$scheme}");
while (<INPUT>) { while (<INPUT>) {
# #
# capture record # capture record
# #
if ($flag == 1 || /^ if ($flag == 1 || /^\s+\"/) {
push @bib,$_; push @bib,$_;
($hdr = -1, $count = 0, $flag = 1) if (/^ ($hdr = -1, $count = 0, $flag = 1) if (/^\s+\"/);
$count++ if (/^/); $count++ if (/^\s+$/);
} }
if ($count == 1) { if ($count == 1) {
$hdr = $#bib if ($hdr == -1); $hdr = $#bib if ($hdr == -1);
} }
if ($count == 2) { if ($count == 2) {
for ($i=0; $i<=$hdr; $i+=1) { for ($i=0; $i<=$hdr; $i+=1) {
if ($bib[$i] =~ /<(.*)>/) { if ($bib[$i] =~ /<(.*)>/) {
$l = $1; $l = $1;
if ($l eq "draft-$value.txt" || $l eq "draft-$value.ps") { if ($l eq "draft-$value.txt" || $l eq "draft-$value.ps") {
print "Status: 200 OK70; print "Status: 200 OK\r\n";
print "Content-type: text/html70; print "Content-type: text/html\r\n\r\n";
print "<HTML>0TITLE>Citation for $urn</TITLE>0; print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
print "<BODY>0; print "<BODY>\n";
print "<a href= print "<a
print "<pre>0; href=\"http://blackhole.vip.att.net/internet-drafts/$l\">$l</a>:\n";
print "<pre>\n";
foreach $i (@bib) { foreach $i (@bib) {
print "$i"; print "$i";
} }
print "</pre>0; print "</pre>\n";
print "</BODY>0/HTML>0; print "</BODY>\n</HTML>\n";
exit; exit;
} }
} }
} }
$flag = 0; $flag = 0;
@bib = (); @bib = ();
} }
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
A.2 I2L A.2 I2L
#!/usr/local/bin/perl #!/usr/local/bin/perl
use strict; use strict;
# #
# this is a URN 2 URL resolver for the ietf namespace # this is a URN 2 URL resolver for the ietf namespace
# #
my(%pathbase) = ( my(%pathbase) = (
rfc => "rfc/rfc", rfc => "rfc/rfc",
fyi => "fyi/fyi", fyi => "fyi/fyi",
std => "std/std", std => "std/std",
bcp => "bcp/bcp", bcp => "bcp/bcp",
id => "internet-drafts/draft-", id => "internet-drafts/draft-"
); );
my(%number2date) = ( my(%number2date) = (
41 => "98apr", 44 => "99mar",
43 => "98dec", 42 => "98aug", 41 => "98apr",
40 => "97dec", 39 => "97aug", 38 => "97apr", 40 => "97dec", 39 => "97aug", 38 => "97apr",
37 => "96dec", 36 => "96jun", 35 => "96mar", 37 => "96dec", 36 => "96jun", 35 => "96mar",
34 => "95dec", 33 => "95jul", 32 => "95apr", 34 => "95dec", 33 => "95jul", 32 => "95apr",
31 => "94dec", 30 => "94jul", 29 => "94mar", 31 => "94dec", 30 => "94jul", 29 => "94mar",
28 => "93nov", 27 => "93jul", 26 => "93mar", 28 => "93nov", 27 => "93jul", 26 => "93mar",
25 => "92nov", 24 => "92jul", 23 => "92mar", 25 => "92nov", 24 => "92jul", 23 => "92mar",
22 => "91nov", 21 => "91jul", 20 => "91mar", 22 => "91nov", 21 => "91jul", 20 => "91mar",
19 => "90dec" ); 19 => "90dec" );
my($wgpath) = "/ftp/ietf"; my($wgpath) = "/ftp/ietf";
my($urn) = $ENV{'QUERY_STRING'}; my($urn) = $ENV{'QUERY_STRING'};
my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
(&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(i); (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
(&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(72)/i); (&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
(&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(9*)-( (&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i);
&urn_error("400 Bad Request\n");
120&urn_error("400 Bad Request0);
sub resolvemtg { sub resolvemtg {
my($ietfnum, $sesnam) = @_; my($ietfnum, $sesnam) = @_;
&urn_error("404 Not Found0) if (!defined $number2date{$ietfnum}); &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
my($date)=$number2date{$ietfnum}; my($date)=$number2date{$ietfnum};
my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: $link0; print "Location: $link\n";
return; return;
} }
my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: $link0; print "Location: $link\n";
return; return;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
sub end { sub end {
my($inarg)=@_; my($inarg)=@_;
return $inarg . "st" if ($inarg =~ /1$/); return $inarg . "st" if ($inarg =~ /1$/);
return $inarg . "nd" if ($inarg =~ /2$/); return $inarg . "nd" if ($inarg =~ /2$/);
return $inarg . "rd" if ($inarg =~ /3$/); return $inarg . "rd" if ($inarg =~ /3$/);
return $inarg . "th"; return $inarg . "th";
} }
sub resolverfc { sub resolverfc {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($scheme, $value) = @_; my($scheme, $value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
MIME_SWITCH: { MIME_SWITCH: {
if ($accept =~ /application/postscript/ && -f $pstry) { if ($accept =~ /application\/postscript/ && -f $pstry) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: http://$host/$pathbase{$scheme}$value.ps0; print "Location: http://$host/$pathbase{$scheme}$value.ps\n\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/html/ && -f $htmltry) { if ($accept =~ /text\/html/ && -f $htmltry) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: http://$host/$pathbase{$scheme}$value.html0; print "Location: http://$host/$pathbase{$scheme}$value.html\n\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/plain/ && -f $txttry) { if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: http://$host/$pathbase{$scheme}$value.txt0; print "Location: http://$host/$pathbase{$scheme}$value.txt\n\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
} }
sub urn_error { sub urn_error {
my($code) = @_; #store failure code here... my($code) = @_; #store failure code here...
print "Status: $code"; print "Status: $code";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2L $code</title></head>0; print "<head><title>URN Resolution: I2L $code</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN to URL resolution failed for the URN:</h1>0; print "<h1>URN to URL resolution failed for the URN:</h1>\n";
print "<hr><h3>$urn</h3>0; print "<hr><h3>$urn</h3>\n";
print "</body>0; print "</body>\n";
print "</html>0; print "</html>\n";
exit; exit;
} }
sub resolveid { sub resolveid {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($scheme) = "id"; my($scheme) = "id";
my($value) = @_; my($value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
MIME_SWITCH: { MIME_SWITCH: {
if ($accept =~ /application/postscript/ && -f $pstry) { if ($accept =~ /application\/postscript/ && -f $pstry) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: http://$host/$pathbase{$scheme}$value.ps0; print "Location: http://$host/$pathbase{$scheme}$value.ps\n\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/html/ && -f $htmltry) { if ($accept =~ /text\/html/ && -f $htmltry) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: http://$host/$pathbase{$scheme}$value.html0; print "Location: http://$host/$pathbase{$scheme}$value.html\n\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/plain/ && -f $txttry) { if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
print "Status: 302 Moved temporarily0; print "Status: 302 Moved temporarily\n";
print "Location: http://$host/$pathbase{$scheme}$value.txt0; print "Location: http://$host/$pathbase{$scheme}$value.txt\n\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
} }
A.3 I2Ls A.3 I2Ls
#!/usr/local/bin/perl #!/usr/local/bin/perl
use strict; use strict;
# #
skipping to change at page 14, line 31 skipping to change at page 14, line 22
my(%pathbase) = ( my(%pathbase) = (
rfc => "rfc/rfc", rfc => "rfc/rfc",
fyi => "fyi/fyi", fyi => "fyi/fyi",
std => "std/std", std => "std/std",
bcp => "bcp/bcp", bcp => "bcp/bcp",
id => "internet-drafts/draft-" id => "internet-drafts/draft-"
); );
my(%number2date) = ( my(%number2date) = (
41 => "98apr", 44 => "99mar",
43 => "98dec", 42 => "98aug", 41 => "98apr",
40 => "97dec", 39 => "97aug", 38 => "97apr", 40 => "97dec", 39 => "97aug", 38 => "97apr",
37 => "96dec", 36 => "96jun", 35 => "96mar", 37 => "96dec", 36 => "96jun", 35 => "96mar",
34 => "95dec", 33 => "95jul", 32 => "95apr", 34 => "95dec", 33 => "95jul", 32 => "95apr",
31 => "94dec", 30 => "94jul", 29 => "94mar", 31 => "94dec", 30 => "94jul", 29 => "94mar",
28 => "93nov", 27 => "93jul", 26 => "93mar", 28 => "93nov", 27 => "93jul", 26 => "93mar",
25 => "92nov", 24 => "92jul", 23 => "92mar", 25 => "92nov", 24 => "92jul", 23 => "92mar",
22 => "91nov", 21 => "91jul", 20 => "91mar", 22 => "91nov", 21 => "91jul", 20 => "91mar",
19 => "90dec" ); 19 => "90dec" );
my($wgpath) = "/ftp/ietf"; my($wgpath) = "/ftp/ietf";
my($urn) = $ENV{'QUERY_STRING'}; my($urn) = $ENV{'QUERY_STRING'};
my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
(&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(i); (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
(&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(72)/i); (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
(&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(9*)-( (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i);
120&urn_error("400 Bad Request0); &urn_error("400 Bad Request\n");
sub resolve2 { sub resolve2 {
my($ietfnum, $sesnam) = @_; my($ietfnum, $sesnam) = @_;
&urn_error("404 Not Found0) if (!defined $number2date{$ietfnum}); &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
my($date)=$number2date{$ietfnum}; my($date)=$number2date{$ietfnum};
my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
$link=~s/^/ftp///; $link=~s/^\/ftp\///;
my($ftplink)="ftp://$host/$link"; my($ftplink)="ftp://$host/$link";
my($httplink)="http://$host/$link"; my($httplink)="http://$host/$link";
my($glink)="gopher://$host:70/0/$link"; my($glink)="gopher://$host:70/0/$link";
if ($accept =~ /text/uri-list/) { #look for text/uri-list, otherwise if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise
text/html text/html
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/uri-list0; print "Content-type: text/uri-list\n\n\n";
print "#$urn0; print "#$urn\n";
print "$ftplink0; print "$ftplink\n";
print "$httplink0; print "$httplink\n";
print "$glink0; print "$glink\n";
} }
if ($accept =~ /text/html/) { if ($accept =~ /\*\/\*|text\/html/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ls</title></head>0; print "<head><title>URN Resolution: I2Ls</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN $urn resolves to the following URLs:</h1>0; print "<h1>URN $urn resolves to the following URLs:</h1>\n";
print "<hr><ul>0; print "<hr><ul>\n";
print "<a href= print "<a href=\"$ftplink\">$ftplink</a>\n";
print "<a href= print "<a href=\"$httplink\">$httplink</a>\n";
print "<a href= print "<a href=\"$glink\">$glink</a>\n";
print "</UL>0/body>0/HTML>0; print "</UL>\n</body>\n</HTML>\n";
} }
return; return;
} }
my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
$link=~s/^/ftp///; $link=~s/^\/ftp\///;
my($ftplink)="ftp://$host/$link"; my($ftplink)="ftp://$host/$link";
my($httplink)="http://$host/$link"; my($httplink)="http://$host/$link";
my($glink)="gopher://$host:70/0/$link"; my($glink)="gopher://$host:70/0/$link";
if ($accept =~ /text/uri-list/) { #look for text/uri-list, otherwise if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise
text/html text/html
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/uri-list0; print "Content-type: text/uri-list\n\n\n";
print "#$urn0; print "#$urn\n";
print "$ftplink0; print "$ftplink\n";
print "$httplink0; print "$httplink\n";
print "$glink0; print "$glink\n";
} }
if ($accept =~ /text/html/) { if ($accept =~ /\*\/\*|text\/html/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ls</title></head>0; print "<head><title>URN Resolution: I2Ls</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN $urn resolves to the following URLs:</h1>0; print "<h1>URN $urn resolves to the following URLs:</h1>\n";
print "<hr><ul>0; print "<hr><ul>\n";
print "<a href= print "<a href=\"$ftplink\">$ftplink</a>\n";
print "<a href= print "<a href=\"$httplink\">$httplink</a>\n";
print "<a href= print "<a href=\"$glink\">$glink</a>\n";
print "</UL>0/body>0/HTML>0; print "</UL>\n</body>\n</HTML>\n";
} }
return; return;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
sub resolve1 { sub resolve1 {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($scheme, $value) = @_; my($scheme, $value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($try)="/ftp/$pathbase{$scheme}$value.txt"; my($try)="/ftp/$pathbase{$scheme}$value.txt";
if (-f $try) { if (-f $try) {
push(@urls, "http://$host/$pathbase{$scheme}$value.txt"); push(@urls, "http://$host/$pathbase{$scheme}$value.txt");
push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt"); push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt");
push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt"); push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt");
} }
$try="/ftp/$pathbase{$scheme}$value.ps"; $try="/ftp/$pathbase{$scheme}$value.ps";
if (-f $try) { if (-f $try) {
push(@urls, "http://$host/$pathbase{$scheme}$value.ps"); push(@urls, "http://$host/$pathbase{$scheme}$value.ps");
push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps"); push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps");
push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps"); push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps");
} }
$try="/ftp/$pathbase{$scheme}$value.html"; $try="/ftp/$pathbase{$scheme}$value.html";
if (-f $try) { if (-f $try) {
push(@urls, "http://$host/$pathbase{$scheme}$value.html"); push(@urls, "http://$host/$pathbase{$scheme}$value.html");
push(@urls, "ftp://$host/$pathbase{$scheme}$value.html"); push(@urls, "ftp://$host/$pathbase{$scheme}$value.html");
} }
&urn_error("404 Not Found0) if ($#urls == -1); &urn_error("404 Not Found\n") if ($#urls == -1);
MIME_SWITCH: { MIME_SWITCH: {
if ($accept =~ /text/uri-list/) { #look for text/uri-list, otherwise if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise
text/html text/html
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/uri-list0; print "Content-type: text/uri-list\n\n\n";
print "#$urn0; print "#$urn\n";
foreach $i (@urls) { foreach $i (@urls) {
print "$i0; print "$i\n";
} }
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/html/) { if ($accept =~ /\*\/\*|text\/html/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ls</title></head>0; print "<head><title>URN Resolution: I2Ls</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN $urn resolves to the following URLs:</h1>0; print "<h1>URN $urn resolves to the following URLs:</h1>\n";
print "<hr><ul>0; print "<hr><ul>\n";
foreach $i (@urls) { foreach $i (@urls) {
print "<LI><A HREF= print "<LI><A HREF=\"$i\">$i</A>\n";
} }
print "</UL>0/body>0/HTML>0; print "</UL>\n</body>\n</HTML>\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
} }
} }
sub urn_error { sub urn_error {
my($code) = @_; #store failure code here... my($code) = @_; #store failure code here...
print "Status: $code"; print "Status: $code";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2L $code</title></head>0; print "<head><title>URN Resolution: I2L $code</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN to URL resolution failed for the URN:</h1>0; print "<h1>URN to URL resolution failed for the URN:</h1>\n";
print "<hr><h3>$urn</h3>0; print "<hr><h3>$urn</h3>\n";
print "</body>0; print "</body>\n";
print "</html>0; print "</html>\n";
exit; exit;
} }
sub resolveid { sub resolveid {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($value) = @_; my($value) = @_;
my($scheme) = "id"; my($scheme) = "id";
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($try)="/ftp/$pathbase{$scheme}$value.txt"; my($try)="/ftp/$pathbase{$scheme}$value.txt";
if (-f $try) { if (-f $try) {
push(@urls, "http://$host/$pathbase{$scheme}$value.txt"); push(@urls, "http://$host/$pathbase{$scheme}$value.txt");
push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt"); push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt");
push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt"); push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt");
} }
$try="/ftp/$pathbase{$scheme}$value.ps"; $try="/ftp/$pathbase{$scheme}$value.ps";
if (-f $try) { if (-f $try) {
push(@urls, "http://$host/$pathbase{$scheme}$value.ps"); push(@urls, "http://$host/$pathbase{$scheme}$value.ps");
push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps"); push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps");
push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps"); push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps");
} }
$try="/ftp/$pathbase{$scheme}$value.html"; $try="/ftp/$pathbase{$scheme}$value.html";
if (-f $try) { if (-f $try) {
push(@urls, "http://$host/$pathbase{$scheme}$value.html"); push(@urls, "http://$host/$pathbase{$scheme}$value.html");
push(@urls, "ftp://$host/$pathbase{$scheme}$value.html"); push(@urls, "ftp://$host/$pathbase{$scheme}$value.html");
} }
&urn_error("404 Not Found\n") if ($#urls == -1);
&urn_error("404 Not Found0) if ($#urls == -1);
MIME_SWITCH: { MIME_SWITCH: {
if ($accept =~ /text/uri-list/) { #look for text/uri-list, otherwise if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise
text/html text/html
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/uri-list0; print "Content-type: text/uri-list\n\n\n";
print "#$urn0; print "#$urn\n";
foreach $i (@urls) { foreach $i (@urls) {
print "$i0; print "$i\n";
} }
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/html/) { if ($accept =~ /\*\/\*|text\/html/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ls</title></head>0; print "<head><title>URN Resolution: I2Ls</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN $urn resolves to the following URLs:</h1>0; print "<h1>URN $urn resolves to the following URLs:</h1>\n";
print "<hr><ul>0; print "<hr><ul>\n";
foreach $i (@urls) { foreach $i (@urls) {
print "<LI><A HREF= print "<LI><A HREF=\"$i\">$i</A>\n";
} }
print "</UL>0/body>0/HTML>0; print "</UL>\n</body>\n</HTML>\n";
last MIME_SWITCH; last MIME_SWITCH;
} }
} }
} }
A.4 I2Ns A.4 I2Ns
#!/usr/local/bin/perl #!/usr/local/bin/perl
use strict; use strict;
skipping to change at page 19, line 11 skipping to change at page 18, line 51
# #
my(%cite) = ( my(%cite) = (
rfc => "/ftp/rfc/rfc-index.txt", rfc => "/ftp/rfc/rfc-index.txt",
fyi => "/ftp/fyi/fyi-index.txt", fyi => "/ftp/fyi/fyi-index.txt",
std => "/ftp/std/std-index.txt", std => "/ftp/std/std-index.txt",
bcp => "/ftp/rfc/bcp-index.txt" bcp => "/ftp/rfc/bcp-index.txt"
); );
my(%number2date) = ( my(%number2date) = (
41 => "98apr", 44 => "99mar",
43 => "98dec", 42 => "98aug", 41 => "98apr",
40 => "97dec", 39 => "97aug", 38 => "97apr", 40 => "97dec", 39 => "97aug", 38 => "97apr",
37 => "96dec", 36 => "96jun", 35 => "96mar", 37 => "96dec", 36 => "96jun", 35 => "96mar",
34 => "95dec", 33 => "95jul", 32 => "95apr", 34 => "95dec", 33 => "95jul", 32 => "95apr",
31 => "94dec", 30 => "94jul", 29 => "94mar", 31 => "94dec", 30 => "94jul", 29 => "94mar",
28 => "93nov", 27 => "93jul", 26 => "93mar", 28 => "93nov", 27 => "93jul", 26 => "93mar",
25 => "92nov", 24 => "92jul", 23 => "92mar", 25 => "92nov", 24 => "92jul", 23 => "92mar",
22 => "91nov", 21 => "91jul", 20 => "91mar", 22 => "91nov", 21 => "91jul", 20 => "91mar",
19 => "90dec" ); 19 => "90dec" );
my($wgpath) = "/ftp/ietf"; my($wgpath) = "/ftp/ietf";
my($urn) = $ENV{'QUERY_STRING'}; my($urn) = $ENV{'QUERY_STRING'};
my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
my($port) = $ENV{'SERVER_PORT'}; my($port) = $ENV={'SERVER_PORT'};
my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
(&resolve1("id", $1), exit) if ($urn =~ /urn:ietf:id:(/i); (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
(&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(72)/i); (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i);
(&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(9*)-( &urn_error("400 Bad Request\n");
120&urn_error("400 Bad Request0);
sub resolve2 { sub resolve2 {
my($ietfnum, $sesnam) = @_; my($ietfnum, $sesnam) = @_;
&urn_error("404 Not Found0) if (!defined $number2date{$ietfnum}); &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
my($date)=$number2date{$ietfnum}; my($date)=$number2date{$ietfnum};
my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
if ($accept =~ /text/uri-list/) { if ($accept =~ /text\/uri-list/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/uri-list0; print "Content-type: text/uri-list\n\n\n";
print "#$urn0; print "#$urn\n";
return; return;
} }
if ($accept =~ /text/html/) { if ($accept =~ /\*\/\*|text\/html/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ns</title></head>0; print "<head><title>URN Resolution: I2Ns</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN $urn resolves to the following URNs:</h1>0; print "<h1>URN $urn resolves to the following URNs:</h1>\n";
print "<hr><ul>0; print "<hr><ul>\n";
print "</UL>0/body>0/HTML>0; print "</UL>\n</body>\n</HTML>\n";
return; return;
} }
} }
my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
if ($accept =~ /text/uri-list/) { if ($accept =~ /text\/uri-list/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/uri-list0; print "Content-type: text/uri-list\n\n\n";
print "#$urn0; print "#$urn\n";
return; return;
} }
if ($accept =~ /text/html/) { if ($accept =~ /\*\/\*|text\/html/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ns</title></head>0; print "<head><title>URN Resolution: I2Ns</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN $urn resolves to the following URNs:</h1>0; print "<h1>URN $urn resolves to the following URNs:</h1>\n";
print "<hr><ul>0; print "<hr><ul>\n";
print "</UL>0/body>0/HTML>0; print "</UL>\n</body>\n</HTML>\n";
return; return;
} }
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
sub end { sub end {
my($inarg)=@_; my($inarg)=@_;
return $inarg . "st" if ($inarg =~ /1$/); return $inarg . "st" if ($inarg =~ /1$/);
return $inarg . "nd" if ($inarg =~ /2$/); return $inarg . "nd" if ($inarg =~ /2$/);
return $inarg . "rd" if ($inarg =~ /3$/); return $inarg . "rd" if ($inarg =~ /3$/);
return $inarg . "th"; return $inarg . "th";
} }
sub resolve1 { sub resolve1 {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($scheme, $value) = @_; my($scheme, $value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
if (!defined $cite{$scheme}) { if (!defined $cite{$scheme}) {
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
$flag = 0; $flag = 0;
open(INPUT, "$cite{$scheme}"); open(INPUT, "$cite{$scheme}");
while (<INPUT>) { while (<INPUT>) {
$flag = 1 if (/^0*$value /); $flag = 1 if (/^0*$value /);
if ($flag == 1) { if ($flag == 1) {
last if (/^$/); last if (/^$/);
chop; chop;
push @bib,$_; push @bib,$_;
} }
} }
$k=join " ",@bib; $k=join " ",@bib;
while ($k =~ /(fyi|std|rfc|bcp)([0-9]+)(.*)/i) { while ($k =~ /(\S*)\s*(fyi|std|rfc|bcp)\s*([0-9]+)(.*)/i) {
$k=$4; $k=$4;
$a=$2; $b=$3; $a=$2; $b=$3;
if (($a ne $scheme || $b ne $value) && ($1 !~ /obso/i)){ if (($a ne $scheme || $b ne $value) && ($1 !~ /obso/i)){
$a =~ tr/A-Z/a-z/; $a =~ tr/A-Z/a-z/;
$b =~ s/^0*//; $b =~ s/^0*//;
push @ref,"urn:ietf:$a:$b"; push @ref,"urn:ietf:$a:$b";
} }
} }
MIME_SWITCH: { MIME_SWITCH: {
if ($accept =~ /text/uri-list/) { if ($accept =~ /text\/uri-list/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/uri-list0; print "Content-type: text/uri-list\n\n\n";
print "#$urn0; print "#$urn\n";
foreach $i (@ref) { foreach $i (@ref) {
print "$i0; print "$i\n";
} }
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/html/) { if ($accept =~ /\*\/\*|text\/html/) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ns</title></head>0; print "<head><title>URN Resolution: I2Ns</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN $urn resolves to the following URNs:</h1>0; print "<h1>URN $urn resolves to the following URNs:</h1>\n";
print "<hr><ul>0; print "<hr><ul>\n";
foreach $i (@ref) { foreach $i (@ref) {
print "<li>$i: Click to resolve using0; print "<li>$i: Click to resolve using\n";
print "<a href= print "<a
print "<a href= href=\"http://$host:$port/uri-res/I2C?$i\">I2C</a>,\n";
print "<a href= print "<a
print "<a href= href=\"http://$host:$port/uri-res/I2L?$i\">I2L</a>,\n";
print "<a href= print "<a
href=\"http://$host:$port/uri-res/I2Ls?$i\">I2Ls</a>,\n";
print "<a
href=\"http://$host:$port/uri-res/I2R?$i\">I2R</a>,\n";
print "<a
href=\"http://$host:$port/uri-res/I2Rs?$i\">I2Rs</a>\n";
} }
print "</UL>0/body>0/HTML>0; print "</UL>\n</body>\n</HTML>\n";
} }
} }
} }
sub make_link { sub make_link {
my($sc); my($sc);
my($inarg)=@_; my($inarg)=@_;
($sc=$1) if ($inarg =~ /([a-z]*)/); ($sc=$1) if ($inarg =~ /([a-z]*)/);
return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps"); return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps");
return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html"); return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html");
return "/$sc/$inarg.txt"; return "/$sc/$inarg.txt";
} }
sub urn_error { sub urn_error {
my($code) = @_; #store failure code here... my($code) = @_; #store failure code here...
print "Status: $code"; print "Status: $code";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Ns $code</title></head>0; print "<head><title>URN Resolution: I2Ns $code</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN to URN resolution failed for the URN:</h1>0; print "<h1>URN to URN resolution failed for the URN:</h1>\n";
print "<hr><h3>$urn</h3>0; print "<hr><h3>$urn</h3>\n";
print "</body>0; print "</body>\n";
print "</html>0; print "</html>\n";
exit; exit;
}; };
A.5 I2R A.5 I2R
#!/usr/local/bin/perl #!/usr/local/bin/perl
use strict; use strict;
# #
skipping to change at page 22, line 44 skipping to change at page 22, line 35
my(%pathbase) = ( my(%pathbase) = (
rfc => "rfc/rfc", rfc => "rfc/rfc",
fyi => "fyi/fyi", fyi => "fyi/fyi",
std => "std/std", std => "std/std",
bcp => "bcp/bcp", bcp => "bcp/bcp",
id => "internet-drafts/draft-" id => "internet-drafts/draft-"
); );
my(%number2date) = ( my(%number2date) = (
41 => "98apr", 44 => "99mar",
43 => "98dec", 42 => "98aug", 41 => "98apr",
40 => "97dec", 39 => "97aug", 38 => "97apr", 40 => "97dec", 39 => "97aug", 38 => "97apr",
37 => "96dec", 36 => "96jun", 35 => "96mar", 37 => "96dec", 36 => "96jun", 35 => "96mar",
34 => "95dec", 33 => "95jul", 32 => "95apr", 34 => "95dec", 33 => "95jul", 32 => "95apr",
31 => "94dec", 30 => "94jul", 29 => "94mar", 31 => "94dec", 30 => "94jul", 29 => "94mar",
28 => "93nov", 27 => "93jul", 26 => "93mar", 28 => "93nov", 27 => "93jul", 26 => "93mar",
25 => "92nov", 24 => "92jul", 23 => "92mar", 25 => "92nov", 24 => "92jul", 23 => "92mar",
22 => "91nov", 21 => "91jul", 20 => "91mar", 22 => "91nov", 21 => "91jul", 20 => "91mar",
19 => "90dec" ); 19 => "90dec" );
my($wgpath) = "/ftp/ietf"; my($wgpath) = "/ftp/ietf";
my($urn) = $ENV{'QUERY_STRING'}; my($urn) = $ENV{'QUERY_STRING'};
my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
print "$urn0; print "$urn\n";
(&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(i); (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
(&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(72)/i);
(&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(9*)-( (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
120&urn_error("400 Bad Request0); (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i);
&urn_error("400 Bad Request\n");
sub resolve2 { sub resolve2 {
my($ietfnum, $sesnam) = @_; my($ietfnum, $sesnam) = @_;
&urn_error("404 Not Found0) if (!defined $number2date{$ietfnum}); &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
my($date)=$number2date{$ietfnum}; my($date)=$number2date{$ietfnum};
my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/plain0; print "Content-type: text/plain\n\n";
open(FILE, "$link"); open(FILE, "$link");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
return; return;
} }
my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/plain0; print "Content-type: text/plain\n\n";
open(FILE, "$link"); open(FILE, "$link");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
return; return;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
sub end { sub end {
my($inarg)=@_; my($inarg)=@_;
return $inarg . "st" if ($inarg =~ /1$/); return $inarg . "st" if ($inarg =~ /1$/);
return $inarg . "nd" if ($inarg =~ /2$/); return $inarg . "nd" if ($inarg =~ /2$/);
return $inarg . "rd" if ($inarg =~ /3$/); return $inarg . "rd" if ($inarg =~ /3$/);
return $inarg . "th"; return $inarg . "th";
} }
sub resolve1 { sub resolve1 {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($scheme, $value) = @_; my($scheme, $value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
MIME_SWITCH: { MIME_SWITCH: {
if ($accept =~ /application/postscript/ && -f $pstry) { if ($accept =~ /application\/postscript/ && -f $pstry) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: application/postscript0; print "Content-type: application/postscript\n\n";
open(FILE, "$pstry"); open(FILE, "$pstry");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/html/ && -f $htmltry) { if ($accept =~ /text\/html/ && -f $htmltry) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0; print "Content-type: text/html\n\n";
open(FILE, "$htmltry"); open(FILE, "$htmltry");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/plain/ && -f $txttry) { if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/plain0; print "Content-type: text/plain\n\n";
open(FILE, "$txttry"); open(FILE, "$txttry");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
last MIME_SWITCH; last MIME_SWITCH;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
} }
sub resolveid { sub resolveid {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link); my($l,$link);
my($scheme) = "id"; my($scheme) = "id";
my($value) = @_; my($value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
MIME_SWITCH: { MIME_SWITCH: {
if ($accept =~ /application/postscript/ && -f $pstry) { if ($accept =~ /application\/postscript/ && -f $pstry) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: application/postscript0; print "Content-type: application/postscript\n\n";
open(FILE, "$pstry"); open(FILE, "$pstry");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/html/ && -f $htmltry) { if ($accept =~ /text\/html/ && -f $htmltry) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/html0; print "Content-type: text/html\n\n";
open(FILE, "$htmltry"); open(FILE, "$htmltry");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
last MIME_SWITCH; last MIME_SWITCH;
} }
if ($accept =~ /text/plain/ && -f $txttry) { if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: text/plain0; print "Content-type: text/plain\n\n";
open(FILE, "$txttry"); open(FILE, "$txttry");
while (<FILE>) { while (<FILE>) {
print $_; print $_;
} }
close FILE; close FILE;
last MIME_SWITCH; last MIME_SWITCH;
} }
&urn_error("404 Not Found0); &urn_error("404 Not Found\n");
} }
} }
sub urn_error { sub urn_error {
my($code) = @_; #store failure code here... my($code) = @_; #store failure code here...
print "Status: $code"; print "Status: $code";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2R $code</title></head>0; print "<head><title>URN Resolution: I2R $code</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN to URL resolution failed for the URN:</h1>0; print "<h1>URN to URL resolution failed for the URN:</h1>\n";
print "<hr><h3>$urn</h3>0; print "<hr><h3>$urn</h3>\n";
print "</body>0; print "</body>\n";
print "</html>0; print "</html>\n";
exit; exit;
} }
A.6 I2Rs A.6 I2Rs
#!/usr/local/bin/perl #!/usr/local/bin/perl
use strict; use strict;
# #
skipping to change at page 26, line 35 skipping to change at page 26, line 26
my(%pathbase) = ( my(%pathbase) = (
rfc => "rfc/rfc", rfc => "rfc/rfc",
fyi => "fyi/fyi", fyi => "fyi/fyi",
std => "std/std", std => "std/std",
bcp => "bcp/bcp", bcp => "bcp/bcp",
id => "internet-drafts/draft-" id => "internet-drafts/draft-"
); );
my(%number2date) = ( my(%number2date) = (
41 => "98apr", 44 => "99mar",
43 => "98dec", 42 => "98aug", 41 => "98apr",
40 => "97dec", 39 => "97aug", 38 => "97apr", 40 => "97dec", 39 => "97aug", 38 => "97apr",
37 => "96dec", 36 => "96jun", 35 => "96mar", 37 => "96dec", 36 => "96jun", 35 => "96mar",
34 => "95dec", 33 => "95jul", 32 => "95apr", 34 => "95dec", 33 => "95jul", 32 => "95apr",
31 => "94dec", 30 => "94jul", 29 => "94mar", 31 => "94dec", 30 => "94jul", 29 => "94mar",
28 => "93nov", 27 => "93jul", 26 => "93mar", 28 => "93nov", 27 => "93jul", 26 => "93mar",
25 => "92nov", 24 => "92jul", 23 => "92mar", 25 => "92nov", 24 => "92jul", 23 => "92mar",
22 => "91nov", 21 => "91jul", 20 => "91mar", 22 => "91nov", 21 => "91jul", 20 => "91mar",
19 => "90dec" ); 19 => "90dec" );
my($wgpath) = "/ftp/ietf"; my($wgpath) = "/ftp/ietf";
my($urn) = $ENV{'QUERY_STRING'}; my($urn) = $ENV{'QUERY_STRING'};
my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
(&resolveid($1), exit) if ($urn =~ /urn:ietf:id:()/i); (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\s*)/i);
(&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
(&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(72)/i); (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i);
(&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(9*)-( &urn_error("400 Bad Request\n");
120&urn_error("400 Bad Request0);
sub resolve2 { sub resolve2 {
my($ietfnum, $sesnam) = @_; my($ietfnum, $sesnam) = @_;
my(@vers,$i); my(@vers,$i);
&urn_error("404 Not Found0) if (!defined $number2date{$ietfnum}); &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
my($date)=$number2date{$ietfnum}; my($date)=$number2date{$ietfnum};
my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
push(@vers,$link); push(@vers,$link);
} }
$link="$wgpath/$date/$sesnam-minutes-$date.txt"; $link="$wgpath/$date/$sesnam-minutes-$date.txt";
if (-f $link) { if (-f $link) {
push(@vers,$link); push(@vers,$link);
} }
&urn_error("404 Not Found0) if ($#vers==-1); &urn_error("404 Not Found\n") if ($#vers==-1);
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: multipart/alternative; boundary=endpart0; print "Content-type: multipart/alternative; boundary=endpart\n\n";
foreach $i (@vers) { foreach $i (@vers) {
print "--endpart0; print "--endpart\n";
if ($i =~ /html$/) { if ($i =~ /html$/) {
print "Content-Type: text/html0; print "Content-Type: text/html\n\n";
} }
if ($i =~ /txt$/) { if ($i =~ /txt$/) {
print "Content-Type: text/plain0; print "Content-Type: text/plain\n\n";
} }
if ($i =~ /ps$/) { if ($i =~ /ps$/) {
print "Content-Type: application/postscript0; print "Content-Type: application/postscript\n\n";
} }
open(FILE, "$i"); open(FILE, "$i");
while (<FILE>) { while (<FILE>) {
print "$_"; print "$_";
} }
close FILE; close FILE;
} }
print "--endpart0; print "--endpart\n";
} }
sub resolve1 { sub resolve1 {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link,@vers); my($l,$link,@vers);
my($scheme, $value) = @_; my($scheme, $value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($try)="/ftp/$pathbase{$scheme}$value.txt"; my($try)="/ftp/$pathbase{$scheme}$value.txt";
if (-f $try) { if (-f $try) {
push(@vers, $try); push(@vers, $try);
} }
$try="/ftp/$pathbase{$scheme}$value.ps"; $try="/ftp/$pathbase{$scheme}$value.ps";
if (-f $try) { if (-f $try) {
push(@vers, $try); push(@vers, $try);
} }
$try="/ftp/$pathbase{$scheme}$value.html"; $try="/ftp/$pathbase{$scheme}$value.html";
if (-f $try) { if (-f $try) {
push(@vers, $try); push(@vers, $try);
} }
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: multipart/alternative; boundary=endpart0; print "Content-type: multipart/alternative; boundary=endpart\n\n";
foreach $i (@vers) { foreach $i (@vers) {
print "--endpart0; print "--endpart\n";
if ($i =~ /html$/) { if ($i =~ /html$/) {
print "Content-Type: text/html0; print "Content-Type: text/html\n\n";
} }
if ($i =~ /txt$/) { if ($i =~ /txt$/) {
print "Content-Type: text/plain0; print "Content-Type: text/plain\n\n";
} }
if ($i =~ /ps$/) { if ($i =~ /ps$/) {
print "Content-Type: application/postscript0; print "Content-Type: application/postscript\n\n";
} }
open(FILE, "$i"); open(FILE, "$i");
while (<FILE>) { while (<FILE>) {
print "$_"; print "$_";
} }
close FILE; close FILE;
} }
print "--endpart0; print "--endpart\n";
} }
sub resolveid { sub resolveid {
my($flag,@bib,$i,$k,$j,$done,@ref); my($flag,@bib,$i,$k,$j,$done,@ref);
my($l,$link,@vers); my($l,$link,@vers);
my($scheme) = "id"; my($scheme) = "id";
my($value) = @_; my($value) = @_;
$scheme =~ tr/A-Z/a-z/; $scheme =~ tr/A-Z/a-z/;
&urn_error("404 Not Found0)if (!defined $pathbase{$scheme}); &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
my($try)="/ftp/$pathbase{$scheme}$value.txt"; my($try)="/ftp/$pathbase{$scheme}$value.txt";
if (-f $try) { if (-f $try) {
push(@vers, $try); push(@vers, $try);
} }
$try="/ftp/$pathbase{$scheme}$value.ps"; $try="/ftp/$pathbase{$scheme}$value.ps";
if (-f $try) { if (-f $try) {
push(@vers, $try); push(@vers, $try);
} }
$try="/ftp/$pathbase{$scheme}$value.html"; $try="/ftp/$pathbase{$scheme}$value.html";
if (-f $try) { if (-f $try) {
push(@vers, $try); push(@vers, $try);
} }
print "Status: 200 OK0; print "Status: 200 OK\n";
print "Content-type: multipart/alternative; boundary=endpart0; print "Content-type: multipart/alternative; boundary=endpart\n\n";
foreach $i (@vers) { foreach $i (@vers) {
print "--endpart0; print "--endpart\n";
if ($i =~ /html$/) { if ($i =~ /html$/) {
print "Content-Type: text/html0; print "Content-Type: text/html\n\n";
} }
if ($i =~ /txt$/) { if ($i =~ /txt$/) {
print "Content-Type: text/plain0; print "Content-Type: text/plain\n\n";
} }
if ($i =~ /ps$/) { if ($i =~ /ps$/) {
print "Content-Type: application/postscript0; print "Content-Type: application/postscript\n\n";
} }
open(FILE, "$i"); open(FILE, "$i");
while (<FILE>) { while (<FILE>) {
print "$_"; print "$_";
} }
close FILE; close FILE;
} }
print "--endpart0; print "--endpart\n";
} }
sub urn_error { sub urn_error {
my($code) = @_; #store failure code here... my($code) = @_; #store failure code here...
print "Status: $code"; print "Status: $code";
print "Content-type: text/html0HTML>0; print "Content-type: text/html\n\n<HTML>\n";
print "<head><title>URN Resolution: I2Rs $code</title></head>0; print "<head><title>URN Resolution: I2Rs $code</title></head>\n";
print "<BODY>0; print "<BODY>\n";
print "<h1>URN to URL resolution failed for the URN:</h1>0; print "<h1>URN to URL resolution failed for the URN:</h1>\n";
print "<hr><h3>$urn</h3>0; print "<hr><h3>$urn</h3>\n";
print "</body>0; print "</body>\n";
print "</html>0; print "</html>\n";
exit; exit;
} }
 End of changes. 153 change blocks. 
374 lines changed or deleted 381 lines changed or added

This html diff was produced by rfcdiff 1.34. The latest version is available from http://tools.ietf.org/tools/rfcdiff/