idnits 2.17.1 draft-ietf-urn-ietf-08.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 8 instances of too long lines in the document, the longest one being 4 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 218: '...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 (November 1998) is 9288 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 386, but not defined -- Looks like a reference, but probably isn't: '0-9' on line 386 ** 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-08.txt AT&T 3 Expires in six months November 1998 5 A URN Namespace for IETF Documents 6 Filename: draft-ietf-urn-ietf-08.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 = (family ":" number) / ("mtg-" number "-" wgbofname) 82 ( "id:" name) 83 family = "rfc" / "std" / "fyi" / "bcp" 84 number = 1*DIGIT 85 wgbofname = 1*(DIGIT/ALPHA) 86 name = "draft-" draft-name "-" draft-version 88 draft-name = draft-ietf / draft-individual / draft-rfced 89 draft-ietf = "ietf-" wgbofname "-" draft-title 90 draft-individual = draft-author "-" draft-title 91 draft-rfced = "rfced-" draft-title 92 draft-title = draft-namepart *( "-" draft-namepart ) 94 draft-author = 1*(DIGIT/ALPHA) 95 draft-nameart = 1*(DIGIT/ALPHA) 96 wgbofname = 1*(DIGIT/ALPHA) 97 number = 1*DIGIT 98 draft-version = 2*DIGIT 100 If the IESG (or it successor) adds a new document 101 series, this ABNF specification will need to be 102 updated. Further, if a working group or BOF is 103 created that used characters outside the range of this 104 ABNF specification, this specification will need to be 105 updated. Any system intended to resolve names for 106 this namespace should be written with the awareness 107 that this could occur at any time. 109 Relevant ancillary documentation: 111 The intended RFC document is currently 112 draft-ietf-urn-ietf-08. 114 Identifier uniqueness considerations: 116 Because the rfc-editor assigns the RFC number uniquely 117 these URNs are unique. Since the mapping between RFCs 118 and other rfc-editor document series (STDs, FYIs or 119 BCPs) is not necessarily one-to-one, uniqueness of 120 STDs, FYIs and BCPs are defined based on the document 121 mappings maintained by the RFC Editor (the index files 122 "rfc-index.txt", "fyi-index.txt", "bcp-index.txt", 123 "std-index.txt") are defined to be the definitive 124 statement of the assignment of RFC Family URNs in this 125 namespace. The meeting minutes portion of the 126 namespace is guaranteed unique because the URN 127 includes the sequence number of the IETF conference. 128 The document mapping maintained by the Internet Drafts 129 editor ("1id-abstracts.txt") is defined as the 130 definitive statement of the assignment of URNs for 131 the internet draft portion of this namespace. 133 Identifier persistence considerations: 135 Persistence of the URNs of this namespace is 136 independent of the mutability of the underlying 137 documents. A URN once assigned will never be 138 reassigned to a different resource; the assignment is 139 persistent and immutable. Distinct from this, the 140 resources identified as RFCs are immutable, whereas 141 the other sorts of documents, STDs, FYIs, and BCPs are 142 not. They may be composites of one or more RFCs and 143 the set of RFCs that includes them may change with 144 time. It is important to note that this mutability of 145 some resources is independent of the immutability of 146 URN assignment to a resource. 148 Process of identifier assignment: 150 Assignment of URNs from this namespace occurs in three 151 ways. The first is through publication of a new RFC, 152 FYI, STD or BCP is by the RFC Editor. This new document 153 will have a new series number and will therefore define 154 a new URN. The document mappings maintained by the 155 RFC Editor (the index files "rfc-index.txt", 156 "fyi-index.txt", "bcp-index.txt" and "std-index.txt") 157 are defined to be the definitive statement of the 158 assignment of RFC Family URNs in this namespace. 160 The second way a URN is assigned is through the filing 161 of meeting minutes by a working group or birds of a 162 feather as part of an IETF conference. The list of 163 minutes maintained by the IETF for each working group 164 and conference in the subtree pointed at by the URL 165 ftp://ietf.org/ietf/ is considered the definitive 166 assignment of URNs for working group or birds of a 167 feather minutes. 169 The third way a URN is assigned is through the 170 publication of a new internet-draft by the Internet 171 Draft Editor. This draft will have a distinct name 172 (and version number) and therefore defined a new URN. 173 The document mapping maintained by the Internet Drafts 174 editor ("1id-abstracts.txt") is defined as the 175 definitive statement of the assignment of URNs for 176 this portion of the namespace. 178 Process of identifier resolution: 180 A mirrored copy of the underlying documentation is 181 required to resolve these URNs. Resolution via 182 HTTP is done by a set of simple Perl cgi-bin 183 scripts presented in Appendix A. 185 Rules for Lexical Equivalence: 187 The entire URN is case-insensitive. 189 Conformance with URN Syntax: 191 There are no additional characters reserved. 193 Validation mechanism: 195 None additional to resolution specified 197 Scope: 199 Global. 201 3. Examples 203 The following are examples of URNs that a resolver for this namespace 204 can resolve: 206 urn:ietf:rfc:2141 207 urn:ietf:std:50 208 urn:ietf:id:ietf-urn-ietf-06 209 urn:ietf:mtg-41-urn 211 4. Security Considerations 213 Because this namespace defines no additional reserved characters, it 214 does not add any security considerations beyond those inherent from 215 the existence of the reserved characters from [1]. Further, none of 216 the reserved characters from [1] are used in the definition of the 217 NSS. This means that resolvers for this namespace may be considered 218 "secure" in the sense that any escaping of characters in the NSS MUST 219 result in the resolver indicating that the URN has incorrect syntax. 221 5. Acknowledgments 223 Thanks to various members of the URN working group for comments on 224 earlier drafts of this document. The work described in this document 225 is partially supported by the National Science Foundation, 226 Cooperative Agreement NCR-9218179. 228 6. References 230 Request For Comments (RFC) and Internet Draft documents are available 231 from numerous mirror sites. 233 [1] R. Moats, "URN Syntax," RFC 2141, May 5, 1997. 235 [2] D. Crocker, P. Overell, "Augmented BNF for Syntax 236 Specifications: ABNF," RFC 2234, November 1997. 238 7. Author's Address 240 Ryan Moats 241 AT&T 242 15621 Drexel Circle 243 Omaha, NE 68135-2358 244 USA 246 Phone: +1 402 894-9456 247 EMail: jayhawk@att.com 249 Appendix A. Example Resolution Scripts 251 The following scripts are examples that can be used for resolving 252 URNs in this namespace. 254 A.1 I2C 256 #!/usr/local/bin/perl 258 use strict; 260 # 261 # this is a URN 2 URC resolver for the ietf namespace 262 # 264 my(%cite) = ( 265 bcp => "/ftp/rfc/bcp-index.txt", 266 fyi => "/ftp/fyi/fyi-index.txt", 267 id => "/ftp/internet-drafts/1id-abstracts.txt", 268 rfc => "/ftp/rfc/rfc-index.txt", 269 std => "/ftp/std/std-index.txt" 270 ); 271 my(%number2date) = ( 272 44 => "99mar", 273 43 => "98dec", 42 => "98aug", 41 => "98apr", 274 40 => "97dec", 39 => "97aug", 38 => "97apr", 275 37 => "96dec", 36 => "96jun", 35 => "96mar", 276 34 => "95dec", 33 => "95jul", 32 => "95apr", 277 31 => "94dec", 30 => "94jul", 29 => "94mar", 278 28 => "93nov", 27 => "93jul", 26 => "93mar", 279 25 => "92nov", 24 => "92jul", 23 => "92mar", 280 22 => "91nov", 21 => "91jul", 20 => "91mar", 281 19 => "90dec" ); 283 my($wgpath) = "/ftp/ietf"; 284 my($urn) = $ENV{'QUERY_STRING'}; 285 my($host) = $ENV{'SERVER_NAME'}; #get my host name for ftp: URLs 286 my($accept) = $ENV{'HTTP_ACCEPT'}; #this is the "Accept:" HTTP header 288 (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\S+)/i); 289 (&resolverfc($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 290 (&resolvemtg($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i); 291 &urn_error("400 Bad Request\n"); 293 sub resolvemtg { 294 my($ietfnum, $sesnam) = @_; 295 &urn_error("404 Not Found\n") if (!defined $number2date{$ietfnum}); 296 my($date)=$number2date{$ietfnum}; 297 my($link)="$wgpath/$sesnam/$sesnam-minutes-$date.txt"; 298 if (-f $link) { 299 print "Status: 200 OK\r\n"; 300 print "Content-type: text/html\r\n\r\n"; 301 print "\nCitation for $urn\n"; 302 print "\n"; 303 print "

$urn:

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

$urn:

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

$scheme$value:

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

$scheme$value:

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

URN to URC resolution failed for the URN:

\n"; 437 print "

$urn

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

URN to URL resolution failed for the URN:

\n"; 593 print "

$urn

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

URN $urn resolves to the following URLs:

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

URN $urn resolves to the following URLs:

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

URN $urn resolves to the following URLs:

\n"; 778 print "
    \n"; 779 foreach $i (@urls) { 780 print "
  • $i\n"; 781 } 782 print "
\n\n\n"; 783 last MIME_SWITCH; 784 } 785 } 786 } 788 sub urn_error { 789 my($code) = @_; #store failure code here... 791 print "Status: $code"; 792 print "Content-type: text/html\n\n\n"; 793 print "URN Resolution: I2L $code\n"; 794 print "\n"; 795 print "

URN to URL resolution failed for the URN:

\n"; 796 print "

$urn

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

URN $urn resolves to the following URLs:

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

URN $urn resolves to the following URNs:

\n"; 912 print "
    \n"; 913 print "
\n\n\n"; 914 return; 915 } 916 } 917 my($link)="$wgpath/$date/$sesnam-minutes-$date.txt"; 918 if (-f $link) { 919 if ($accept =~ /text\/uri-list/) { 920 print "Status: 200 OK\n"; 921 print "Content-type: text/uri-list\n\n\n"; 922 print "#$urn\n"; 923 return; 924 } 925 if ($accept =~ /\*\/\*|text\/html/) { 926 print "Status: 200 OK\n"; 927 print "Content-type: text/html\n\n\n"; 928 print "URN Resolution: I2Ns\n"; 929 print "\n"; 930 print "

URN $urn resolves to the following URNs:

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

URN $urn resolves to the following URNs:

\n"; 994 print "
    \n"; 995 foreach $i (@ref) { 996 print "
  • $i: Click to resolve using\n"; 997 print "I2C,\n"; 999 print "I2L,\n"; 1001 print "I2Ls,\n"; 1003 print "I2R,\n"; 1005 print "I2Rs\n"; 1007 } 1008 print "
\n\n\n"; 1009 } 1010 } 1011 } 1013 sub make_link { 1014 my($sc); 1015 my($inarg)=@_; 1016 ($sc=$1) if ($inarg =~ /([a-z]*)/); 1017 return "/$sc/$inarg.ps" if (-e "/ftp/$sc/$inarg.ps"); 1018 return "/$sc/$inarg.html" if (-e "/ftp/$sc/$inarg.html"); 1019 return "/$sc/$inarg.txt"; 1020 } 1022 sub urn_error { 1023 my($code) = @_; #store failure code here... 1025 print "Status: $code"; 1026 print "Content-type: text/html\n\n\n"; 1027 print "URN Resolution: I2Ns $code\n"; 1028 print "\n"; 1029 print "

URN to URN resolution failed for the URN:

\n"; 1030 print "

$urn

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

URN to URL resolution failed for the URN:

\n"; 1211 print "

$urn

\n"; 1212 print "\n"; 1213 print "\n"; 1214 exit; 1215 } 1216 A.6 I2Rs 1218 #!/usr/local/bin/perl 1220 use strict; 1222 # 1223 # this is a URN 2 resources resolver for the ietf namespace 1224 # 1226 my(@urls); 1228 my(%pathbase) = ( 1229 rfc => "rfc/rfc", 1230 fyi => "fyi/fyi", 1231 std => "std/std", 1232 bcp => "bcp/bcp", 1233 id => "internet-drafts/draft-" 1234 ); 1236 my(%number2date) = ( 1237 44 => "99mar", 1238 43 => "98dec", 42 => "98aug", 41 => "98apr", 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" ); 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 1253 (&resolveid($1), exit) if ($urn =~ /urn:ietf:id:(\s*)/i); 1254 (&resolve1($1, $2), exit) if ($urn =~ /urn:ietf:(\w*):(\d*)/i); 1255 (&resolve2($1, $2), exit) if ($urn =~ /urn:ietf:mtg-(\d*)-(\w*)/i); 1256 &urn_error("400 Bad Request\n"); 1258 sub resolve2 { 1259 my($ietfnum, $sesnam) = @_; 1260 my(@vers,$i); 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 push(@vers,$link); 1266 } 1267 $link="$wgpath/$date/$sesnam-minutes-$date.txt"; 1268 if (-f $link) { 1269 push(@vers,$link); 1270 } 1271 &urn_error("404 Not Found\n") if ($#vers==-1); 1273 print "Status: 200 OK\n"; 1274 print "Content-type: multipart/alternative; boundary=endpart\n\n"; 1275 foreach $i (@vers) { 1276 print "--endpart\n"; 1277 if ($i =~ /html$/) { 1278 print "Content-Type: text/html\n\n"; 1279 } 1280 if ($i =~ /txt$/) { 1281 print "Content-Type: text/plain\n\n"; 1282 } 1283 if ($i =~ /ps$/) { 1284 print "Content-Type: application/postscript\n\n"; 1285 } 1286 open(FILE, "$i"); 1287 while () { 1288 print "$_"; 1289 } 1290 close FILE; 1291 } 1292 print "--endpart\n"; 1293 } 1295 sub resolve1 { 1296 my($flag,@bib,$i,$k,$j,$done,@ref); 1297 my($l,$link,@vers); 1298 my($scheme, $value) = @_; 1299 $scheme =~ tr/A-Z/a-z/; 1300 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 1301 my($try)="/ftp/$pathbase{$scheme}$value.txt"; 1302 if (-f $try) { 1303 push(@vers, $try); 1304 } 1305 $try="/ftp/$pathbase{$scheme}$value.ps"; 1306 if (-f $try) { 1307 push(@vers, $try); 1308 } 1309 $try="/ftp/$pathbase{$scheme}$value.html"; 1310 if (-f $try) { 1311 push(@vers, $try); 1313 } 1314 print "Status: 200 OK\n"; 1315 print "Content-type: multipart/alternative; boundary=endpart\n\n"; 1316 foreach $i (@vers) { 1317 print "--endpart\n"; 1318 if ($i =~ /html$/) { 1319 print "Content-Type: text/html\n\n"; 1320 } 1321 if ($i =~ /txt$/) { 1322 print "Content-Type: text/plain\n\n"; 1323 } 1324 if ($i =~ /ps$/) { 1325 print "Content-Type: application/postscript\n\n"; 1326 } 1327 open(FILE, "$i"); 1328 while () { 1329 print "$_"; 1330 } 1331 close FILE; 1332 } 1333 print "--endpart\n"; 1334 } 1336 sub resolveid { 1337 my($flag,@bib,$i,$k,$j,$done,@ref); 1338 my($l,$link,@vers); 1339 my($scheme) = "id"; 1340 my($value) = @_; 1341 $scheme =~ tr/A-Z/a-z/; 1342 &urn_error("404 Not Found\n")if (!defined $pathbase{$scheme}); 1343 my($try)="/ftp/$pathbase{$scheme}$value.txt"; 1344 if (-f $try) { 1345 push(@vers, $try); 1346 } 1347 $try="/ftp/$pathbase{$scheme}$value.ps"; 1348 if (-f $try) { 1349 push(@vers, $try); 1350 } 1351 $try="/ftp/$pathbase{$scheme}$value.html"; 1352 if (-f $try) { 1353 push(@vers, $try); 1354 } 1355 print "Status: 200 OK\n"; 1356 print "Content-type: multipart/alternative; boundary=endpart\n\n"; 1357 foreach $i (@vers) { 1358 print "--endpart\n"; 1359 if ($i =~ /html$/) { 1360 print "Content-Type: text/html\n\n"; 1362 } 1363 if ($i =~ /txt$/) { 1364 print "Content-Type: text/plain\n\n"; 1365 } 1366 if ($i =~ /ps$/) { 1367 print "Content-Type: application/postscript\n\n"; 1368 } 1369 open(FILE, "$i"); 1370 while () { 1371 print "$_"; 1372 } 1373 close FILE; 1374 } 1375 print "--endpart\n"; 1376 } 1377 sub urn_error { 1378 my($code) = @_; #store failure code here... 1380 print "Status: $code"; 1381 print "Content-type: text/html\n\n\n"; 1382 print "URN Resolution: I2Rs $code\n"; 1383 print "\n"; 1384 print "

URN to URL resolution failed for the URN:

\n"; 1385 print "

$urn

\n"; 1386 print "\n"; 1387 print "\n"; 1388 exit; 1389 }