idnits 2.17.1 draft-ietf-urn-ietf-09.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing expiration date. The document expiration date should appear on the first and last page. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity -- however, there's a paragraph with a matching beginning. Boilerplate error? ** The document is more than 15 pages and seems to lack a Table of Contents. == No 'Intended status' indicated for this document; assuming Proposed Standard == It seems as if not all pages are separated by form feeds - found 0 form feeds but 29 pages Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 6 instances of too long lines in the document, the longest one being 3 characters in excess of 72. ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 212: '...escaping of characters in the NSS MUST...' Miscellaneous warnings: ---------------------------------------------------------------------------- -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (May 1999) is 9106 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: '0' is mentioned on line 380, but not defined -- Looks like a reference, but probably isn't: '0-9' on line 380 ** Obsolete normative reference: RFC 2141 (ref. '1') (Obsoleted by RFC 8141) ** Obsolete normative reference: RFC 2234 (ref. '2') (Obsoleted by RFC 4234) Summary: 10 errors (**), 0 flaws (~~), 3 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Internet-Draft Ryan Moats 2 draft-ietf-urn-ietf-09.txt AT&T 3 Expires in six months May 1999 5 A URN Namespace for IETF Documents 6 Filename: draft-ietf-urn-ietf-09.txt 8 Status of This Memo 10 This document is an Internet-Draft and is in full conformance with 11 all provisions of Section 10 of RFC2026. 13 Internet-Drafts are working documents of the Internet Engineering 14 Task Force (IETF), its areas, and its working groups. Note that 15 other groups may also distribute working documents as Internet- 16 Drafts. 18 Internet-Drafts are draft documents valid for a maximum of six 19 months and may be updated, replaced, or obsoleted by other 20 documents at any time. It is inappropriate to use Internet- 21 Drafts as reference material or to cite them other than as ``work 22 in progress.'' 24 The list of current Internet-Drafts can be accessed at 25 http://www.ietf.org/ietf/1id-abstracts.txt 27 The list of Internet-Draft Shadow Directories can be accessed at 28 http://www.ietf.org/shadow.html. 30 To learn the current status of any Internet-Draft, please check 31 the ``1id-abstracts.txt'' listing contained in the Internet- 32 Drafts Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net 33 (Europe), munnari.oz.au (Pacific Rim), ftp.ietf.org (US East 34 Coast), or ftp.isi.edu (US West Coast). 36 Abstract 38 A system for Uniform Resource Names (URNs) must be capable of 39 supporting new naming systems. As an example of proposing a new 40 namespace, this document proposes the "ietf" namespace. This 41 namespace consists of the RFC family of documents (RFCs, STDs, FYIs, 42 and BCPs) developed by the IETF and published by the RFC Editor, the 43 minutes of working groups (WG) and birds of a feather (BOF) meetings 44 that occur during IETF conferences, and the Internet Drafts published 45 by the Internet Drafts Editor. Both the current URN framework and 46 URN syntax support this namespace. 48 1. Introduction 50 This document proposes the "ietf" namespace, which consists of the 51 RFC family of documents (RFCs, STDs, FYIs, and BCPs) developed by the 52 IETF and published by the RFC editor and the minutes of working 53 groups (WG) and birds of a feather (BOF) meetings that occur during 54 IETF conferences. 56 The namespace specification is for a formal namespace. 58 2. Specification Template 60 Namespace ID: 62 "ietf" requested. 64 Registration Information: 66 Registration version number: 1 67 Registration date: 1999-04-22 69 Declared registrant of the namespace: 71 Ryan Moats 72 jayhawk@att.com 73 AT&T 74 15621 Drexel Circle 75 Omaha, NE 68135-2358 77 Declaration of structure: 79 The identifier has the following ABNF [2] specification: 81 NSS = rfc-nss / fyi-nss / std-nss / bcp-nss / 82 draft-nss / mtg-nss / other-nss 84 rfc-nss = "rfc:" 1*DIGIT 85 fyi-nss = "fyi:" 1*DIGIT 86 std-nss = "std:" 1*DIGIT 87 bcp-nss = "bcp:" 1*DIGIT 88 draft-nss = "id:" string 89 mtg-nss = "mtg:" string 90 other-nss = string 91 ; beginning with a prefix other than one of those 92 ; above for future expansion 94 string = 1*(DIGIT / ALPHA / "-") 96 If the IESG (or it successor) adds a new document 97 series, this ABNF specification will need to be 98 updated. Further, if a working group or BOF is 99 created that used characters outside the range of this 100 ABNF specification, this specification will need to be 101 updated. Any system intended to resolve names for 102 this namespace should be written with the awareness 103 that this could occur at any time. 105 Relevant ancillary documentation: 107 Relevant documentation is in draft-ietf-urn-ietf-09. 109 Identifier uniqueness considerations: 111 Because the rfc-editor assigns the RFC number uniquely 112 these URNs are unique. Since the mapping between RFCs 113 and other rfc-editor document series (STDs, FYIs or 114 BCPs) is not necessarily one-to-one, uniqueness of 115 STDs, FYIs and BCPs are defined based on the document 116 mappings maintained by the RFC Editor (the index files 117 "rfc-index.txt", "fyi-index.txt", "bcp-index.txt", 118 "std-index.txt") are defined to be the definitive 119 statement of the assignment of RFC Family URNs in this 120 namespace. The meeting minutes portion of the 121 namespace is guaranteed unique because the URN 122 includes the sequence number of the IETF conference. 123 The document mapping maintained by the Internet Drafts 124 editor ("1id-abstracts.txt") is defined as the 125 definitive statement of the assignment of URNs for 126 the internet draft portion of this namespace. 128 Identifier persistence considerations: 130 Persistence of the URNs of this namespace is 131 independent of the mutability of the underlying 132 documents. A URN once assigned will never be 133 reassigned to a different resource; the assignment is 134 persistent and immutable. Immutability of RFCs, STDs, 135 FYIs and BCPs is at the discretion of the RFC Editor. 136 They may be composites of one or more RFCs and the 137 set of RFCs that includes them may change with 138 time. It is important to note that this mutability of 139 some resources is independent of the immutability of 140 URN assignment to a resource. 142 Process of identifier assignment: 144 Assignment of URNs from this namespace occurs in three 145 ways. The first is through publication of a new RFC, 146 FYI, STD or BCP is by the RFC Editor. This new document 147 will have a new series number and will therefore define 148 a new URN. The document mappings maintained by the 149 RFC Editor (the index files "rfc-index.txt", 150 "fyi-index.txt", "bcp-index.txt" and "std-index.txt") 151 are defined to be the definitive statement of the 152 assignment of RFC Family URNs in this namespace. 154 The second way a URN is assigned is through the filing 155 of meeting minutes by a working group or birds of a 156 feather as part of an IETF conference. The list of 157 minutes maintained by the IETF for each working group 158 and conference in the subtree pointed at by the URL 159 ftp://ietf.org/ietf/ is considered the definitive 160 assignment of URNs for working group or birds of a 161 feather minutes. 163 The third way a URN is assigned is through the 164 publication of a new internet-draft by the Internet 165 Draft Editor. This draft will have a distinct name 166 (and version number) and therefore defined a new URN. 167 The document mapping maintained by the Internet Drafts 168 editor ("1id-abstracts.txt") is defined as the 169 definitive statement of the assignment of URNs for 170 this portion of the namespace. 172 Process of identifier resolution: 174 A mirrored copy of the underlying documentation is 175 required to resolve these URNs. Resolution via 176 HTTP is done by a set of simple Perl cgi-bin 177 scripts presented in Appendix A. 179 Rules for Lexical Equivalence: 181 The entire URN is case-insensitive. 183 Conformance with URN Syntax: 185 There are no additional characters reserved. 187 Validation mechanism: 189 None additional to resolution specified 191 Scope: 193 Global. 195 3. Examples 197 The following are examples of URNs that a resolver for this namespace 198 can resolve: 200 urn:ietf:rfc:2141 201 urn:ietf:std:50 202 urn:ietf:id:ietf-urn-ietf-06 203 urn:ietf:mtg:41-urn 205 4. Security Considerations 207 Because this namespace defines no additional reserved characters, it 208 does not add any security considerations beyond those inherent from 209 the existence of the reserved characters from [1]. Further, none of 210 the reserved characters from [1] are used in the definition of the 211 NSS. This means that resolvers for this namespace may be considered 212 "secure" in the sense that any escaping of characters in the NSS MUST 213 result in the resolver indicating that the URN has incorrect syntax. 215 5. Acknowledgments 217 Thanks to various members of the URN working group for comments on 218 earlier drafts of this document. The work described in this document 219 is partially supported by the National Science Foundation, 220 Cooperative Agreement NCR-9218179. 222 6. References 224 Request For Comments (RFC) and Internet Draft documents are available 225 from numerous mirror sites. 227 [1] R. Moats, "URN Syntax," RFC 2141, May 5, 1997. 229 [2] D. Crocker, P. Overell, "Augmented BNF for Syntax 230 Specifications: ABNF," RFC 2234, November 1997. 232 7. Author's Address 234 Ryan Moats 235 AT&T 236 15621 Drexel Circle 237 Omaha, NE 68135-2358 238 USA 240 Phone: +1 402 894-9456 241 EMail: jayhawk@att.com 243 Appendix A. Example Resolution Scripts 245 The following scripts are examples that can be used for resolving 246 URNs in this namespace. 248 A.1 I2C 250 #!/usr/local/bin/perl 252 use strict; 254 # 255 # this is a URN 2 URC resolver for the ietf namespace 256 # 258 my(%cite) = ( 259 bcp => "/ftp/rfc/bcp-index.txt", 260 fyi => "/ftp/fyi/fyi-index.txt", 261 id => "/ftp/internet-drafts/1id-abstracts.txt", 262 rfc => "/ftp/rfc/rfc-index.txt", 263 std => "/ftp/std/std-index.txt" 264 ); 265 my(%number2date) = ( 266 44 => "99mar", 267 43 => "98dec", 42 => "98aug", 41 => "98apr", 268 40 => "97dec", 39 => "97aug", 38 => "97apr", 269 37 => "96dec", 36 => "96jun", 35 => "96mar", 270 34 => "95dec", 33 => "95jul", 32 => "95apr", 271 31 => "94dec", 30 => "94jul", 29 => "94mar", 272 28 => "93nov", 27 => "93jul", 26 => "93mar", 273 25 => "92nov", 24 => "92jul", 23 => "92mar", 274 22 => "91nov", 21 => "91jul", 20 => "91mar", 275 19 => "90dec" ); 277 my($wgpath) = "/ftp/ietf"; 278 my($urn) = $ENV{'QUERY_STRING'}; 279 my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs 280 my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header 282 (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i); 283 (&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 284 (&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i); 285 &urn_error("400 Bad Request\n"); 287 sub resolvemtg { 288 my($ietfnum, $sesnam) = @_; 289 &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum}); 290 my($date)=$number2date{$ietfnum}; 291 my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; 292 if (-f $link) { 293 print "Status: 200 OK\r\n"; 294 print "Content-type: text/html\r\n\r\n"; 295 print "\nCitation for $urn\n"; 296 print "\n"; 297 print "

$urn:

\n"; 298 print "Minutes of the $sesnam working group from the " . &end($ietfnum) 299 . " IETF"; 300 print "\n\n"; 301 return; 302 } 303 my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; 304 if (-f $link) { 305 print "Status: 200 OK\r\n"; 306 print "Content-type: text/html\r\n\r\n"; 307 print "\nCitation for $urn\n"; 308 print "\n"; 309 print "

$urn:

\n"; 310 print "Minutes of the $sesnam working group from the " . &end($ietfnum) 311 . " IETF"; 312 print "\n\n"; 313 return; 314 } 315 &urn_error("404 Not Found\n"); 316 } 318 sub end { 319 my($inarg)=@_; 320 return $inarg . "st" if ($inarg =~ /1$/); 321 return $inarg . "nd" if ($inarg =~ /2$/); 322 return $inarg . "rd" if ($inarg =~ /3$/); 323 return $inarg . "th"; 324 } 326 sub resolverfc { 327 my($flag,@bib,$i,$k,$j,$done,@ref); 328 my($l,$link); 329 my($scheme, $value) = @_; 330 $scheme =~ tr/A-Z/a-z/; 331 if (!defined $cite{$scheme}) { 332 &urn_error("404 Not Found\n"); 333 } 335 $flag = 0; 336 open(INPUT, "$cite{$scheme}"); 337 while () { 338 $flag = 1 if (/^0*$value /); 339 if ($flag == 1) { 340 last if (/^$/); 341 chop; 342 push @bib,$_; 343 } 344 } 346 if ($scheme ne "rfc") { 347 print "Status: 200 OK\r\n"; 348 print "Content-type: text/html\r\n\r\n"; 349 $bib[0] =~ s/^[0-9]*\s*//; 350 for ($i=0; $i<=$#bib; $i+=1) { 351 last if ($bib[$i] =~ s/\./.<\/B>/); 352 } 353 for ($i=0;$i<=$#bib;$i+=1) { 354 $k=$bib[$i]; 355 while ($k =~ /(fyi|std|rfc|bcp)([0-9]+)(.*)/i) { 356 push @ref,"$1$2"; 357 $k=$3; 358 } 359 $done=""; 360 foreach $j (@ref) { 361 next if ($done =~ $j); 362 $done .= "$j "; 363 $l = $j; 364 $l =~ tr/A-Z/a-z/; 365 $link=&make_link("$l"); 366 $bib[$i] =~ s/$j/$j<\/A>/g; 367 } 368 } 369 print "\nCitation for $urn\n"; 370 print "\n"; 371 $link=&make_link("$scheme$value"); 372 print "

$scheme$value:

\n"; 373 foreach $i (@bib) { 374 print "$i\n"; 375 } 376 print "\n\n"; 377 } else { 378 print "Status: 200 OK\r\n"; 379 print "Content-type: text/html\r\n\r\n"; 380 $bib[0] =~ s/^[0-9]*\s*//; 381 $j=0; 382 for ($i=0; $i<=$#bib; $i+=1) { 383 $j += ($bib[$i] =~ s/, "/, "/); 384 $j += ($bib[$i] =~ s/",/"<\/B>,/); 385 } 386 for ($i=0;$i<=$#bib;$i+=1) { 387 $k=$bib[$i]; 388 while ($k =~ /(fyi\s|std\s|rfc|bcp)([0-9]+)(.*)/i) { 389 push @ref,"$1$2"; 390 $k=$3; 391 } 392 $done=""; 393 foreach $j (@ref) { 394 next if ($done =~ $j); 395 $done .= "$j "; 396 $l = $j; 397 $l =~ s/\s//g; 398 $l =~ tr/A-Z/a-z/; 399 $link=&make_link("$l"); 400 $bib[$i] =~ s/$j/$j<\/A>/g; 401 } 402 } 403 print "\nCitation for $urn\n"; 404 print "\n"; 405 $link=&make_link("$scheme$value"); 406 print "

$scheme$value:

\n"; 407 foreach $i (@bib) { 408 print "$i\n"; 409 } 410 print "\n\n"; 411 } 412 } 414 sub make_link { 415 my($sc); 416 my($inarg)=@_; 417 ($sc=$1) if ($inarg =~ /([a-z]*)/); 418 return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps"); 419 return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html"); 420 return "/$sc/$inarg.txt"; 421 } 423 sub urn_error { 424 my($code) = @_; #store failure code here... 426 print "Status: $code"; 427 print "Content-type: text/html\n\n\n"; 428 print "URN Resolution: I2C $code\n"; 429 print "\n"; 430 print "

URN to URC resolution failed for the URN:

\n"; 431 print "

$urn

\n"; 432 print "\n"; 433 print "\n"; 434 exit; 435 }; 436 sub resolveid { 437 my($flag,@bib,$i,$k,$j,$count,@ref); 438 my($l,$link, $hdr, $done); 439 my($value) = @_; 440 my($scheme) = "id"; 442 open(INPUT, "$cite{$scheme}"); 443 while () { 444 # 445 # capture record 446 # 447 if ($flag == 1 || /^\s+\"/) { 448 push @bib,$_; 449 ($hdr = -1, $count = 0, $flag = 1) if (/^\s+\"/); 450 $count++ if (/^\s+$/); 451 } 452 if ($count == 1) { 453 $hdr = $#bib if ($hdr == -1); 454 } 455 if ($count == 2) { 456 for ($i=0; $i<=$hdr; $i+=1) { 457 if ($bib[$i] =~ /<(.*)>/) { 458 $l = $1; 459 if ($l eq "draft-$value.txt" || $l eq "draft-$value.ps") { 460 print "Status: 200 OK\r\n"; 461 print "Content-type: text/html\r\n\r\n"; 462 print "\nCitation for $urn\n"; 463 print "\n"; 464 print "$l:\n"; 466 print "
\n";
467	                foreach $i (@bib) {
468	                  print "$i";
469	                }
470	                print "
\n"; 471 print "\n\n"; 472 exit; 473 } 474 } 475 } 476 $flag = 0; 477 @bib = (); 478 } 479 } 480 &urn_error("404 Not Found\n"); 481 } 482 A.2 I2L 484 #!/usr/local/bin/perl 486 use strict; 488 # 489 # this is a URN 2 URL resolver for the ietf namespace 490 # 492 my(%pathbase) = ( 493 rfc => "rfc/rfc", 494 fyi => "fyi/fyi", 495 std => "std/std", 496 bcp => "bcp/bcp", 497 id => "internet-drafts/draft-" 498 ); 500 my(%number2date) = ( 501 44 => "99mar", 502 43 => "98dec", 42 => "98aug", 41 => "98apr", 503 40 => "97dec", 39 => "97aug", 38 => "97apr", 504 37 => "96dec", 36 => "96jun", 35 => "96mar", 505 34 => "95dec", 33 => "95jul", 32 => "95apr", 506 31 => "94dec", 30 => "94jul", 29 => "94mar", 507 28 => "93nov", 27 => "93jul", 26 => "93mar", 508 25 => "92nov", 24 => "92jul", 23 => "92mar", 509 22 => "91nov", 21 => "91jul", 20 => "91mar", 510 19 => "90dec" ); 512 my($wgpath) = "/ftp/ietf"; 513 my($urn) = $ENV{'QUERY_STRING'}; 514 my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs 515 my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header 517 (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i); 518 (&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 519 (&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i); 520 &urn_error("400 Bad Request\n"); 522 sub resolvemtg { 523 my($ietfnum, $sesnam) = @_; 524 &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum}); 525 my($date)=$number2date{$ietfnum}; 526 my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; 527 if (-f $link) { 528 print "Status: 302 Moved temporarily\n"; 529 print "Location: $link\n"; 530 return; 531 } 532 my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; 533 if (-f $link) { 534 print "Status: 302 Moved temporarily\n"; 535 print "Location: $link\n"; 536 return; 537 } 538 &urn_error("404 Not Found\n"); 539 } 541 sub end { 542 my($inarg)=@_; 543 return $inarg . "st" if ($inarg =~ /1$/); 544 return $inarg . "nd" if ($inarg =~ /2$/); 545 return $inarg . "rd" if ($inarg =~ /3$/); 546 return $inarg . "th"; 547 } 549 sub resolverfc { 550 my($flag,@bib,$i,$k,$j,$done,@ref); 551 my($l,$link); 552 my($scheme, $value) = @_; 553 $scheme =~ tr/A-Z/a-z/; 554 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 555 my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; 556 my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; 557 my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; 558 MIME_SWITCH: { 559 if ($accept =~ /application\/postscript/ && -f $pstry) { 560 print "Status: 302 Moved temporarily\n"; 561 print "Location: http://$host/$pathbase{$scheme}$value.ps\n\n"; 562 last MIME_SWITCH; 563 } 564 if ($accept =~ /text\/html/ && -f $htmltry) { 565 print "Status: 302 Moved temporarily\n"; 566 print "Location: http://$host/$pathbase{$scheme}$value.html\n\n"; 567 last MIME_SWITCH; 568 } 569 if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) { 570 print "Status: 302 Moved temporarily\n"; 571 print "Location: http://$host/$pathbase{$scheme}$value.txt\n\n"; 572 last MIME_SWITCH; 573 } 574 &urn_error("404 Not Found\n"); 575 } 576 } 577 sub urn_error { 578 my($code) = @_; #store failure code here... 580 print "Status: $code"; 581 print "Content-type: text/html\n\n\n"; 582 print "URN Resolution: I2L $code\n"; 583 print "\n"; 584 print "

URN to URL resolution failed for the URN:

\n"; 585 print "

$urn

\n"; 586 print "\n"; 587 print "\n"; 588 exit; 589 } 591 sub resolveid { 592 my($flag,@bib,$i,$k,$j,$done,@ref); 593 my($l,$link); 594 my($scheme) = "id"; 595 my($value) = @_; 596 $scheme =~ tr/A-Z/a-z/; 597 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 598 my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; 599 my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; 600 my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; 601 MIME_SWITCH: { 602 if ($accept =~ /application\/postscript/ && -f $pstry) { 603 print "Status: 302 Moved temporarily\n"; 604 print "Location: http://$host/$pathbase{$scheme}$value.ps\n\n"; 605 last MIME_SWITCH; 606 } 607 if ($accept =~ /text\/html/ && -f $htmltry) { 608 print "Status: 302 Moved temporarily\n"; 609 print "Location: http://$host/$pathbase{$scheme}$value.html\n\n"; 610 last MIME_SWITCH; 611 } 612 if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) { 613 print "Status: 302 Moved temporarily\n"; 614 print "Location: http://$host/$pathbase{$scheme}$value.txt\n\n"; 615 last MIME_SWITCH; 616 } 617 &urn_error("404 Not Found\n"); 618 } 619 } 621 A.3 I2Ls 623 #!/usr/local/bin/perl 624 use strict; 626 # 627 # this is a URN 2 URLs resolver for the ietf namespace 628 # 630 my(@urls); 632 my(%pathbase) = ( 633 rfc => "rfc/rfc", 634 fyi => "fyi/fyi", 635 std => "std/std", 636 bcp => "bcp/bcp", 637 id => "internet-drafts/draft-" 638 ); 640 my(%number2date) = ( 641 44 => "99mar", 642 43 => "98dec", 42 => "98aug", 41 => "98apr", 643 40 => "97dec", 39 => "97aug", 38 => "97apr", 644 37 => "96dec", 36 => "96jun", 35 => "96mar", 645 34 => "95dec", 33 => "95jul", 32 => "95apr", 646 31 => "94dec", 30 => "94jul", 29 => "94mar", 647 28 => "93nov", 27 => "93jul", 26 => "93mar", 648 25 => "92nov", 24 => "92jul", 23 => "92mar", 649 22 => "91nov", 21 => "91jul", 20 => "91mar", 650 19 => "90dec" ); 652 my($wgpath) = "/ftp/ietf"; 653 my($urn) = $ENV{'QUERY_STRING'}; 654 my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs 655 my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header 657 (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i); 658 (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 659 (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i); 660 &urn_error("400 Bad Request\n"); 662 sub resolve2 { 663 my($ietfnum, $sesnam) = @_; 664 &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum}); 665 my($date)=$number2date{$ietfnum}; 666 my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; 667 if (-f $link) { 668 $link=~s/^\/ftp\///; 669 my($ftplink)="ftp://$host/$link"; 670 my($httplink)="http://$host/$link"; 671 my($glink)="gopher://$host:70/0/$link"; 672 if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise 673 text/html 674 print "Status: 200 OK\n"; 675 print "Content-type: text/uri-list\n\n\n"; 676 print "#$urn\n"; 677 print "$ftplink\n"; 678 print "$httplink\n"; 679 print "$glink\n"; 680 } 681 if ($accept =~ /\*\/\*|text\/html/) { 682 print "Status: 200 OK\n"; 683 print "Content-type: text/html\n\n\n"; 684 print "URN Resolution: I2Ls\n"; 685 print "\n"; 686 print "

URN $urn resolves to the following URLs:

\n"; 687 print "
\n\n\n"; 692 } 693 return; 694 } 695 my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; 696 if (-f $link) { 697 $link=~s/^\/ftp\///; 698 my($ftplink)="ftp://$host/$link"; 699 my($httplink)="http://$host/$link"; 700 my($glink)="gopher://$host:70/0/$link"; 701 if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise 702 text/html 703 print "Status: 200 OK\n"; 704 print "Content-type: text/uri-list\n\n\n"; 705 print "#$urn\n"; 706 print "$ftplink\n"; 707 print "$httplink\n"; 708 print "$glink\n"; 709 } 710 if ($accept =~ /\*\/\*|text\/html/) { 711 print "Status: 200 OK\n"; 712 print "Content-type: text/html\n\n\n"; 713 print "URN Resolution: I2Ls\n"; 714 print "\n"; 715 print "

URN $urn resolves to the following URLs:

\n"; 716 print "
\n\n\n"; 721 } 722 return; 723 } 724 &urn_error("404 Not Found\n"); 725 } 727 sub resolve1 { 728 my($flag,@bib,$i,$k,$j,$done,@ref); 729 my($l,$link); 730 my($scheme, $value) = @_; 731 $scheme =~ tr/A-Z/a-z/; 732 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 733 my($try)="/ftp/$pathbase{$scheme}$value.txt"; 734 if (-f $try) { 735 push(@urls, "http://$host/$pathbase{$scheme}$value.txt"); 736 push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt"); 737 push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt"); 738 } 739 $try="/ftp/$pathbase{$scheme}$value.ps"; 740 if (-f $try) { 741 push(@urls, "http://$host/$pathbase{$scheme}$value.ps"); 742 push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps"); 743 push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps"); 744 } 745 $try="/ftp/$pathbase{$scheme}$value.html"; 746 if (-f $try) { 747 push(@urls, "http://$host/$pathbase{$scheme}$value.html"); 748 push(@urls, "ftp://$host/$pathbase{$scheme}$value.html"); 749 } 751 &urn_error("404 Not Found\n") if ($#urls == -1); 753 MIME_SWITCH: { 754 if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise 755 text/html 756 print "Status: 200 OK\n"; 757 print "Content-type: text/uri-list\n\n\n"; 758 print "#$urn\n"; 759 foreach $i (@urls) { 760 print "$i\n"; 761 } 762 last MIME_SWITCH; 763 } 764 if ($accept =~ /\*\/\*|text\/html/) { 765 print "Status: 200 OK\n"; 766 print "Content-type: text/html\n\n\n"; 767 print "URN Resolution: I2Ls\n"; 768 print "\n"; 769 print "

URN $urn resolves to the following URLs:

\n"; 770 print "
    \n"; 771 foreach $i (@urls) { 772 print "
  • $i\n"; 773 } 774 print "
\n\n\n"; 775 last MIME_SWITCH; 776 } 777 } 778 } 780 sub urn_error { 781 my($code) = @_; #store failure code here... 783 print "Status: $code"; 784 print "Content-type: text/html\n\n\n"; 785 print "URN Resolution: I2L $code\n"; 786 print "\n"; 787 print "

URN to URL resolution failed for the URN:

\n"; 788 print "

$urn

\n"; 789 print "\n"; 790 print "\n"; 791 exit; 792 } 794 sub resolveid { 795 my($flag,@bib,$i,$k,$j,$done,@ref); 796 my($l,$link); 797 my($value) = @_; 798 my($scheme) = "id"; 799 $scheme =~ tr/A-Z/a-z/; 800 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 801 my($try)="/ftp/$pathbase{$scheme}$value.txt"; 802 if (-f $try) { 803 push(@urls, "http://$host/$pathbase{$scheme}$value.txt"); 804 push(@urls, "ftp://$host/$pathbase{$scheme}$value.txt"); 805 push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.txt"); 806 } 807 $try="/ftp/$pathbase{$scheme}$value.ps"; 808 if (-f $try) { 809 push(@urls, "http://$host/$pathbase{$scheme}$value.ps"); 810 push(@urls, "ftp://$host/$pathbase{$scheme}$value.ps"); 811 push(@urls, "gopher://$host:70/0/$pathbase{$scheme}$value.ps"); 812 } 813 $try="/ftp/$pathbase{$scheme}$value.html"; 814 if (-f $try) { 815 push(@urls, "http://$host/$pathbase{$scheme}$value.html"); 816 push(@urls, "ftp://$host/$pathbase{$scheme}$value.html"); 817 } 818 &urn_error("404 Not Found\n") if ($#urls == -1); 820 MIME_SWITCH: { 821 if ($accept =~ /text\/uri-list/) { #look for text/uri-list, otherwise 822 text/html 823 print "Status: 200 OK\n"; 824 print "Content-type: text/uri-list\n\n\n"; 825 print "#$urn\n"; 826 foreach $i (@urls) { 827 print "$i\n"; 828 } 829 last MIME_SWITCH; 830 } 831 if ($accept =~ /\*\/\*|text\/html/) { 832 print "Status: 200 OK\n"; 833 print "Content-type: text/html\n\n\n"; 834 print "URN Resolution: I2Ls\n"; 835 print "\n"; 836 print "

URN $urn resolves to the following URLs:

\n"; 837 print "
    \n"; 838 foreach $i (@urls) { 839 print "
  • $i\n"; 840 } 841 print "
\n\n\n"; 842 last MIME_SWITCH; 843 } 844 } 845 } 847 A.4 I2Ns 849 #!/usr/local/bin/perl 851 use strict; 853 # 854 # this is a URN 2 URNs resolver for the ietf namespace 855 # 857 my(%cite) = ( 858 rfc => "/ftp/rfc/rfc-index.txt", 859 fyi => "/ftp/fyi/fyi-index.txt", 860 std => "/ftp/std/std-index.txt", 861 bcp => "/ftp/rfc/bcp-index.txt" 862 ); 864 my(%number2date) = ( 865 44 => "99mar", 866 43 => "98dec", 42 => "98aug", 41 => "98apr", 867 40 => "97dec", 39 => "97aug", 38 => "97apr", 868 37 => "96dec", 36 => "96jun", 35 => "96mar", 869 34 => "95dec", 33 => "95jul", 32 => "95apr", 870 31 => "94dec", 30 => "94jul", 29 => "94mar", 871 28 => "93nov", 27 => "93jul", 26 => "93mar", 872 25 => "92nov", 24 => "92jul", 23 => "92mar", 873 22 => "91nov", 21 => "91jul", 20 => "91mar", 874 19 => "90dec" ); 876 my($wgpath) = "/ftp/ietf"; 877 my($urn) = $ENV{'QUERY_STRING'}; 878 my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs 879 my($port) = $ENV={'SERVER_PORT'}; 880 my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header 882 (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 883 (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i); 884 &urn_error("400 Bad Request\n"); 886 sub resolve2 { 887 my($ietfnum, $sesnam) = @_; 888 &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum}); 889 my($date)=$number2date{$ietfnum}; 890 my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; 891 if (-f $link) { 892 if ($accept =~ /text\/uri-list/) { 893 print "Status: 200 OK\n"; 894 print "Content-type: text/uri-list\n\n\n"; 895 print "#$urn\n"; 896 return; 897 } 898 if ($accept =~ /\*\/\*|text\/html/) { 899 print "Status: 200 OK\n"; 900 print "Content-type: text/html\n\n\n"; 901 print "URN Resolution: I2Ns\n"; 902 print "\n"; 903 print "

URN $urn resolves to the following URNs:

\n"; 904 print "
    \n"; 905 print "
\n\n\n"; 906 return; 907 } 908 } 909 my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; 910 if (-f $link) { 911 if ($accept =~ /text\/uri-list/) { 912 print "Status: 200 OK\n"; 913 print "Content-type: text/uri-list\n\n\n"; 914 print "#$urn\n"; 915 return; 916 } 917 if ($accept =~ /\*\/\*|text\/html/) { 918 print "Status: 200 OK\n"; 919 print "Content-type: text/html\n\n\n"; 920 print "URN Resolution: I2Ns\n"; 921 print "\n"; 922 print "

URN $urn resolves to the following URNs:

\n"; 923 print "
    \n"; 924 print "
\n\n\n"; 925 return; 926 } 927 } 928 &urn_error("404 Not Found\n"); 929 } 931 sub end { 932 my($inarg)=@_; 933 return $inarg . "st" if ($inarg =~ /1$/); 934 return $inarg . "nd" if ($inarg =~ /2$/); 935 return $inarg . "rd" if ($inarg =~ /3$/); 936 return $inarg . "th"; 937 } 939 sub resolve1 { 940 my($flag,@bib,$i,$k,$j,$done,@ref); 941 my($l,$link); 942 my($scheme, $value) = @_; 943 $scheme =~ tr/A-Z/a-z/; 944 if (!defined $cite{$scheme}) { 945 &urn_error("404 Not Found\n"); 946 } 948 $flag = 0; 949 open(INPUT, "$cite{$scheme}"); 950 while () { 951 $flag = 1 if (/^0*$value /); 952 if ($flag == 1) { 953 last if (/^$/); 954 chop; 955 push @bib,$_; 956 } 957 } 959 $k=join " ",@bib; 960 while ($k =~ /(\S*)\s*(fyi|std|rfc|bcp)\s*([0-9]+)(.*)/i) { 961 $k=$4; 962 $a=$2; $b=$3; 963 if (($a ne $scheme || $b ne $value) && ($1 !~ /obso/i)){ 964 $a =~ tr/A-Z/a-z/; 965 $b =~ s/^0*//; 966 push @ref,"urn:ietf:$a:$b"; 967 } 968 } 970 MIME_SWITCH: { 971 if ($accept =~ /text\/uri-list/) { 972 print "Status: 200 OK\n"; 973 print "Content-type: text/uri-list\n\n\n"; 974 print "#$urn\n"; 975 foreach $i (@ref) { 976 print "$i\n"; 977 } 978 last MIME_SWITCH; 979 } 980 if ($accept =~ /\*\/\*|text\/html/) { 981 print "Status: 200 OK\n"; 982 print "Content-type: text/html\n\n\n"; 983 print "URN Resolution: I2Ns\n"; 984 print "\n"; 985 print "

URN $urn resolves to the following URNs:

\n"; 986 print "
    \n"; 987 foreach $i (@ref) { 988 print "
  • $i: Click to resolve using\n"; 989 print "I2C,\n"; 991 print "I2L,\n"; 993 print "I2Ls,\n"; 995 print "I2R,\n"; 997 print "I2Rs\n"; 999 } 1000 print "
\n\n\n"; 1001 } 1002 } 1003 } 1005 sub make_link { 1006 my($sc); 1007 my($inarg)=@_; 1008 ($sc=$1) if ($inarg =~ /([a-z]*)/); 1009 return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps"); 1010 return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html"); 1011 return "/$sc/$inarg.txt"; 1012 } 1014 sub urn_error { 1015 my($code) = @_; #store failure code here... 1017 print "Status: $code"; 1018 print "Content-type: text/html\n\n\n"; 1019 print "URN Resolution: I2Ns $code\n"; 1020 print "\n"; 1021 print "

URN to URN resolution failed for the URN:

\n"; 1022 print "

$urn

\n"; 1023 print "\n"; 1024 print "\n"; 1025 exit; 1026 }; 1028 A.5 I2R 1030 #!/usr/local/bin/perl 1032 use strict; 1034 # 1035 # this is a URN 2 resource resolver for the ietf namespace 1036 # 1038 my(%pathbase) = ( 1039 rfc => "rfc/rfc", 1040 fyi => "fyi/fyi", 1041 std => "std/std", 1042 bcp => "bcp/bcp", 1043 id => "internet-drafts/draft-" 1044 ); 1046 my(%number2date) = ( 1047 44 => "99mar", 1048 43 => "98dec", 42 => "98aug", 41 => "98apr", 1049 40 => "97dec", 39 => "97aug", 38 => "97apr", 1050 37 => "96dec", 36 => "96jun", 35 => "96mar", 1051 34 => "95dec", 33 => "95jul", 32 => "95apr", 1052 31 => "94dec", 30 => "94jul", 29 => "94mar", 1053 28 => "93nov", 27 => "93jul", 26 => "93mar", 1054 25 => "92nov", 24 => "92jul", 23 => "92mar", 1055 22 => "91nov", 21 => "91jul", 20 => "91mar", 1056 19 => "90dec" ); 1058 my($wgpath) = "/ftp/ietf"; 1059 my($urn) = $ENV{'QUERY_STRING'}; 1060 my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs 1061 my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header 1063 print "$urn\n"; 1064 (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i); 1065 (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 1066 (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i); 1067 &urn_error("400 Bad Request\n"); 1069 sub resolve2 { 1070 my($ietfnum, $sesnam) = @_; 1071 &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum}); 1072 my($date)=$number2date{$ietfnum}; 1073 my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; 1074 if (-f $link) { 1075 print "Status: 200 OK\n"; 1076 print "Content-type: text/plain\n\n"; 1077 open(FILE, "$link"); 1078 while () { 1079 print $_; 1080 } 1081 close FILE; 1082 return; 1083 } 1084 my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; 1085 if (-f $link) { 1086 print "Status: 200 OK\n"; 1087 print "Content-type: text/plain\n\n"; 1088 open(FILE, "$link"); 1089 while () { 1090 print $_; 1091 } 1092 close FILE; 1093 return; 1094 } 1095 &urn_error("404 Not Found\n"); 1096 } 1098 sub end { 1099 my($inarg)=@_; 1100 return $inarg . "st" if ($inarg =~ /1$/); 1101 return $inarg . "nd" if ($inarg =~ /2$/); 1102 return $inarg . "rd" if ($inarg =~ /3$/); 1103 return $inarg . "th"; 1104 } 1106 sub resolve1 { 1107 my($flag,@bib,$i,$k,$j,$done,@ref); 1108 my($l,$link); 1109 my($scheme, $value) = @_; 1110 $scheme =~ tr/A-Z/a-z/; 1111 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 1112 my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; 1113 my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; 1114 my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; 1115 MIME_SWITCH: { 1116 if ($accept =~ /application\/postscript/ && -f $pstry) { 1117 print "Status: 200 OK\n"; 1118 print "Content-type: application/postscript\n\n"; 1119 open(FILE, "$pstry"); 1120 while () { 1121 print $_; 1122 } 1123 close FILE; 1124 last MIME_SWITCH; 1125 } 1126 if ($accept =~ /text\/html/ && -f $htmltry) { 1127 print "Status: 200 OK\n"; 1128 print "Content-type: text/html\n\n"; 1129 open(FILE, "$htmltry"); 1130 while () { 1131 print $_; 1132 } 1133 close FILE; 1134 last MIME_SWITCH; 1135 } 1136 if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) { 1137 print "Status: 200 OK\n"; 1138 print "Content-type: text/plain\n\n"; 1139 open(FILE, "$txttry"); 1140 while () { 1141 print $_; 1142 } 1143 close FILE; 1144 last MIME_SWITCH; 1145 } 1146 &urn_error("404 Not Found\n"); 1147 } 1148 } 1150 sub resolveid { 1151 my($flag,@bib,$i,$k,$j,$done,@ref); 1152 my($l,$link); 1153 my($scheme) = "id"; 1154 my($value) = @_; 1155 $scheme =~ tr/A-Z/a-z/; 1156 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 1157 my($txttry)="/ftp/$pathbase{$scheme}$value.txt"; 1158 my($pstry)="/ftp/$pathbase{$scheme}$value.ps"; 1159 my($htmltry)="/ftp/$pathbase{$scheme}$value.html"; 1160 MIME_SWITCH: { 1161 if ($accept =~ /application\/postscript/ && -f $pstry) { 1162 print "Status: 200 OK\n"; 1163 print "Content-type: application/postscript\n\n"; 1164 open(FILE, "$pstry"); 1165 while () { 1166 print $_; 1167 } 1168 close FILE; 1169 last MIME_SWITCH; 1170 } 1171 if ($accept =~ /text\/html/ && -f $htmltry) { 1172 print "Status: 200 OK\n"; 1173 print "Content-type: text/html\n\n"; 1174 open(FILE, "$htmltry"); 1175 while () { 1176 print $_; 1177 } 1178 close FILE; 1179 last MIME_SWITCH; 1180 } 1181 if ($accept =~ /\*\/\*|text\/plain/ && -f $txttry) { 1182 print "Status: 200 OK\n"; 1183 print "Content-type: text/plain\n\n"; 1184 open(FILE, "$txttry"); 1185 while () { 1186 print $_; 1187 } 1188 close FILE; 1189 last MIME_SWITCH; 1190 } 1191 &urn_error("404 Not Found\n"); 1192 } 1193 } 1195 sub urn_error { 1196 my($code) = @_; #store failure code here... 1198 print "Status: $code"; 1199 print "Content-type: text/html\n\n\n"; 1200 print "URN Resolution: I2R $code\n"; 1201 print "\n"; 1202 print "

URN to URL resolution failed for the URN:

\n"; 1203 print "

$urn

\n"; 1204 print "\n"; 1205 print "\n"; 1206 exit; 1207 } 1208 A.6 I2Rs 1210 #!/usr/local/bin/perl 1212 use strict; 1214 # 1215 # this is a URN 2 resources resolver for the ietf namespace 1216 # 1218 my(@urls); 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 ); 1228 my(%number2date) = ( 1229 44 => "99mar", 1230 43 => "98dec", 42 => "98aug", 41 => "98apr", 1231 40 => "97dec", 39 => "97aug", 38 => "97apr", 1232 37 => "96dec", 36 => "96jun", 35 => "96mar", 1233 34 => "95dec", 33 => "95jul", 32 => "95apr", 1234 31 => "94dec", 30 => "94jul", 29 => "94mar", 1235 28 => "93nov", 27 => "93jul", 26 => "93mar", 1236 25 => "92nov", 24 => "92jul", 23 => "92mar", 1237 22 => "91nov", 21 => "91jul", 20 => "91mar", 1238 19 => "90dec" ); 1240 my($wgpath) = "/ftp/ietf"; 1241 my($urn) = $ENV{'QUERY_STRING'}; 1242 my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs 1243 my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header 1245 (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\s*)/i); 1246 (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 1247 (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg:(\d*)-(\w*)/i); 1248 &urn_error("400 Bad Request\n"); 1250 sub resolve2 { 1251 my($ietfnum, $sesnam) = @_; 1252 my(@vers,$i); 1253 &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum}); 1254 my($date)=$number2date{$ietfnum}; 1255 my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; 1256 if (-f $link) { 1257 push(@vers,$link); 1258 } 1259 $link="$wgpath/$date/$sesnam-minutes-$date.txt"; 1260 if (-f $link) { 1261 push(@vers,$link); 1262 } 1263 &urn_error("404 Not Found\n") if ($#vers==-1); 1265 print "Status: 200 OK\n"; 1266 print "Content-type: multipart/alternative; boundary=endpart\n\n"; 1267 foreach $i (@vers) { 1268 print "--endpart\n"; 1269 if ($i =~ /html$/) { 1270 print "Content-Type: text/html\n\n"; 1271 } 1272 if ($i =~ /txt$/) { 1273 print "Content-Type: text/plain\n\n"; 1274 } 1275 if ($i =~ /ps$/) { 1276 print "Content-Type: application/postscript\n\n"; 1277 } 1278 open(FILE, "$i"); 1279 while () { 1280 print "$_"; 1281 } 1282 close FILE; 1283 } 1284 print "--endpart\n"; 1285 } 1287 sub resolve1 { 1288 my($flag,@bib,$i,$k,$j,$done,@ref); 1289 my($l,$link,@vers); 1290 my($scheme, $value) = @_; 1291 $scheme =~ tr/A-Z/a-z/; 1292 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 1293 my($try)="/ftp/$pathbase{$scheme}$value.txt"; 1294 if (-f $try) { 1295 push(@vers, $try); 1296 } 1297 $try="/ftp/$pathbase{$scheme}$value.ps"; 1298 if (-f $try) { 1299 push(@vers, $try); 1300 } 1301 $try="/ftp/$pathbase{$scheme}$value.html"; 1302 if (-f $try) { 1303 push(@vers, $try); 1305 } 1306 print "Status: 200 OK\n"; 1307 print "Content-type: multipart/alternative; boundary=endpart\n\n"; 1308 foreach $i (@vers) { 1309 print "--endpart\n"; 1310 if ($i =~ /html$/) { 1311 print "Content-Type: text/html\n\n"; 1312 } 1313 if ($i =~ /txt$/) { 1314 print "Content-Type: text/plain\n\n"; 1315 } 1316 if ($i =~ /ps$/) { 1317 print "Content-Type: application/postscript\n\n"; 1318 } 1319 open(FILE, "$i"); 1320 while () { 1321 print "$_"; 1322 } 1323 close FILE; 1324 } 1325 print "--endpart\n"; 1326 } 1328 sub resolveid { 1329 my($flag,@bib,$i,$k,$j,$done,@ref); 1330 my($l,$link,@vers); 1331 my($scheme) = "id"; 1332 my($value) = @_; 1333 $scheme =~ tr/A-Z/a-z/; 1334 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 1335 my($try)="/ftp/$pathbase{$scheme}$value.txt"; 1336 if (-f $try) { 1337 push(@vers, $try); 1338 } 1339 $try="/ftp/$pathbase{$scheme}$value.ps"; 1340 if (-f $try) { 1341 push(@vers, $try); 1342 } 1343 $try="/ftp/$pathbase{$scheme}$value.html"; 1344 if (-f $try) { 1345 push(@vers, $try); 1346 } 1347 print "Status: 200 OK\n"; 1348 print "Content-type: multipart/alternative; boundary=endpart\n\n"; 1349 foreach $i (@vers) { 1350 print "--endpart\n"; 1351 if ($i =~ /html$/) { 1352 print "Content-Type: text/html\n\n"; 1354 } 1355 if ($i =~ /txt$/) { 1356 print "Content-Type: text/plain\n\n"; 1357 } 1358 if ($i =~ /ps$/) { 1359 print "Content-Type: application/postscript\n\n"; 1360 } 1361 open(FILE, "$i"); 1362 while () { 1363 print "$_"; 1364 } 1365 close FILE; 1366 } 1367 print "--endpart\n"; 1368 } 1369 sub urn_error { 1370 my($code) = @_; #store failure code here... 1372 print "Status: $code"; 1373 print "Content-type: text/html\n\n\n"; 1374 print "URN Resolution: I2Rs $code\n"; 1375 print "\n"; 1376 print "

URN to URL resolution failed for the URN:

\n"; 1377 print "

$urn

\n"; 1378 print "\n"; 1379 print "\n"; 1380 exit; 1381 }