home *** CD-ROM | disk | FTP | other *** search
/ Internet Core Protocols / Oreilly-InternetCoreProtocols.iso / RFCs / rfc2648.txt < prev    next >
Encoding:
Text File  |  1999-10-14  |  47.4 KB  |  1,684 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                           R. Moats
  8. Request for Comments: 2648                                          AT&T
  9. Category: Informational                                      August 1999
  10.  
  11.  
  12.                    A URN Namespace for IETF Documents
  13.  
  14. Status of this Memo
  15.  
  16.    This memo provides information for the Internet community.  It does
  17.    not specify an Internet standard of any kind.  Distribution of this
  18.    memo is unlimited.
  19.  
  20. Copyright Notice
  21.  
  22.    Copyright (C) The Internet Society (1999).  All Rights Reserved.
  23.  
  24. Abstract
  25.  
  26.    A system for Uniform Resource Names (URNs) must be capable of
  27.    supporting new naming systems.  As an example of proposing a new
  28.    namespace, this document proposes the "ietf" namespace.  This
  29.    namespace consists of the RFC family of documents (RFCs, STDs, FYIs,
  30.    and BCPs) developed by the IETF and published by the RFC Editor, the
  31.    minutes of working groups (WG) and birds of a feather (BOF) meetings
  32.    that occur during IETF conferences, and the Internet Drafts published
  33.    by the Internet Drafts Editor.  Both the current URN framework and
  34.    URN syntax support this namespace.
  35.  
  36. 1. Introduction
  37.  
  38.    This document proposes the "ietf" namespace, which consists of the
  39.    RFC family of documents (RFCs, STDs, FYIs, and BCPs) developed by the
  40.    IETF and published by the RFC editor and the minutes of working
  41.    groups (WG) and birds of a feather (BOF) meetings that occur during
  42.    IETF conferences.
  43.  
  44.    The namespace specification is for a formal namespace.
  45.  
  46. 2. Specification Template
  47.  
  48.       Namespace ID:
  49.  
  50.             "ietf" requested.
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Moats                        Informational                      [Page 1]
  59.  
  60. RFC 2648           A URN Namespace for IETF Documents        August 1999
  61.  
  62.  
  63.       Registration Information:
  64.  
  65.             Registration version number: 1
  66.             Registration date: 1999-04-22
  67.  
  68.       Declared registrant of the namespace:
  69.  
  70.             Ryan Moats
  71.             jayhawk@att.com
  72.             AT&T
  73.             15621 Drexel Circle
  74.             Omaha, NE 68135-2358
  75.  
  76.       Declaration of structure:
  77.  
  78.             The identifier has the following ABNF [2] specification:
  79.  
  80.             NSS = rfc-nss / fyi-nss / std-nss / bcp-nss /
  81.                   draft-nss / mtg-nss / other-nss
  82.  
  83.             rfc-nss = "rfc:" 1*DIGIT
  84.             fyi-nss = "fyi:" 1*DIGIT
  85.             std-nss = "std:" 1*DIGIT
  86.             bcp-nss = "bcp:" 1*DIGIT
  87.             draft-nss = "id:" string
  88.             mtg-nss = "mtg:" string
  89.             other-nss = string
  90.               ; beginning with a prefix other than one of those
  91.               ; above for future expansion
  92.  
  93.             string = 1*(DIGIT / ALPHA / "-")
  94.  
  95.             If the IESG (or it successor) adds a new document series,
  96.             this ABNF specification will need to be updated.  Further,
  97.             if a working group or BOF is created that used characters
  98.             outside the range of this ABNF specification, this
  99.             specification will need to be updated.  Any system intended
  100.             to resolve names for this namespace should be written with
  101.             the awareness that this could occur at any time.
  102.  
  103.       Relevant ancillary documentation:
  104.  
  105.             Relevant documentation is in RFC 2648.
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. Moats                        Informational                      [Page 2]
  115.  
  116. RFC 2648           A URN Namespace for IETF Documents        August 1999
  117.  
  118.  
  119.       Identifier uniqueness considerations:
  120.  
  121.             Because the rfc-editor assigns the RFC number uniquely these
  122.             URNs are unique.  Since the mapping between RFCs and other
  123.             rfc-editor document series (STDs, FYIs or BCPs) is not
  124.             necessarily one-to-one, uniqueness of STDs, FYIs and BCPs
  125.             are defined based on the document mappings maintained by the
  126.             RFC Editor (the index files "rfc-index.txt", "fyi-
  127.             index.txt", "bcp-index.txt", "std-index.txt") are defined to
  128.             be the definitive statement of the assignment of RFC Family
  129.             URNs in this namespace.  The meeting minutes portion of the
  130.             namespace is guaranteed unique because the URN includes the
  131.             sequence number of the IETF conference.  The document
  132.             mapping maintained by the Internet Drafts editor ("1id-
  133.             abstracts.txt") is defined as the definitive statement of
  134.             the assignment of URNs for the internet draft portion of
  135.             this namespace.
  136.  
  137.       Identifier persistence considerations:
  138.  
  139.             Persistence of the URNs of this namespace is independent of
  140.             the mutability of the underlying documents.  A URN once
  141.             assigned will never be reassigned to a different resource;
  142.             the assignment is persistent and immutable.  Immutability of
  143.             RFCs, STDs, FYIs and BCPs is at the discretion of the RFC
  144.             Editor.  They may be composites of one or more RFCs and the
  145.             set of RFCs that includes them may change with time.  It is
  146.             important to note that this mutability of some resources is
  147.             independent of the immutability of URN assignment to a
  148.             resource.
  149.  
  150.       Process of identifier assignment:
  151.  
  152.             Assignment of URNs from this namespace occurs in three ways.
  153.             The first is through publication of a new RFC, FYI, STD or
  154.             BCP is by the RFC Editor. This new document will have a new
  155.             series number and will therefore define a new URN.  The
  156.             document mappings maintained by the RFC Editor (the index
  157.             files "rfc-index.txt", "fyi-index.txt", "bcp-index.txt" and
  158.             "std-index.txt") are defined to be the definitive statement
  159.             of the assignment of RFC Family URNs in this namespace.
  160.  
  161.             The second way a URN is assigned is through the filing of
  162.             meeting minutes by a working group or birds of a feather as
  163.             part of an IETF conference.  The list of minutes maintained
  164.             by the IETF for each working group and conference in the
  165.             subtree pointed at by the URL ftp://ietf.org/ietf/ is
  166.             considered the definitive assignment of URNs for working
  167.  
  168.  
  169.  
  170. Moats                        Informational                      [Page 3]
  171.  
  172. RFC 2648           A URN Namespace for IETF Documents        August 1999
  173.  
  174.  
  175.             group or birds of a feather minutes.
  176.  
  177.             The third way a URN is assigned is through the publication
  178.             of a new internet-draft by the Internet Draft Editor.  This
  179.             draft will have a distinct name (and version number) and
  180.             therefore defined a new URN.  The document mapping
  181.             maintained by the Internet Drafts editor ("1id-
  182.             abstracts.txt") is defined as the definitive statement of
  183.             the assignment of URNs for this portion of the namespace.
  184.  
  185.       Process of identifier resolution:
  186.  
  187.             A mirrored copy of the underlying documentation is required
  188.             to resolve these URNs.  Resolution via HTTP is done by a set
  189.             of simple Perl cgi-bin scripts presented in Appendix A.
  190.  
  191.       Rules for Lexical Equivalence:
  192.  
  193.             The entire URN is case-insensitive.
  194.  
  195.       Conformance with URN Syntax:
  196.  
  197.             There are no additional characters reserved.
  198.  
  199.       Validation mechanism:
  200.  
  201.             None additional to resolution specified
  202.  
  203.       Scope:
  204.  
  205.             Global.
  206.  
  207. 3. Examples
  208.  
  209.    The following are examples of URNs that a resolver for this namespace
  210.    can resolve:
  211.  
  212.          urn:ietf:rfc:2141
  213.          urn:ietf:std:50
  214.          urn:ietf:id:ietf-urn-ietf-06
  215.          urn:ietf:mtg:41-urn
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. Moats                        Informational                      [Page 4]
  227.  
  228. RFC 2648           A URN Namespace for IETF Documents        August 1999
  229.  
  230.  
  231. 4. Security Considerations
  232.  
  233.    Because this namespace defines no additional reserved characters, it
  234.    does not add any security considerations beyond those inherent from
  235.    the existence of the reserved characters from [1].  Further, none of
  236.    the reserved characters from [1] are used in the definition of the
  237.    NSS. This means that resolvers for this namespace may be considered
  238.    "secure" in the sense that any escaping of characters in the NSS MUST
  239.    result in the resolver indicating that the URN has incorrect syntax.
  240.  
  241. 5. Acknowledgments
  242.  
  243.    Thanks to various members of the URN working group for comments on
  244.    earlier drafts of this document.  The work described in this document
  245.    is partially supported by the National Science Foundation,
  246.    Cooperative Agreement NCR-9218179.
  247.  
  248. 6. References
  249.  
  250.    Request For Comments (RFC) and Internet Draft documents are available
  251.    from numerous mirror sites.
  252.  
  253.    [1]  Moats, R., "URN Syntax", RFC 2141, May 1997.
  254.  
  255.    [2]  Crocker, D. and P. Overell, "Augmented BNF for Syntax
  256.         Specifications: ABNF", RFC 2234, November 1997.
  257.  
  258. 7. Author's Address
  259.  
  260.    Ryan Moats
  261.    AT&T
  262.    15621 Drexel Circle
  263.    Omaha, NE 68135-2358
  264.    USA
  265.  
  266.    EMail:  jayhawk@att.com
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Moats                        Informational                      [Page 5]
  283.  
  284. RFC 2648           A URN Namespace for IETF Documents        August 1999
  285.  
  286.  
  287. Appendix A.  Example Resolution Scripts
  288.  
  289.    The following scripts are examples that can be used for resolving
  290.    URNs in this namespace.
  291.  
  292. A.1 I2C
  293.  
  294. #!/usr/local/bin/perl
  295.  
  296. use strict;
  297.  
  298. #
  299. # this is a URN 2 URC resolver for the ietf namespace
  300. #
  301.  
  302. my(%cite) = (
  303.   bcp => "/ftp/rfc/bcp-index.txt",
  304.   fyi => "/ftp/fyi/fyi-index.txt",
  305.   id => "/ftp/internet-drafts/1id-abstracts.txt",
  306.   rfc => "/ftp/rfc/rfc-index.txt",
  307.   std => "/ftp/std/std-index.txt"
  308. );
  309. my(%number2date) = (
  310.   44 => "99mar",
  311.   43 => "98dec", 42 => "98aug", 41 => "98apr",
  312.   40 => "97dec", 39 => "97aug", 38 => "97apr",
  313.   37 => "96dec", 36 => "96jun", 35 => "96mar",
  314.   34 => "95dec", 33 => "95jul", 32 => "95apr",
  315.   31 => "94dec", 30 => "94jul", 29 => "94mar",
  316.   28 => "93nov", 27 => "93jul", 26 => "93mar",
  317.   25 => "92nov", 24 => "92jul", 23 => "92mar",
  318.   22 => "91nov", 21 => "91jul", 20 => "91mar",
  319.   19 => "90dec" );
  320.  
  321. my($wgpath) = "/ftp/ietf";
  322. my($urn) = $ENV{'QUERY_STRING'};
  323. my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
  324. my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
  325.  
  326. (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
  327. (&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
  328. (&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i);
  329. &urn_error("400 Bad Request\n");
  330.  
  331. sub resolvemtg {
  332.   my($ietfnum, $sesnam) = @_;
  333.   &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
  334.   my($date)=$number2date{$ietfnum};
  335.  
  336.  
  337.  
  338. Moats                        Informational                      [Page 6]
  339.  
  340. RFC 2648           A URN Namespace for IETF Documents        August 1999
  341.  
  342.  
  343.   my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
  344.   if (-f $link) {
  345.     print "Status:  200 OK\r\n";
  346.     print "Content-type: text/html\r\n\r\n";
  347.     print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
  348.     print "<BODY>\n";
  349.     print "<H1><A HREF=\"$link\">$urn</A>:</H1>\n";
  350.     print "Minutes of the $sesnam working group from the "
  351.           . &end($ietfnum) . " IETF";
  352.     print "</BODY>\n</HTML>\n";
  353.     return;
  354.   }
  355.   my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
  356.   if (-f $link) {
  357.     print "Status:  200 OK\r\n";
  358.     print "Content-type: text/html\r\n\r\n";
  359.     print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
  360.     print "<BODY>\n";
  361.     print "<H1><A HREF=\"$link\">$urn</A>:</H1>\n";
  362.     print "Minutes of the $sesnam working group from the "
  363.            . &end($ietfnum) . " IETF";
  364.     print "</BODY>\n</HTML>\n";
  365.     return;
  366.   }
  367.   &urn_error("404 Not Found\n");
  368. }
  369.  
  370. sub end {
  371.   my($inarg)=@_;
  372.   return $inarg . "st" if ($inarg =~ /1$/);
  373.   return $inarg . "nd" if ($inarg =~ /2$/);
  374.   return $inarg . "rd" if ($inarg =~ /3$/);
  375.   return $inarg . "th";
  376. }
  377.  
  378. sub resolverfc {
  379.   my($flag,@bib,$i,$k,$j,$done,@ref);
  380.   my($l,$link);
  381.   my($scheme, $value) = @_;
  382.   $scheme =~ tr/A-Z/a-z/;
  383.   if (!defined $cite{$scheme}) {
  384.     &urn_error("404 Not Found\n");
  385.   }
  386.  
  387.   $flag = 0;
  388.   open(INPUT, "$cite{$scheme}");
  389.   while (<INPUT>) {
  390.     $flag = 1 if (/^0*$value /);
  391.  
  392.  
  393.  
  394. Moats                        Informational                      [Page 7]
  395.  
  396. RFC 2648           A URN Namespace for IETF Documents        August 1999
  397.  
  398.  
  399.     if ($flag == 1) {
  400.       last if (/^$/);
  401.       chop;
  402.       push @bib,$_;
  403.     }
  404.   }
  405.  
  406.   if ($scheme ne "rfc") {
  407.     print "Status:  200 OK\r\n";
  408.     print "Content-type: text/html\r\n\r\n";
  409.     $bib[0] =~ s/^[0-9]*\s*/<B>/;
  410.     for ($i=0; $i<=$#bib; $i+=1) {
  411.       last if ($bib[$i] =~ s/\./.<\/B>/);
  412.     }
  413.     for ($i=0;$i<=$#bib;$i+=1) {
  414.       $k=$bib[$i];
  415.       while ($k =~ /(fyi|std|rfc|bcp)([0-9]+)(.*)/i) {
  416.         push @ref,"$1$2";
  417.         $k=$3;
  418.       }
  419.       $done="";
  420.       foreach $j (@ref) {
  421.         next if ($done =~ $j);
  422.         $done .= "$j ";
  423.         $l = $j;
  424.         $l =~ tr/A-Z/a-z/;
  425.         $link=&make_link("$l");
  426.         $bib[$i] =~ s/$j/<A HREF="$link">$j<\/A>/g;
  427.       }
  428.     }
  429.     print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
  430.     print "<BODY>\n";
  431.     $link=&make_link("$scheme$value");
  432.     print "<H1><A HREF=\"$link\">$scheme$value</A>:</H1>\n";
  433.     foreach $i (@bib) {
  434.       print "$i\n";
  435.     }
  436.     print "</BODY>\n</HTML>\n";
  437.   } else {
  438.     print "Status:  200 OK\r\n";
  439.     print "Content-type: text/html\r\n\r\n";
  440.     $bib[0] =~ s/^[0-9]*\s*//;
  441.     $j=0;
  442.     for ($i=0; $i<=$#bib; $i+=1) {
  443.       $j += ($bib[$i] =~ s/, "/, <B>"/);
  444.       $j += ($bib[$i] =~ s/",/"<\/B>,/);
  445.     }
  446.     for ($i=0;$i<=$#bib;$i+=1) {
  447.  
  448.  
  449.  
  450. Moats                        Informational                      [Page 8]
  451.  
  452. RFC 2648           A URN Namespace for IETF Documents        August 1999
  453.  
  454.  
  455.       $k=$bib[$i];
  456.       while ($k =~ /(fyi\s|std\s|rfc|bcp)([0-9]+)(.*)/i) {
  457.         push @ref,"$1$2";
  458.         $k=$3;
  459.       }
  460.       $done="";
  461.       foreach $j (@ref) {
  462.         next if ($done =~ $j);
  463.         $done .= "$j ";
  464.         $l = $j;
  465.         $l =~ s/\s//g;
  466.         $l =~ tr/A-Z/a-z/;
  467.         $link=&make_link("$l");
  468.         $bib[$i] =~ s/$j/<A HREF="$link">$j<\/A>/g;
  469.       }
  470.     }
  471.     print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
  472.     print "<BODY>\n";
  473.     $link=&make_link("$scheme$value");
  474.     print "<H1><A HREF=\"$link\">$scheme$value</A>:</H1>\n";
  475.     foreach $i (@bib) {
  476.       print "$i\n";
  477.     }
  478.     print "</BODY>\n</HTML>\n";
  479.   }
  480. }
  481.  
  482. sub make_link {
  483.   my($sc);
  484.   my($inarg)=@_;
  485.   ($sc=$1) if ($inarg =~ /([a-z]*)/);
  486.   return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps");
  487.   return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html");
  488.   return "/$sc/$inarg.txt";
  489. }
  490.  
  491. sub urn_error {
  492.   my($code) = @_; #store failure code here...
  493.  
  494.   print "Status:  $code";
  495.   print "Content-type: text/html\n\n<HTML>\n";
  496.   print "<head><title>URN Resolution: I2C $code</title></head>\n";
  497.   print "<BODY>\n";
  498.   print "<h1>URN to URC resolution failed for the URN:</h1>\n";
  499.   print "<hr><h3>$urn</h3>\n";
  500.   print "</body>\n";
  501.   print "</html>\n";
  502.   exit;
  503.  
  504.  
  505.  
  506. Moats                        Informational                      [Page 9]
  507.  
  508. RFC 2648           A URN Namespace for IETF Documents        August 1999
  509.  
  510.  
  511. };
  512.  
  513. sub resolveid {
  514.   my($flag,@bib,$i,$k,$j,$count,@ref);
  515.   my($l,$link, $hdr, $done);
  516.   my($value) = @_;
  517.   my($scheme) = "id";
  518.  
  519.   open(INPUT, "$cite{$scheme}");
  520.   while (<INPUT>) {
  521. #
  522. # capture record
  523. #
  524.     if ($flag == 1 || /^\s+\"/) {
  525.       push @bib,$_;
  526.       ($hdr = -1, $count = 0, $flag = 1) if (/^\s+\"/);
  527.       $count++ if (/^\s+$/);
  528.     }
  529.     if ($count == 1) {
  530.       $hdr = $#bib if ($hdr == -1);
  531.     }
  532.     if ($count == 2) {
  533.       for ($i=0; $i<=$hdr; $i+=1) {
  534.             if ($bib[$i] =~ /<(.*)>/) {
  535.               $l = $1;
  536.               if ($l eq "draft-$value.txt" || $l eq "draft-$value.ps") {
  537.                 print "Status:  200 OK\r\n";
  538.                 print "Content-type: text/html\r\n\r\n";
  539.                 print "<HTML>\n<TITLE>Citation for $urn</TITLE>\n";
  540.                 print "<BODY>\n";
  541.                 print "<a
  542. href=\"http://blackhole.vip.att.net/internet-drafts/$l\">$l</a>:\n";
  543.                 print "<pre>\n";
  544.                 foreach $i (@bib) {
  545.                   print "$i";
  546.                 }
  547.                 print "</pre>\n";
  548.                 print "</BODY>\n</HTML>\n";
  549.                 exit;
  550.               }
  551.             }
  552.       }
  553.       $flag = 0;
  554.       @bib = ();
  555.     }
  556.   }
  557.   &urn_error("404 Not Found\n");
  558. }
  559.  
  560.  
  561.  
  562. Moats                        Informational                     [Page 10]
  563.  
  564. RFC 2648           A URN Namespace for IETF Documents        August 1999
  565.  
  566.  
  567. A.2 I2L
  568.  
  569. #!/usr/local/bin/perl
  570.  
  571. use strict;
  572.  
  573. #
  574. # this is a URN 2 URL resolver for the ietf namespace
  575. #
  576.  
  577. my(%pathbase) = (
  578.   rfc => "rfc/rfc",
  579.   fyi => "fyi/fyi",
  580.   std => "std/std",
  581.   bcp => "bcp/bcp",
  582.   id => "internet-drafts/draft-"
  583. );
  584.  
  585. my(%number2date) = (
  586.   44 => "99mar",
  587.   43 => "98dec", 42 => "98aug", 41 => "98apr",
  588.   40 => "97dec", 39 => "97aug", 38 => "97apr",
  589.   37 => "96dec", 36 => "96jun", 35 => "96mar",
  590.   34 => "95dec", 33 => "95jul", 32 => "95apr",
  591.   31 => "94dec", 30 => "94jul", 29 => "94mar",
  592.   28 => "93nov", 27 => "93jul", 26 => "93mar",
  593.   25 => "92nov", 24 => "92jul", 23 => "92mar",
  594.   22 => "91nov", 21 => "91jul", 20 => "91mar",
  595.   19 => "90dec" );
  596.  
  597. my($wgpath) = "/ftp/ietf";
  598. my($urn) = $ENV{'QUERY_STRING'};
  599. my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
  600. my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
  601.  
  602. (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
  603. (&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
  604. (&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i);
  605. &urn_error("400 Bad Request\n");
  606.  
  607. sub resolvemtg {
  608.   my($ietfnum, $sesnam) = @_;
  609.   &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
  610.   my($date)=$number2date{$ietfnum};
  611.   my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
  612.   if (-f $link) {
  613.     print "Status:  302 Moved temporarily\n";
  614.     print "Location: $link\n";
  615.  
  616.  
  617.  
  618. Moats                        Informational                     [Page 11]
  619.  
  620. RFC 2648           A URN Namespace for IETF Documents        August 1999
  621.  
  622.  
  623.     return;
  624.   }
  625.   my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
  626.   if (-f $link) {
  627.     print "Status:  302 Moved temporarily\n";
  628.     print "Location: $link\n";
  629.     return;
  630.   }
  631.   &urn_error("404 Not Found\n");
  632. }
  633.  
  634. sub end {
  635.   my($inarg)=@_;
  636.   return $inarg . "st" if ($inarg =~ /1$/);
  637.   return $inarg . "nd" if ($inarg =~ /2$/);
  638.   return $inarg . "rd" if ($inarg =~ /3$/);
  639.   return $inarg . "th";
  640. }
  641.  
  642. sub resolverfc {
  643.   my($flag,@bib,$i,$k,$j,$done,@ref);
  644.   my($l,$link);
  645.   my($scheme, $value) = @_;
  646.   $scheme =~ tr/A-Z/a-z/;
  647.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  648.   my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
  649.   my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
  650.   my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
  651. MIME_SWITCH: {
  652.     if ($accept =~ /application\/postscript/ && -f $pstry) {
  653.       print "Status:  302 Moved temporarily\n";
  654.       print "Location: http://$host/$pathbase{$scheme}$value.ps\n\n";
  655.       last MIME_SWITCH;
  656.     }
  657.     if ($accept =~ /text\/html/ && -f $htmltry) {
  658.       print "Status:  302 Moved temporarily0;
  659.       print "Location: http://$host/$pathbase{$scheme}$value.html\n\n";
  660.       last MIME_SWITCH;
  661.     }
  662.     if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
  663.       print "Status:  302 Moved temporarily\n";
  664.       print "Location: http://$host/$pathbase{$scheme}$value.txt\n\n";
  665.       last MIME_SWITCH;
  666.     }
  667.     &urn_error("404 Not Found\n");
  668.   }
  669. }
  670.  
  671.  
  672.  
  673.  
  674. Moats                        Informational                     [Page 12]
  675.  
  676. RFC 2648           A URN Namespace for IETF Documents        August 1999
  677.  
  678.  
  679. sub urn_error {
  680.   my($code) = @_; #store failure code here...
  681.  
  682.   print "Status:  $code";
  683.   print "Content-type: text/html\n\n<HTML>\n";
  684.   print "<head><title>URN Resolution: I2L $code</title></head>\n";
  685.   print "<BODY>\n";
  686.   print "<h1>URN to URL resolution failed for the URN:</h1>\n";
  687.   print "<hr><h3>$urn</h3>\n";
  688.   print "</body>\n";
  689.   print "</html>\n";
  690.   exit;
  691. }
  692.  
  693. sub resolveid {
  694.   my($flag,@bib,$i,$k,$j,$done,@ref);
  695.   my($l,$link);
  696.   my($scheme) = "id";
  697.   my($value) = @_;
  698.   $scheme =~ tr/A-Z/a-z/;
  699.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  700.   my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
  701.   my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
  702.   my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
  703. MIME_SWITCH: {
  704.     if ($accept =~ /application\/postscript/ && -f $pstry) {
  705.       print "Status:  302 Moved temporarily\n";
  706.       print "Location: http://$host/$pathbase{$scheme}$value.ps\n\n";
  707.       last MIME_SWITCH;
  708.     }
  709.     if ($accept =~ /text\/html/ && -f $htmltry) {
  710.       print "Status:  302 Moved temporarily\n";
  711.       print "Location: http://$host/$pathbase{$scheme}$value.html\n\n";
  712.       last MIME_SWITCH;
  713.     }
  714.     if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
  715.       print "Status:  302 Moved temporarily\n";
  716.       print "Location: http://$host/$pathbase{$scheme}$value.txt\n\n";
  717.       last MIME_SWITCH;
  718.     }
  719.     &urn_error("404 Not Found\n");
  720.   }
  721. }
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Moats                        Informational                     [Page 13]
  731.  
  732. RFC 2648           A URN Namespace for IETF Documents        August 1999
  733.  
  734.  
  735. A.3 I2Ls
  736.  
  737. #!/usr/local/bin/perl
  738.  
  739. use strict;
  740.  
  741. #
  742. # this is a URN 2 URLs resolver for the ietf namespace
  743. #
  744.  
  745. my(@urls);
  746.  
  747. my(%pathbase) = (
  748.   rfc => "rfc/rfc",
  749.   fyi => "fyi/fyi",
  750.   std => "std/std",
  751.   bcp => "bcp/bcp",
  752.   id => "internet-drafts/draft-"
  753. );
  754.  
  755. my(%number2date) = (
  756.   44 => "99mar",
  757.   43 => "98dec", 42 => "98aug", 41 => "98apr",
  758.   40 => "97dec", 39 => "97aug", 38 => "97apr",
  759.   37 => "96dec", 36 => "96jun", 35 => "96mar",
  760.   34 => "95dec", 33 => "95jul", 32 => "95apr",
  761.   31 => "94dec", 30 => "94jul", 29 => "94mar",
  762.   28 => "93nov", 27 => "93jul", 26 => "93mar",
  763.   25 => "92nov", 24 => "92jul", 23 => "92mar",
  764.   22 => "91nov", 21 => "91jul", 20 => "91mar",
  765.   19 => "90dec" );
  766.  
  767. my($wgpath) = "/ftp/ietf";
  768. my($urn) = $ENV{'QUERY_STRING'};
  769. my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
  770. my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
  771.  
  772. (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
  773. (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
  774. (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i);
  775. &urn_error("400 Bad Request\n");
  776.  
  777. sub resolve2 {
  778.   my($ietfnum, $sesnam) = @_;
  779.   &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
  780.   my($date)=$number2date{$ietfnum};
  781.   my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
  782.   if (-f $link) {
  783.  
  784.  
  785.  
  786. Moats                        Informational                     [Page 14]
  787.  
  788. RFC 2648           A URN Namespace for IETF Documents        August 1999
  789.  
  790.  
  791.     $link=~s/^\/ftp\///;
  792.     my($ftplink)="ftp://$host/$link";
  793.     my($httplink)="http://$host/$link";
  794.     my($glink)="gopher://$host:70/0/$link";
  795.  
  796.     if ($accept =~ /text\/uri-list/) { #look for text/uri-list,
  797.         otherwise text/html
  798.       print "Status: 200 OK\n";
  799.       print "Content-type: text/uri-list\n\n\n";
  800.       print "#$urn\n";
  801.       print "$ftplink\n";
  802.       print "$httplink\n";
  803.       print "$glink\n";
  804.     }
  805.     if ($accept =~ /\*\/\*|text\/html/) {
  806.       print "Status: 200 OK\n";
  807.       print "Content-type: text/html\n\n<HTML>\n";
  808.       print "<head><title>URN Resolution: I2Ls</title></head>\n";
  809.       print "<BODY>\n";
  810.       print "<h1>URN $urn resolves to the following URLs:</h1>\n";
  811.       print "<hr><ul>\n";
  812.       print "<a href=\"$ftplink\">$ftplink</a>\n";
  813.       print "<a href=\"$httplink\">$httplink</a>\n";
  814.       print "<a href=\"$glink\">$glink</a>\n";
  815.       print "</UL>\n</body>\n</HTML>\n";
  816.     }
  817.     return;
  818.   }
  819.   my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
  820.   if (-f $link) {
  821.     $link=~s/^\/ftp\///;
  822.     my($ftplink)="ftp://$host/$link";
  823.     my($httplink)="http://$host/$link";
  824.     my($glink)="gopher://$host:70/0/$link";
  825.     if ($accept =~ /text\/uri-list/) { #look for text/uri-list,
  826.         otherwise text/html
  827.       print "Status: 200 OK\n";
  828.       print "Content-type: text/uri-list\n\n\n";
  829.       print "#$urn\n";
  830.       print "$ftplink\n";
  831.       print "$httplink\n";
  832.       print "$glink\n";
  833.     }
  834.     if ($accept =~ /\*\/\*|text\/html/) {
  835.       print "Status: 200 OK\n";
  836.       print "Content-type: text/html\n\n<HTML>\n";
  837.       print "<head><title>URN Resolution: I2Ls</title></head>\n";
  838.       print "<BODY>\n";
  839.  
  840.  
  841.  
  842. Moats                        Informational                     [Page 15]
  843.  
  844. RFC 2648           A URN Namespace for IETF Documents        August 1999
  845.  
  846.  
  847.       print "<h1>URN $urn resolves to the following URLs:</h1>\n";
  848.       print "<hr><ul>\n";
  849.       print "<a href=\"$ftplink\">$ftplink</a>\n";
  850.       print "<a href=\"$httplink\">$httplink</a>\n";
  851.       print "<a href=\"$glink\">$glink</a>\n";
  852.       print "</UL>\n</body>\n</HTML>\n";
  853.     }
  854.  
  855.     return;
  856.   }
  857.   &urn_error("404 Not Found\n");
  858. }
  859.  
  860. sub resolve1 {
  861.   my($flag,@bib,$i,$k,$j,$done,@ref);
  862.   my($l,$link);
  863.   my($scheme, $value) = @_;
  864.   $scheme =~ tr/A-Z/a-z/;
  865.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  866.   my($try)="/ftp/$pathbase{$scheme}$value.txt";
  867.   if (-f $try) {
  868.     push(@urls, "http://$host/$pathbase{$scheme}$value.txt");
  869.     push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt");
  870.     push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt");
  871.   }
  872.   $try="/ftp/$pathbase{$scheme}$value.ps";
  873.   if (-f $try) {
  874.     push(@urls, "http://$host/$pathbase{$scheme}$value.ps");
  875.     push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps");
  876.     push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps");
  877.   }
  878.   $try="/ftp/$pathbase{$scheme}$value.html";
  879.   if (-f $try) {
  880.     push(@urls, "http://$host/$pathbase{$scheme}$value.html");
  881.     push(@urls, "ftp://$host/$pathbase{$scheme}$value.html");
  882.   }
  883.  
  884.   &urn_error("404 Not Found\n") if ($#urls == -1);
  885.  
  886. MIME_SWITCH: {
  887.     if ($accept =~ /text\/uri-list/) { #look for text/uri-list,
  888.         otherwise text/html
  889.       print "Status: 200 OK\n";
  890.       print "Content-type: text/uri-list\n\n\n";
  891.       print "#$urn\n";
  892.       foreach $i (@urls) {
  893.         print "$i\n";
  894.       }
  895.  
  896.  
  897.  
  898. Moats                        Informational                     [Page 16]
  899.  
  900. RFC 2648           A URN Namespace for IETF Documents        August 1999
  901.  
  902.  
  903.       last MIME_SWITCH;
  904.     }
  905.     if ($accept =~ /\*\/\*|text\/html/) {
  906.       print "Status: 200 OK\n";
  907.       print "Content-type: text/html\n\n<HTML>\n";
  908.       print "<head><title>URN Resolution: I2Ls</title></head>\n";
  909.       print "<BODY>\n";
  910.       print "<h1>URN $urn resolves to the following URLs:</h1>\n";
  911.       print "<hr><ul>\n";
  912.       foreach $i (@urls) {
  913.         print "<LI><A HREF=\"$i\">$i</A>\n";
  914.       }
  915.       print "</UL>\n</body>\n</HTML>\n";
  916.       last MIME_SWITCH;
  917.     }
  918.   }
  919. }
  920.  
  921. sub urn_error {
  922.   my($code) = @_; #store failure code here...
  923.  
  924.   print "Status: $code";
  925.   print "Content-type: text/html\n\n<HTML>\n";
  926.   print "<head><title>URN Resolution: I2L $code</title></head>\n";
  927.   print "<BODY>\n";
  928.   print "<h1>URN to URL resolution failed for the URN:</h1>\n";
  929.   print "<hr><h3>$urn</h3>\n";
  930.   print "</body>\n";
  931.   print "</html>\n";
  932.   exit;
  933. }
  934.  
  935. sub resolveid {
  936.   my($flag,@bib,$i,$k,$j,$done,@ref);
  937.   my($l,$link);
  938.   my($value) = @_;
  939.   my($scheme) = "id";
  940.   $scheme =~ tr/A-Z/a-z/;
  941.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  942.   my($try)="/ftp/$pathbase{$scheme}$value.txt";
  943.   if (-f $try) {
  944.     push(@urls, "http://$host/$pathbase{$scheme}$value.txt");
  945.     push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt");
  946.     push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt");
  947.   }
  948.   $try="/ftp/$pathbase{$scheme}$value.ps";
  949.   if (-f $try) {
  950.     push(@urls, "http://$host/$pathbase{$scheme}$value.ps");
  951.  
  952.  
  953.  
  954. Moats                        Informational                     [Page 17]
  955.  
  956. RFC 2648           A URN Namespace for IETF Documents        August 1999
  957.  
  958.  
  959.     push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps");
  960.     push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps");
  961.   }
  962.   $try="/ftp/$pathbase{$scheme}$value.html";
  963.   if (-f $try) {
  964.     push(@urls, "http://$host/$pathbase{$scheme}$value.html");
  965.     push(@urls, "ftp://$host/$pathbase{$scheme}$value.html");
  966.   }
  967.  
  968.   &urn_error("404 Not Found\n") if ($#urls == -1);
  969.  
  970. MIME_SWITCH: {
  971.     if ($accept =~ /text\/uri-list/) { #look for text/uri-list,
  972.         otherwise text/html
  973.       print "Status: 200 OK\n";
  974.       print "Content-type: text/uri-list\n\n\n";
  975.       print "#$urn\n";
  976.       foreach $i (@urls) {
  977.         print "$i\n";
  978.       }
  979.       last MIME_SWITCH;
  980.     }
  981.     if ($accept =~ /\*\/\*|text\/html/) {
  982.       print "Status: 200 OK\n";
  983.       print "Content-type: text/html\n\n<HTML>\n";
  984.       print "<head><title>URN Resolution: I2Ls</title></head>\n";
  985.       print "<BODY>\n";
  986.       print "<h1>URN $urn resolves to the following URLs:</h1>\n";
  987.       print "<hr><ul>\n";
  988.       foreach $i (@urls) {
  989.         print "<LI><A HREF=\"$i\">$i</A>\n";
  990.       }
  991.       print "</UL>\n</body>\n</HTML>\n";
  992.       last MIME_SWITCH;
  993.     }
  994.   }
  995. }
  996.  
  997. A.4 I2Ns
  998.  
  999. #!/usr/local/bin/perl
  1000.  
  1001. use strict;
  1002.  
  1003. #
  1004. # this is a URN 2 URNs resolver for the ietf namespace
  1005. #
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Moats                        Informational                     [Page 18]
  1011.  
  1012. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1013.  
  1014.  
  1015. my(%cite) = (
  1016.   rfc => "/ftp/rfc/rfc-index.txt",
  1017.   fyi => "/ftp/fyi/fyi-index.txt",
  1018.   std => "/ftp/std/std-index.txt",
  1019.   bcp => "/ftp/rfc/bcp-index.txt"
  1020. );
  1021.  
  1022. my(%number2date) = (
  1023.   44 => "99mar",
  1024.   43 => "98dec", 42 => "98aug", 41 => "98apr",
  1025.   40 => "97dec", 39 => "97aug", 38 => "97apr",
  1026.   37 => "96dec", 36 => "96jun", 35 => "96mar",
  1027.   34 => "95dec", 33 => "95jul", 32 => "95apr",
  1028.   31 => "94dec", 30 => "94jul", 29 => "94mar",
  1029.   28 => "93nov", 27 => "93jul", 26 => "93mar",
  1030.   25 => "92nov", 24 => "92jul", 23 => "92mar",
  1031.   22 => "91nov", 21 => "91jul", 20 => "91mar",
  1032.   19 => "90dec" );
  1033.  
  1034. my($wgpath) = "/ftp/ietf";
  1035. my($urn) = $ENV{'QUERY_STRING'};
  1036. my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
  1037. my($port) = $ENV={'SERVER_PORT'};
  1038. my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
  1039.  
  1040. (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
  1041. (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i);
  1042. &urn_error("400 Bad Request\n");
  1043.  
  1044. sub resolve2 {
  1045.   my($ietfnum, $sesnam) = @_;
  1046.   &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
  1047.   my($date)=$number2date{$ietfnum};
  1048.   my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
  1049.   if (-f $link) {
  1050.     if ($accept =~ /text\/uri-list/) {
  1051.         print "Status: 200 OK\n";
  1052.         print "Content-type: text/uri-list\n\n\n";
  1053.         print "#$urn\n";
  1054.         return;
  1055.     }
  1056.     if ($accept =~ /\*\/\*|text]\/html/) {
  1057.       print "Status: 200 OK\n";
  1058.       print "Content-type: text/html\n\n<HTML>\n";
  1059.       print "<head><title>URN Resolution: I2Ns</title></head>\n";
  1060.       print "<BODY>\n";
  1061.       print "<h1>URN $urn resolves to the following URNs:</h1>\n";
  1062.       print "<hr><ul>\n";
  1063.  
  1064.  
  1065.  
  1066. Moats                        Informational                     [Page 19]
  1067.  
  1068. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1069.  
  1070.  
  1071.       print "</UL>\n</body>\n</HTML>\n";
  1072.       return;
  1073.     }
  1074.   }
  1075.   my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
  1076.   if (-f $link) {
  1077.     if ($accept =~ /text\/uri-list/) {
  1078.         print "Status: 200 OK\n";
  1079.         print "Content-type: text/uri-list\n\n\n";
  1080.         print "#$urn\n";
  1081.         return;
  1082.     }
  1083.     if ($accept =~ /\*\/\*|text\/html/) {
  1084.         print "Status: 200 OK\n";
  1085.         print "Content-type: text/html\n\n<HTML>\n";
  1086.         print "<head><title>URN Resolution: I2Ns</title></head>\n";
  1087.         print "<BODY>\n";
  1088.         print "<h1>URN $urn resolves to the following URNs:</h1>\n";
  1089.         print "<hr><ul>\n";
  1090.         print "</UL>\n</body>\n</HTML>\n";
  1091.         return;
  1092.     }
  1093.   }
  1094.   &urn_error("404 Not Found\n");
  1095. }
  1096.  
  1097. sub end {
  1098.   my($inarg)=@_;
  1099.   return $inarg . "st" if ($inarg =~ /1$/);
  1100.   return $inarg . "nd" if ($inarg =~ /2$/);
  1101.   return $inarg . "rd" if ($inarg =~ /3$/);
  1102.   return $inarg . "th";
  1103. }
  1104.  
  1105. sub resolve1 {
  1106.   my($flag,@bib,$i,$k,$j,$done,@ref);
  1107.   my($l,$link);
  1108.   my($scheme, $value) = @_;
  1109.   $scheme =~ tr/A-Z/a-z/;
  1110.   if (!defined $cite{$scheme}) {
  1111.     &urn_error("404 Not Found\n");
  1112.   }
  1113.  
  1114.   $flag = 0;
  1115.   open(INPUT, "$cite{$scheme}");
  1116.   while (<INPUT>) {
  1117.     $flag = 1 if (/^0*$value /);
  1118.     if ($flag == 1) {
  1119.  
  1120.  
  1121.  
  1122. Moats                        Informational                     [Page 20]
  1123.  
  1124. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1125.  
  1126.  
  1127.       last if (/^$/);
  1128.       chop;
  1129.       push @bib,$_;
  1130.     }
  1131.   }
  1132.  
  1133.   $k=join " ",@bib;
  1134.   while ($k =~ /(\S*)\s*(fyi|std|rfc|bcp)\s*([0-9]+)(.*)/i) {
  1135.     $k=$4;
  1136.     $a=$2; $b=$3;
  1137.     if (($a ne $scheme || $b ne $value) && ($1 !~ /obso/i)){
  1138.       $a =~ tr/A-Z/a-z/;
  1139.       $b =~ s/^0*//;
  1140.       push @ref,"urn:ietf:$a:$b";
  1141.     }
  1142.   }
  1143.  
  1144. MIME_SWITCH: {
  1145.     if ($accept =~ /text\/uri-list/) {
  1146.         print "Status: 200 OK\n";
  1147.         print "Content-type: text/uri-list\n\n\n";
  1148.         print "#$urn\n";
  1149.         foreach $i (@ref) {
  1150.             print "$i\n";
  1151.         }
  1152.         last MIME_SWITCH;
  1153.     }
  1154.   if ($accept =~ /\*\/\*|text\/html/) {
  1155.     print "Status: 200 OK\n";
  1156.     print "Content-type: text/html\n\n<HTML>\n";
  1157.     print "<head><title>URN Resolution: I2Ns</title></head>\n";
  1158.     print "<BODY>\n";
  1159.     print "<h1>URN $urn resolves to the following URNs:</h1>\n";
  1160.     print "<hr><ul>\n";
  1161.         foreach $i (@ref) {
  1162.             print "<li>$i: Click to resolve using\n";
  1163.             print "<a
  1164. href=\"http://$host:$port/uri-res/I2C?$i\">I2C</a>,\n";
  1165.             print "<a
  1166. href=\"http://$host:$port/uri-res/I2L?$i\">I2L</a>,\n";
  1167.             print "<a
  1168. href=\"http://$host:$port/uri-res/I2Ls?$i\">I2Ls</a>,\n";
  1169.             print "<a
  1170. href=\"http://$host:$port/uri-res/I2R?$i\">I2R</a>,\n";
  1171.             print "<a
  1172. href=\"http://$host:$port/uri-res/I2Rs?$i\">I2Rs</a>\n";
  1173.         }
  1174.     print "</UL>\n</body>\n</HTML>\n";
  1175.  
  1176.  
  1177.  
  1178. Moats                        Informational                     [Page 21]
  1179.  
  1180. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1181.  
  1182.  
  1183.   }
  1184. }
  1185. }
  1186.  
  1187. sub make_link {
  1188.   my($sc);
  1189.   my($inarg)=@_;
  1190.   ($sc=$1) if ($inarg =~ /([a-z]*)/);
  1191.   return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps");
  1192.   return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html");
  1193.   return "/$sc/$inarg.txt";
  1194. }
  1195.  
  1196. sub urn_error {
  1197.   my($code) = @_; #store failure code here...
  1198.  
  1199.   print "Status: $code";
  1200.   print "Content-type: text/html\n\n<HTML>\n";
  1201.   print "<head><title>URN Resolution: I2Ns $code</title></head>\n";
  1202.   print "<BODY>\n";
  1203.   print "<h1>URN to URN resolution failed for the URN:</h1>\n";
  1204.   print "<hr><h3>$urn</h3>\n";
  1205.   print "</body>\n";
  1206.   print "</html>\n";
  1207.   exit;
  1208. };
  1209.  
  1210. A.5 I2R
  1211.  
  1212. #!/usr/local/bin/perl
  1213.  
  1214. use strict;
  1215.  
  1216. #
  1217. # this is a URN 2 resource resolver for the ietf namespace
  1218. #
  1219.  
  1220. my(%pathbase) = (
  1221.   rfc => "rfc/rfc",
  1222.   fyi => "fyi/fyi",
  1223.   std => "std/std",
  1224.   bcp => "bcp/bcp",
  1225.   id => "internet-drafts/draft-"
  1226. );
  1227.  
  1228. my(%number2date) = (
  1229.   44 => "99mar",
  1230.   43 => "98dec", 42 => "98aug", 41 => "98apr",
  1231.  
  1232.  
  1233.  
  1234. Moats                        Informational                     [Page 22]
  1235.  
  1236. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1237.  
  1238.  
  1239.   40 => "97dec", 39 => "97aug", 38 => "97apr",
  1240.   37 => "96dec", 36 => "96jun", 35 => "96mar",
  1241.   34 => "95dec", 33 => "95jul", 32 => "95apr",
  1242.   31 => "94dec", 30 => "94jul", 29 => "94mar",
  1243.   28 => "93nov", 27 => "93jul", 26 => "93mar",
  1244.   25 => "92nov", 24 => "92jul", 23 => "92mar",
  1245.   22 => "91nov", 21 => "91jul", 20 => "91mar",
  1246.   19 => "90dec" );
  1247.  
  1248. my($wgpath) = "/ftp/ietf";
  1249. my($urn) = $ENV{'QUERY_STRING'};
  1250. my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
  1251. my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
  1252.  
  1253. print "$urn\n";
  1254. (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i);
  1255. (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
  1256. (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i);
  1257. &urn_error("400 Bad Request\n");
  1258.  
  1259. sub resolve2 {
  1260.   my($ietfnum, $sesnam) = @_;
  1261.   &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
  1262.   my($date)=$number2date{$ietfnum};
  1263.   my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
  1264.   if (-f $link) {
  1265.       print "Status:  200 OK\n";
  1266.       print "Content-type: text/plain\n\n";
  1267.       open(FILE, "$link");
  1268.       while (<FILE>) {
  1269.           print $_;
  1270.       }
  1271.       close FILE;
  1272.     return;
  1273.   }
  1274.   my($link)="$wgpath/$date/$sesnam-minutes-$date.txt";
  1275.   if (-f $link) {
  1276.       print "Status:  200 OK\n";
  1277.       print "Content-type: text/plain\n\n";
  1278.       open(FILE, "$link");
  1279.       while (<FILE>) {
  1280.           print $_;
  1281.       }
  1282.       close FILE;
  1283.     return;
  1284.   }
  1285.   &urn_error("404 Not Found\n");
  1286. }
  1287.  
  1288.  
  1289.  
  1290. Moats                        Informational                     [Page 23]
  1291.  
  1292. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1293.  
  1294.  
  1295. sub end {
  1296.   my($inarg)=@_;
  1297.   return $inarg . "st" if ($inarg =~ /1$/);
  1298.   return $inarg . "nd" if ($inarg =~ /2$/);
  1299.   return $inarg . "rd" if ($inarg =~ /3$/);
  1300.   return $inarg . "th";
  1301. }
  1302.  
  1303. sub resolve1 {
  1304.   my($flag,@bib,$i,$k,$j,$done,@ref);
  1305.   my($l,$link);
  1306.   my($scheme, $value) = @_;
  1307.   $scheme =~ tr/A-Z/a-z/;
  1308.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  1309.   my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
  1310.   my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
  1311.   my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
  1312. MIME_SWITCH: {
  1313.     if ($accept =~ /application\/postscript/ && -f $pstry) {
  1314.       print "Status:  200 OK\n";
  1315.       print "Content-type: application/postscript\n\n";
  1316.       open(FILE, "$pstry");
  1317.       while (<FILE>) {
  1318.           print $_;
  1319.       }
  1320.       close FILE;
  1321.       last MIME_SWITCH;
  1322.     }
  1323.     if ($accept =~ /text\/html/ && -f $htmltry) {
  1324.         print "Status:  200 OK\n";
  1325.         print "Content-type: text/html\n\n";
  1326.         open(FILE, "$htmltry");
  1327.         while (<FILE>) {
  1328.             print $_;
  1329.         }
  1330.         close FILE;
  1331.         last MIME_SWITCH;
  1332.     }
  1333.     if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
  1334.         print "Status:  200 OK\n";
  1335.         print "Content-type: text/plain\n\n";
  1336.         open(FILE, "$txttry");
  1337.         while (<FILE>) {
  1338.             print $_;
  1339.         }
  1340.         close FILE;
  1341.         last MIME_SWITCH;
  1342.     }
  1343.  
  1344.  
  1345.  
  1346. Moats                        Informational                     [Page 24]
  1347.  
  1348. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1349.  
  1350.  
  1351.     &urn_error("404 Not Found\n");
  1352.   }
  1353. }
  1354.  
  1355. sub resolveid {
  1356.   my($flag,@bib,$i,$k,$j,$done,@ref);
  1357.   my($l,$link);
  1358.   my($scheme) = "id";
  1359.   my($value) = @_;
  1360.   $scheme =~ tr/A-Z/a-z/;
  1361.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  1362.   my($txttry)="/ftp/$pathbase{$scheme}$value.txt";
  1363.   my($pstry)="/ftp/$pathbase{$scheme}$value.ps";
  1364.   my($htmltry)="/ftp/$pathbase{$scheme}$value.html";
  1365. MIME_SWITCH: {
  1366.     if ($accept =~ /application\/postscript/ && -f $pstry) {
  1367.       print "Status:  200 OK\n";
  1368.       print "Content-type: application/postscript\n\n";
  1369.       open(FILE, "$pstry");
  1370.       while (<FILE>) {
  1371.           print $_;
  1372.       }
  1373.       close FILE;
  1374.       last MIME_SWITCH;
  1375.     }
  1376.     if ($accept =~ /text\/html/ && -f $htmltry) {
  1377.         print "Status:  200 OK\n";
  1378.         print "Content-type: text/html\n\n";
  1379.         open(FILE, "$htmltry");
  1380.         while (<FILE>) {
  1381.             print $_;
  1382.         }
  1383.         close FILE;
  1384.         last MIME_SWITCH;
  1385.     }
  1386.     if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) {
  1387.         print "Status:  200 OK\n";
  1388.         print "Content-type: text/plain\n\n";
  1389.         open(FILE, "$txttry");
  1390.         while (<FILE>) {
  1391.             print $_;
  1392.         }
  1393.         close FILE;
  1394.         last MIME_SWITCH;
  1395.     }
  1396.     &urn_error("404 Not Found\n");
  1397.   }
  1398. }
  1399.  
  1400.  
  1401.  
  1402. Moats                        Informational                     [Page 25]
  1403.  
  1404. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1405.  
  1406.  
  1407. sub urn_error {
  1408.   my($code) = @_; #store failure code here...
  1409.  
  1410.   print "Status:  $code";
  1411.   print "Content-type: text/html\n\n<HTML>\n";
  1412.   print "<head><title>URN Resolution: I2R $code</title></head>\n";
  1413.   print "<BODY>\n";
  1414.   print "<h1>URN to URL resolution failed for the URN:</h1>\n";
  1415.   print "<hr><h3>$urn</h3>\n";
  1416.   print "</body>\n";
  1417.   print "</html>\n";
  1418.   exit;
  1419. }
  1420.  
  1421. A.6 I2Rs
  1422.  
  1423. #!/usr/local/bin/perl
  1424.  
  1425. use strict;
  1426.  
  1427. #
  1428. # this is a URN 2 resources resolver for the ietf namespace
  1429. #
  1430.  
  1431. my(@urls);
  1432.  
  1433. my(%pathbase) = (
  1434.   rfc => "rfc/rfc",
  1435.   fyi => "fyi/fyi",
  1436.   std => "std/std",
  1437.   bcp => "bcp/bcp",
  1438.   id => "internet-drafts/draft-"
  1439. );
  1440.  
  1441. my(%number2date) = (
  1442.   44 => "99mar",
  1443.   43 => "98dec", 42 => "98aug", 41 => "98apr",
  1444.   40 => "97dec", 39 => "97aug", 38 => "97apr",
  1445.   37 => "96dec", 36 => "96jun", 35 => "96mar",
  1446.   34 => "95dec", 33 => "95jul", 32 => "95apr",
  1447.   31 => "94dec", 30 => "94jul", 29 => "94mar",
  1448.   28 => "93nov", 27 => "93jul", 26 => "93mar",
  1449.   25 => "92nov", 24 => "92jul", 23 => "92mar",
  1450.   22 => "91nov", 21 => "91jul", 20 => "91mar",
  1451.   19 => "90dec" );
  1452.  
  1453. my($wgpath) = "/ftp/ietf";
  1454. my($urn) = $ENV{'QUERY_STRING'};
  1455.  
  1456.  
  1457.  
  1458. Moats                        Informational                     [Page 26]
  1459.  
  1460. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1461.  
  1462.  
  1463. my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs
  1464. my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header
  1465.  
  1466. (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\s*)/i);
  1467. (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i);
  1468. (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i);
  1469. &urn_error("400 Bad Request\n");
  1470.  
  1471. sub resolve2 {
  1472.   my($ietfnum, $sesnam) = @_;
  1473.   my(@vers,$i);
  1474.   &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum});
  1475.   my($date)=$number2date{$ietfnum};
  1476.   my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt";
  1477.  
  1478.   if (-f $link) {
  1479.       push(@vers,$link);
  1480.   }
  1481.   $link="$wgpath/$date/$sesnam-minutes-$date.txt";
  1482.   if (-f $link) {
  1483.       push(@vers,$link);
  1484.   }
  1485.   &urn_error("404 Not Found\n") if ($#vers==-1);
  1486.  
  1487.   print "Status: 200 OK\n";
  1488.   print "Content-type: multipart/alternative; boundary=endpart\n\n";
  1489.   foreach $i (@vers) {
  1490.       print "--endpart\n";
  1491.       if ($i =~ /html$/) {
  1492.           print "Content-Type: text/html\n\n";
  1493.       }
  1494.       if ($i =~ /txt$/) {
  1495.           print "Content-Type: text/plain\n\n";
  1496.       }
  1497.       if ($i =~ /ps$/) {
  1498.           print "Content-Type: application/postscript\n\n";
  1499.       }
  1500.       open(FILE, "$i");
  1501.       while (<FILE>) {
  1502.           print "$_";
  1503.       }
  1504.       close FILE;
  1505.   }
  1506.   print "--endpart\n";
  1507. }
  1508.  
  1509. sub resolve1 {
  1510.   my($flag,@bib,$i,$k,$j,$done,@ref);
  1511.  
  1512.  
  1513.  
  1514. Moats                        Informational                     [Page 27]
  1515.  
  1516. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1517.  
  1518.  
  1519.   my($l,$link,@vers);
  1520.   my($scheme, $value) = @_;
  1521.   $scheme =~ tr/A-Z/a-z/;
  1522.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  1523.   my($try)="/ftp/$pathbase{$scheme}$value.txt";
  1524.   if (-f $try) {
  1525.       push(@vers, $try);
  1526.   }
  1527.   $try="/ftp/$pathbase{$scheme}$value.ps";
  1528.   if (-f $try) {
  1529.       push(@vers, $try);
  1530.   }
  1531.   $try="/ftp/$pathbase{$scheme}$value.html";
  1532.   if (-f $try) {
  1533.       push(@vers, $try);
  1534.  
  1535.   }
  1536.   print "Status: 200 OK\n";
  1537.   print "Content-type: multipart/alternative; boundary=endpart\n\n";
  1538.   foreach $i (@vers) {
  1539.       print "--endpart\n";
  1540.       if ($i =~ /html$/) {
  1541.           print "Content-Type: text/html\n\n";
  1542.       }
  1543.       if ($i =~ /txt$/) {
  1544.           print "Content-Type: text/plain\n\n";
  1545.       }
  1546.       if ($i =~ /ps$/) {
  1547.           print "Content-Type: application/postscript\n\n";
  1548.       }
  1549.       open(FILE, "$i");
  1550.       while (<FILE>) {
  1551.           print "$_";
  1552.       }
  1553.       close FILE;
  1554.   }
  1555.   print "--endpart\n";
  1556. }
  1557.  
  1558. sub resolveid {
  1559.   my($flag,@bib,$i,$k,$j,$done,@ref);
  1560.   my($l,$link,@vers);
  1561.   my($scheme) = "id";
  1562.   my($value) = @_;
  1563.   $scheme =~ tr/A-Z/a-z/;
  1564.   &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme});
  1565.   my($try)="/ftp/$pathbase{$scheme}$value.txt";
  1566.   if (-f $try) {
  1567.  
  1568.  
  1569.  
  1570. Moats                        Informational                     [Page 28]
  1571.  
  1572. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1573.  
  1574.  
  1575.       push(@vers, $try);
  1576.   }
  1577.   $try="/ftp/$pathbase{$scheme}$value.ps";
  1578.   if (-f $try) {
  1579.       push(@vers, $try);
  1580.   }
  1581.   $try="/ftp/$pathbase{$scheme}$value.html";
  1582.   if (-f $try) {
  1583.       push(@vers, $try);
  1584.   }
  1585.   print "Status: 200 OK\n";
  1586.   print "Content-type: multipart/alternative; boundary=endpart\n\n";
  1587.   foreach $i (@vers) {
  1588.       print "--endpart\n";
  1589.       if ($i =~ /html$/) {
  1590.           print "Content-Type: text/html\n\n";
  1591.  
  1592.       }
  1593.       if ($i =~ /txt$/) {
  1594.           print "Content-Type: text/plain\n\n";
  1595.       }
  1596.       if ($i =~ /ps$/) {
  1597.           print "Content-Type: application/postscript\n\n";
  1598.       }
  1599.       open(FILE, "$i");
  1600.       while (<FILE>) {
  1601.           print "$_";
  1602.       }
  1603.       close FILE;
  1604.   }
  1605.   print "--endpart\n";
  1606. }
  1607. sub urn_error {
  1608.   my($code) = @_; #store failure code here...
  1609.  
  1610.   print "Status: $code";
  1611.   print "Content-type: text/html\n\n<HTML>\n";
  1612.   print "<head><title>URN Resolution: I2Rs $code</title></head>\n";
  1613.   print "<BODY>\n";
  1614.   print "<h1>URN to URL resolution failed for the URN:</h1>\n";
  1615.   print "<hr><h3>$urn</h3>\n";
  1616.   print "</body>\n";
  1617.   print "</html>\n";
  1618.   exit;
  1619. }
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626. Moats                        Informational                     [Page 29]
  1627.  
  1628. RFC 2648           A URN Namespace for IETF Documents        August 1999
  1629.  
  1630.  
  1631. Full Copyright Statement
  1632.  
  1633.    Copyright (C) The Internet Society (1999).  All Rights Reserved.
  1634.  
  1635.    This document and translations of it may be copied and furnished to
  1636.    others, and derivative works that comment on or otherwise explain it
  1637.    or assist in its implementation may be prepared, copied, published
  1638.    and distributed, in whole or in part, without restriction of any
  1639.    kind, provided that the above copyright notice and this paragraph are
  1640.    included on all such copies and derivative works.  However, this
  1641.    document itself may not be modified in any way, such as by removing
  1642.    the copyright notice or references to the Internet Society or other
  1643.    Internet organizations, except as needed for the purpose of
  1644.    developing Internet standards in which case the procedures for
  1645.    copyrights defined in the Internet Standards process must be
  1646.    followed, or as required to translate it into languages other than
  1647.    English.
  1648.  
  1649.    The limited permissions granted above are perpetual and will not be
  1650.    revoked by the Internet Society or its successors or assigns.
  1651.  
  1652.    This document and the information contained herein is provided on an
  1653.    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  1654.    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  1655.    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  1656.    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  1657.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  1658.  
  1659. Acknowledgement
  1660.  
  1661.    Funding for the RFC Editor function is currently provided by the
  1662.    Internet Society.
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Moats                        Informational                     [Page 30]
  1683.  
  1684.