0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20 /*.** Copyright
0010: 28 63 29 20 32 30 30 37 20 44 2e 20 52 69 63 68 (c) 2007 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54 ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66 his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75 u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20 te it and/or.**
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20 modify it under
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 the terms of the
0090: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 GNU General Pub
00a0: 6c 69 63 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 76 lic.** License v
00b0: 65 72 73 69 6f 6e 20 32 20 61 73 20 70 75 62 6c ersion 2 as publ
00c0: 69 73 68 65 64 20 62 79 20 74 68 65 20 46 72 65 ished by the Fre
00d0: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
00e0: 61 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 54 68 69 ation..**.** Thi
00f0: 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73 s program is dis
0100: 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20 tributed in the
0110: 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c hope that it wil
0120: 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20 l be useful,.**
0130: 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20 but WITHOUT ANY
0140: 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 WARRANTY; withou
0150: 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69 t even the impli
0160: 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a ed warranty of.*
0170: 2a 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 * MERCHANTABILIT
0180: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 Y or FITNESS FOR
0190: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 A PARTICULAR PU
01a0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20 RPOSE. See the
01b0: 47 4e 55 0a 2a 2a 20 47 65 6e 65 72 61 6c 20 50 GNU.** General P
01c0: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f ublic License fo
01d0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a r more details..
01e0: 2a 2a 20 0a 2a 2a 20 59 6f 75 20 73 68 6f 75 6c ** .** You shoul
01f0: 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20 d have received
0200: 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 47 4e a copy of the GN
0210: 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 U General Public
0220: 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 61 6c 6f 6e .** License alon
0230: 67 20 77 69 74 68 20 74 68 69 73 20 6c 69 62 72 g with this libr
0240: 61 72 79 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69 ary; if not, wri
0250: 74 65 20 74 6f 20 74 68 65 0a 2a 2a 20 46 72 65 te to the.** Fre
0260: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
0270: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20 ation, Inc., 59
0280: 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d 20 53 Temple Place - S
0290: 75 69 74 65 20 33 33 30 2c 0a 2a 2a 20 42 6f 73 uite 330,.** Bos
02a0: 74 6f 6e 2c 20 4d 41 20 20 30 32 31 31 31 2d 31 ton, MA 02111-1
02b0: 33 30 37 2c 20 55 53 41 2e 0a 2a 2a 0a 2a 2a 20 307, USA..**.**
02c0: 41 75 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69 Author contact i
02d0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20 nformation:.**
02e0: 20 64 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a drh@hwaci.com.*
02f0: 2a 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68 * http://www.h
0300: 77 61 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a waci.com/drh/.**
0310: 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a .***************
0320: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0330: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0340: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0350: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0360: 0a 2a 2a 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65 .**.** This file
0370: 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 74 contains code t
0380: 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 o implement the
0390: 22 2f 64 6f 63 22 20 77 65 62 20 70 61 67 65 20 "/doc" web page
03a0: 61 6e 64 20 72 65 6c 61 74 65 64 0a 2a 2a 20 70 and related.** p
03b0: 61 67 65 73 2e 0a 2a 2f 0a 23 69 6e 63 6c 75 64 ages..*/.#includ
03c0: 65 20 22 63 6f 6e 66 69 67 2e 68 22 0a 23 69 6e e "config.h".#in
03d0: 63 6c 75 64 65 20 22 64 6f 63 2e 68 22 0a 23 69 clude "doc.h".#i
03e0: 6e 63 6c 75 64 65 20 3c 61 73 73 65 72 74 2e 68 nclude <assert.h
03f0: 3e 0a 0a 2f 2a 0a 2a 2a 20 47 75 65 73 73 20 74 >../*.** Guess t
0400: 68 65 20 6d 69 6d 65 2d 74 79 70 65 20 6f 66 20 he mime-type of
0410: 61 20 64 6f 63 75 6d 65 6e 74 20 62 61 73 65 64 a document based
0420: 20 6f 6e 20 69 74 73 20 6e 61 6d 65 2e 0a 2a 2f on its name..*/
0430: 0a 63 6f 6e 73 74 20 63 68 61 72 20 2a 6d 69 6d .const char *mim
0440: 65 74 79 70 65 5f 66 72 6f 6d 5f 6e 61 6d 65 28 etype_from_name(
0450: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4e 61 6d const char *zNam
0460: 65 29 7b 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 e){. const char
0470: 20 2a 7a 3b 0a 20 20 69 6e 74 20 69 3b 0a 20 20 *z;. int i;.
0480: 69 6e 74 20 66 69 72 73 74 2c 20 6c 61 73 74 3b int first, last;
0490: 0a 20 20 69 6e 74 20 6c 65 6e 3b 0a 20 20 63 68 . int len;. ch
04a0: 61 72 20 7a 53 75 66 66 69 78 5b 32 30 5d 3b 0a ar zSuffix[20];.
04b0: 0a 20 20 2f 2a 20 41 20 74 61 62 6c 65 20 6f 66 . /* A table of
04c0: 20 6d 69 6d 65 74 79 70 65 73 20 62 61 73 65 64 mimetypes based
04d0: 20 6f 6e 20 66 69 6c 65 20 73 75 66 66 69 78 65 on file suffixe
04e0: 73 2e 20 0a 20 20 2a 2a 20 53 75 66 66 69 78 65 s. . ** Suffixe
04f0: 73 20 6d 75 73 74 20 62 65 20 69 6e 20 73 6f 72 s must be in sor
0500: 74 65 64 20 6f 72 64 65 72 20 73 6f 20 74 68 61 ted order so tha
0510: 74 20 77 65 20 63 61 6e 20 64 6f 20 61 20 62 69 t we can do a bi
0520: 6e 61 72 79 0a 20 20 2a 2a 20 73 65 61 72 63 68 nary. ** search
0530: 20 74 6f 20 66 69 6e 64 20 74 68 65 20 6d 69 6d to find the mim
0540: 65 2d 74 79 70 65 0a 20 20 2a 2f 0a 20 20 73 74 e-type. */. st
0550: 61 74 69 63 20 63 6f 6e 73 74 20 73 74 72 75 63 atic const struc
0560: 74 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 t {. const ch
0570: 61 72 20 2a 7a 53 75 66 66 69 78 3b 20 20 20 20 ar *zSuffix;
0580: 20 20 20 2f 2a 20 54 68 65 20 66 69 6c 65 20 73 /* The file s
0590: 75 66 66 69 78 20 2a 2f 0a 20 20 20 20 69 6e 74 uffix */. int
05a0: 20 73 69 7a 65 3b 20 20 20 20 20 20 20 20 20 20 size;
05b0: 20 20 20 20 20 20 20 20 2f 2a 20 4c 65 6e 67 74 /* Lengt
05c0: 68 20 6f 66 20 74 68 65 20 73 75 66 66 69 78 20 h of the suffix
05d0: 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 */. const cha
05e0: 72 20 2a 7a 4d 69 6d 65 74 79 70 65 3b 20 20 20 r *zMimetype;
05f0: 20 20 2f 2a 20 54 68 65 20 63 6f 72 72 65 73 70 /* The corresp
0600: 6f 6e 64 69 6e 67 20 6d 69 6d 65 74 79 70 65 20 onding mimetype
0610: 2a 2f 0a 20 20 7d 20 61 4d 69 6d 65 5b 5d 20 3d */. } aMime[] =
0620: 20 7b 0a 20 20 20 20 7b 20 22 61 69 22 2c 20 20 {. { "ai",
0630: 20 20 20 20 20 20 20 32 2c 20 22 61 70 70 6c 69 2, "appli
0640: 63 61 74 69 6f 6e 2f 70 6f 73 74 73 63 72 69 70 cation/postscrip
0650: 74 22 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c t" },
0660: 0a 20 20 20 20 7b 20 22 61 69 66 22 2c 20 20 20 . { "aif",
0670: 20 20 20 20 20 33 2c 20 22 61 75 64 69 6f 2f 78 3, "audio/x
0680: 2d 61 69 66 66 22 20 20 20 20 20 20 20 20 20 20 -aiff"
0690: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
06a0: 20 20 20 7b 20 22 61 69 66 63 22 2c 20 20 20 20 { "aifc",
06b0: 20 20 20 34 2c 20 22 61 75 64 69 6f 2f 78 2d 61 4, "audio/x-a
06c0: 69 66 66 22 20 20 20 20 20 20 20 20 20 20 20 20 iff"
06d0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
06e0: 20 7b 20 22 61 69 66 66 22 2c 20 20 20 20 20 20 { "aiff",
06f0: 20 34 2c 20 22 61 75 64 69 6f 2f 78 2d 61 69 66 4, "audio/x-aif
0700: 66 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 f"
0710: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
0720: 20 22 61 72 6a 22 2c 20 20 20 20 20 20 20 20 33 "arj", 3
0730: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 , "application/x
0740: 2d 61 72 6a 2d 63 6f 6d 70 72 65 73 73 65 64 22 -arj-compressed"
0750: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
0760: 61 73 63 22 2c 20 20 20 20 20 20 20 20 33 2c 20 asc", 3,
0770: 22 74 65 78 74 2f 70 6c 61 69 6e 22 20 20 20 20 "text/plain"
0780: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0790: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 61 73 },. { "as
07a0: 66 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 76 f", 3, "v
07b0: 69 64 65 6f 2f 78 2d 6d 73 2d 61 73 66 22 20 20 ideo/x-ms-asf"
07c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
07d0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 61 73 78 22 },. { "asx"
07e0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 76 69 64 , 3, "vid
07f0: 65 6f 2f 78 2d 6d 73 2d 61 73 78 22 20 20 20 20 eo/x-ms-asx"
0800: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0810: 7d 2c 0a 20 20 20 20 7b 20 22 61 75 22 2c 20 20 },. { "au",
0820: 20 20 20 20 20 20 20 32 2c 20 22 61 75 64 69 6f 2, "audio
0830: 2f 75 6c 61 77 22 20 20 20 20 20 20 20 20 20 20 /ulaw"
0840: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
0850: 0a 20 20 20 20 7b 20 22 61 76 69 22 2c 20 20 20 . { "avi",
0860: 20 20 20 20 20 33 2c 20 22 76 69 64 65 6f 2f 78 3, "video/x
0870: 2d 6d 73 76 69 64 65 6f 22 20 20 20 20 20 20 20 -msvideo"
0880: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
0890: 20 20 20 7b 20 22 62 61 74 22 2c 20 20 20 20 20 { "bat",
08a0: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
08b0: 6f 6e 2f 78 2d 6d 73 64 6f 73 2d 70 72 6f 67 72 on/x-msdos-progr
08c0: 61 6d 22 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 am" },.
08d0: 20 7b 20 22 62 63 70 69 6f 22 2c 20 20 20 20 20 { "bcpio",
08e0: 20 35 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 5, "application
08f0: 2f 78 2d 62 63 70 69 6f 22 20 20 20 20 20 20 20 /x-bcpio"
0900: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
0910: 20 22 62 69 6e 22 2c 20 20 20 20 20 20 20 20 33 "bin", 3
0920: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6f , "application/o
0930: 63 74 65 74 2d 73 74 72 65 61 6d 22 20 20 20 20 ctet-stream"
0940: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
0950: 63 63 61 64 22 2c 20 20 20 20 20 20 20 34 2c 20 ccad", 4,
0960: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 63 6c 61 "application/cla
0970: 72 69 73 63 61 64 22 20 20 20 20 20 20 20 20 20 riscad"
0980: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 63 63 },. { "cc
0990: 22 2c 20 20 20 20 20 20 20 20 20 32 2c 20 22 74 ", 2, "t
09a0: 65 78 74 2f 70 6c 61 69 6e 22 20 20 20 20 20 20 ext/plain"
09b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
09c0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 63 64 66 22 },. { "cdf"
09d0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
09e0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 6e 65 74 63 64 lication/x-netcd
09f0: 66 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 f"
0a00: 7d 2c 0a 20 20 20 20 7b 20 22 63 6c 61 73 73 22 },. { "class"
0a10: 2c 20 20 20 20 20 20 35 2c 20 22 61 70 70 6c 69 , 5, "appli
0a20: 63 61 74 69 6f 6e 2f 6f 63 74 65 74 2d 73 74 72 cation/octet-str
0a30: 65 61 6d 22 20 20 20 20 20 20 20 20 20 20 7d 2c eam" },
0a40: 0a 20 20 20 20 7b 20 22 63 6f 64 22 2c 20 20 20 . { "cod",
0a50: 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 3, "applica
0a60: 74 69 6f 6e 2f 76 6e 64 2e 72 69 6d 2e 63 6f 64 tion/vnd.rim.cod
0a70: 22 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 " },.
0a80: 20 20 20 7b 20 22 63 6f 6d 22 2c 20 20 20 20 20 { "com",
0a90: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
0aa0: 6f 6e 2f 78 2d 6d 73 64 6f 73 2d 70 72 6f 67 72 on/x-msdos-progr
0ab0: 61 6d 22 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 am" },.
0ac0: 20 7b 20 22 63 70 69 6f 22 2c 20 20 20 20 20 20 { "cpio",
0ad0: 20 34 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 4, "application
0ae0: 2f 78 2d 63 70 69 6f 22 20 20 20 20 20 20 20 20 /x-cpio"
0af0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
0b00: 20 22 63 70 74 22 2c 20 20 20 20 20 20 20 20 33 "cpt", 3
0b10: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6d , "application/m
0b20: 61 63 2d 63 6f 6d 70 61 63 74 70 72 6f 22 20 20 ac-compactpro"
0b30: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
0b40: 63 73 68 22 2c 20 20 20 20 20 20 20 20 33 2c 20 csh", 3,
0b50: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 63 "application/x-c
0b60: 73 68 22 20 20 20 20 20 20 20 20 20 20 20 20 20 sh"
0b70: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 63 73 },. { "cs
0b80: 73 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 74 s", 3, "t
0b90: 65 78 74 2f 63 73 73 22 20 20 20 20 20 20 20 20 ext/css"
0ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0bb0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 63 22 2c 20 },. { "c",
0bc0: 20 20 20 20 20 20 20 20 20 31 2c 20 22 74 65 78 1, "tex
0bd0: 74 2f 70 6c 61 69 6e 22 20 20 20 20 20 20 20 20 t/plain"
0be0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0bf0: 7d 2c 0a 20 20 20 20 7b 20 22 64 63 72 22 2c 20 },. { "dcr",
0c00: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
0c10: 63 61 74 69 6f 6e 2f 78 2d 64 69 72 65 63 74 6f cation/x-directo
0c20: 72 22 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c r" },
0c30: 0a 20 20 20 20 7b 20 22 64 65 62 22 2c 20 20 20 . { "deb",
0c40: 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 3, "applica
0c50: 74 69 6f 6e 2f 78 2d 64 65 62 69 61 6e 2d 70 61 tion/x-debian-pa
0c60: 63 6b 61 67 65 22 20 20 20 20 20 20 7d 2c 0a 20 ckage" },.
0c70: 20 20 20 7b 20 22 64 69 72 22 2c 20 20 20 20 20 { "dir",
0c80: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
0c90: 6f 6e 2f 78 2d 64 69 72 65 63 74 6f 72 22 20 20 on/x-director"
0ca0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
0cb0: 20 7b 20 22 64 6c 22 2c 20 20 20 20 20 20 20 20 { "dl",
0cc0: 20 32 2c 20 22 76 69 64 65 6f 2f 64 6c 22 20 20 2, "video/dl"
0cd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0ce0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
0cf0: 20 22 64 6d 73 22 2c 20 20 20 20 20 20 20 20 33 "dms", 3
0d00: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6f , "application/o
0d10: 63 74 65 74 2d 73 74 72 65 61 6d 22 20 20 20 20 ctet-stream"
0d20: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
0d30: 64 6f 63 22 2c 20 20 20 20 20 20 20 20 33 2c 20 doc", 3,
0d40: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6d 73 77 "application/msw
0d50: 6f 72 64 22 20 20 20 20 20 20 20 20 20 20 20 20 ord"
0d60: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 64 72 },. { "dr
0d70: 77 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 w", 3, "a
0d80: 70 70 6c 69 63 61 74 69 6f 6e 2f 64 72 61 66 74 pplication/draft
0d90: 69 6e 67 22 20 20 20 20 20 20 20 20 20 20 20 20 ing"
0da0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 64 76 69 22 },. { "dvi"
0db0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
0dc0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 64 76 69 22 20 lication/x-dvi"
0dd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0de0: 7d 2c 0a 20 20 20 20 7b 20 22 64 77 67 22 2c 20 },. { "dwg",
0df0: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
0e00: 63 61 74 69 6f 6e 2f 61 63 61 64 22 20 20 20 20 cation/acad"
0e10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
0e20: 0a 20 20 20 20 7b 20 22 64 78 66 22 2c 20 20 20 . { "dxf",
0e30: 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 3, "applica
0e40: 74 69 6f 6e 2f 64 78 66 22 20 20 20 20 20 20 20 tion/dxf"
0e50: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
0e60: 20 20 20 7b 20 22 64 78 72 22 2c 20 20 20 20 20 { "dxr",
0e70: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
0e80: 6f 6e 2f 78 2d 64 69 72 65 63 74 6f 72 22 20 20 on/x-director"
0e90: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
0ea0: 20 7b 20 22 65 70 73 22 2c 20 20 20 20 20 20 20 { "eps",
0eb0: 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 3, "application
0ec0: 2f 70 6f 73 74 73 63 72 69 70 74 22 20 20 20 20 /postscript"
0ed0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
0ee0: 20 22 65 74 78 22 2c 20 20 20 20 20 20 20 20 33 "etx", 3
0ef0: 2c 20 22 74 65 78 74 2f 78 2d 73 65 74 65 78 74 , "text/x-setext
0f00: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
0f10: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
0f20: 65 78 65 22 2c 20 20 20 20 20 20 20 20 33 2c 20 exe", 3,
0f30: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6f 63 74 "application/oct
0f40: 65 74 2d 73 74 72 65 61 6d 22 20 20 20 20 20 20 et-stream"
0f50: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 65 7a },. { "ez
0f60: 22 2c 20 20 20 20 20 20 20 20 20 32 2c 20 22 61 ", 2, "a
0f70: 70 70 6c 69 63 61 74 69 6f 6e 2f 61 6e 64 72 65 pplication/andre
0f80: 77 2d 69 6e 73 65 74 22 20 20 20 20 20 20 20 20 w-inset"
0f90: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 66 39 30 22 },. { "f90"
0fa0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 74 65 78 , 3, "tex
0fb0: 74 2f 70 6c 61 69 6e 22 20 20 20 20 20 20 20 20 t/plain"
0fc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0fd0: 7d 2c 0a 20 20 20 20 7b 20 22 66 6c 69 22 2c 20 },. { "fli",
0fe0: 20 20 20 20 20 20 20 33 2c 20 22 76 69 64 65 6f 3, "video
0ff0: 2f 66 6c 69 22 20 20 20 20 20 20 20 20 20 20 20 /fli"
1000: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
1010: 0a 20 20 20 20 7b 20 22 66 6c 76 22 2c 20 20 20 . { "flv",
1020: 20 20 20 20 20 33 2c 20 22 76 69 64 65 6f 2f 66 3, "video/f
1030: 6c 76 22 20 20 20 20 20 20 20 20 20 20 20 20 20 lv"
1040: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
1050: 20 20 20 7b 20 22 66 22 2c 20 20 20 20 20 20 20 { "f",
1060: 20 20 20 31 2c 20 22 74 65 78 74 2f 70 6c 61 69 1, "text/plai
1070: 6e 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 n"
1080: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1090: 20 7b 20 22 67 69 66 22 2c 20 20 20 20 20 20 20 { "gif",
10a0: 20 33 2c 20 22 69 6d 61 67 65 2f 67 69 66 22 20 3, "image/gif"
10b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10c0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
10d0: 20 22 67 6c 22 2c 20 20 20 20 20 20 20 20 20 32 "gl", 2
10e0: 2c 20 22 76 69 64 65 6f 2f 67 6c 22 20 20 20 20 , "video/gl"
10f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1100: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
1110: 67 74 61 72 22 2c 20 20 20 20 20 20 20 34 2c 20 gtar", 4,
1120: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 67 "application/x-g
1130: 74 61 72 22 20 20 20 20 20 20 20 20 20 20 20 20 tar"
1140: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 67 7a },. { "gz
1150: 22 2c 20 20 20 20 20 20 20 20 20 32 2c 20 22 61 ", 2, "a
1160: 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 67 75 6e pplication/x-gun
1170: 7a 69 70 22 20 20 20 20 20 20 20 20 20 20 20 20 zip"
1180: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 67 7a 22 2c },. { "gz",
1190: 20 20 20 20 20 20 20 20 20 32 2c 20 22 61 70 70 2, "app
11a0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 67 7a 69 70 22 lication/x-gzip"
11b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
11c0: 7d 2c 0a 20 20 20 20 7b 20 22 68 64 66 22 2c 20 },. { "hdf",
11d0: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
11e0: 63 61 74 69 6f 6e 2f 78 2d 68 64 66 22 20 20 20 cation/x-hdf"
11f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
1200: 0a 20 20 20 20 7b 20 22 68 68 22 2c 20 20 20 20 . { "hh",
1210: 20 20 20 20 20 32 2c 20 22 74 65 78 74 2f 70 6c 2, "text/pl
1220: 61 69 6e 22 20 20 20 20 20 20 20 20 20 20 20 20 ain"
1230: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
1240: 20 20 20 7b 20 22 68 71 78 22 2c 20 20 20 20 20 { "hqx",
1250: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
1260: 6f 6e 2f 6d 61 63 2d 62 69 6e 68 65 78 34 30 22 on/mac-binhex40"
1270: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1280: 20 7b 20 22 68 22 2c 20 20 20 20 20 20 20 20 20 { "h",
1290: 20 31 2c 20 22 74 65 78 74 2f 70 6c 61 69 6e 22 1, "text/plain"
12a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
12b0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
12c0: 20 22 68 74 6d 22 2c 20 20 20 20 20 20 20 20 33 "htm", 3
12d0: 2c 20 22 74 65 78 74 2f 68 74 6d 6c 22 20 20 20 , "text/html"
12e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
12f0: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
1300: 68 74 6d 6c 22 2c 20 20 20 20 20 20 20 34 2c 20 html", 4,
1310: 22 74 65 78 74 2f 68 74 6d 6c 22 20 20 20 20 20 "text/html"
1320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1330: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 69 63 },. { "ic
1340: 65 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 78 e", 3, "x
1350: 2d 63 6f 6e 66 65 72 65 6e 63 65 2f 78 2d 63 6f -conference/x-co
1360: 6f 6c 74 61 6c 6b 22 20 20 20 20 20 20 20 20 20 oltalk"
1370: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 69 65 66 22 },. { "ief"
1380: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 , 3, "ima
1390: 67 65 2f 69 65 66 22 20 20 20 20 20 20 20 20 20 ge/ief"
13a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
13b0: 7d 2c 0a 20 20 20 20 7b 20 22 69 67 65 73 22 2c },. { "iges",
13c0: 20 20 20 20 20 20 20 34 2c 20 22 6d 6f 64 65 6c 4, "model
13d0: 2f 69 67 65 73 22 20 20 20 20 20 20 20 20 20 20 /iges"
13e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
13f0: 0a 20 20 20 20 7b 20 22 69 67 73 22 2c 20 20 20 . { "igs",
1400: 20 20 20 20 20 33 2c 20 22 6d 6f 64 65 6c 2f 69 3, "model/i
1410: 67 65 73 22 20 20 20 20 20 20 20 20 20 20 20 20 ges"
1420: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
1430: 20 20 20 7b 20 22 69 70 73 22 2c 20 20 20 20 20 { "ips",
1440: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
1450: 6f 6e 2f 78 2d 69 70 73 63 72 69 70 74 22 20 20 on/x-ipscript"
1460: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1470: 20 7b 20 22 69 70 78 22 2c 20 20 20 20 20 20 20 { "ipx",
1480: 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 3, "application
1490: 2f 78 2d 69 70 69 78 22 20 20 20 20 20 20 20 20 /x-ipix"
14a0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
14b0: 20 22 6a 61 64 22 2c 20 20 20 20 20 20 20 20 33 "jad", 3
14c0: 2c 20 22 74 65 78 74 2f 76 6e 64 2e 73 75 6e 2e , "text/vnd.sun.
14d0: 6a 32 6d 65 2e 61 70 70 2d 64 65 73 63 72 69 70 j2me.app-descrip
14e0: 74 6f 72 22 20 20 7d 2c 0a 20 20 20 20 7b 20 22 tor" },. { "
14f0: 6a 61 72 22 2c 20 20 20 20 20 20 20 20 33 2c 20 jar", 3,
1500: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6a 61 76 "application/jav
1510: 61 2d 61 72 63 68 69 76 65 22 20 20 20 20 20 20 a-archive"
1520: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6a 70 },. { "jp
1530: 65 67 22 2c 20 20 20 20 20 20 20 34 2c 20 22 69 eg", 4, "i
1540: 6d 61 67 65 2f 6a 70 65 67 22 20 20 20 20 20 20 mage/jpeg"
1550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1560: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6a 70 65 22 },. { "jpe"
1570: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 , 3, "ima
1580: 67 65 2f 6a 70 65 67 22 20 20 20 20 20 20 20 20 ge/jpeg"
1590: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
15a0: 7d 2c 0a 20 20 20 20 7b 20 22 6a 70 67 22 2c 20 },. { "jpg",
15b0: 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 67 65 3, "image
15c0: 2f 6a 70 65 67 22 20 20 20 20 20 20 20 20 20 20 /jpeg"
15d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
15e0: 0a 20 20 20 20 7b 20 22 6a 73 22 2c 20 20 20 20 . { "js",
15f0: 20 20 20 20 20 32 2c 20 22 61 70 70 6c 69 63 61 2, "applica
1600: 74 69 6f 6e 2f 78 2d 6a 61 76 61 73 63 72 69 70 tion/x-javascrip
1610: 74 22 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 t" },.
1620: 20 20 20 7b 20 22 6b 61 72 22 2c 20 20 20 20 20 { "kar",
1630: 20 20 20 33 2c 20 22 61 75 64 69 6f 2f 6d 69 64 3, "audio/mid
1640: 69 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 i"
1650: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1660: 20 7b 20 22 6c 61 74 65 78 22 2c 20 20 20 20 20 { "latex",
1670: 20 35 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 5, "application
1680: 2f 78 2d 6c 61 74 65 78 22 20 20 20 20 20 20 20 /x-latex"
1690: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
16a0: 20 22 6c 68 61 22 2c 20 20 20 20 20 20 20 20 33 "lha", 3
16b0: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6f , "application/o
16c0: 63 74 65 74 2d 73 74 72 65 61 6d 22 20 20 20 20 ctet-stream"
16d0: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
16e0: 6c 73 70 22 2c 20 20 20 20 20 20 20 20 33 2c 20 lsp", 3,
16f0: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 6c "application/x-l
1700: 69 73 70 22 20 20 20 20 20 20 20 20 20 20 20 20 isp"
1710: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6c 7a },. { "lz
1720: 68 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 h", 3, "a
1730: 70 70 6c 69 63 61 74 69 6f 6e 2f 6f 63 74 65 74 pplication/octet
1740: 2d 73 74 72 65 61 6d 22 20 20 20 20 20 20 20 20 -stream"
1750: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6d 33 75 22 },. { "m3u"
1760: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 75 64 , 3, "aud
1770: 69 6f 2f 78 2d 6d 70 65 67 75 72 6c 22 20 20 20 io/x-mpegurl"
1780: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1790: 7d 2c 0a 20 20 20 20 7b 20 22 6d 61 6e 22 2c 20 },. { "man",
17a0: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
17b0: 63 61 74 69 6f 6e 2f 78 2d 74 72 6f 66 66 2d 6d cation/x-troff-m
17c0: 61 6e 22 20 20 20 20 20 20 20 20 20 20 20 7d 2c an" },
17d0: 0a 20 20 20 20 7b 20 22 6d 65 22 2c 20 20 20 20 . { "me",
17e0: 20 20 20 20 20 32 2c 20 22 61 70 70 6c 69 63 61 2, "applica
17f0: 74 69 6f 6e 2f 78 2d 74 72 6f 66 66 2d 6d 65 22 tion/x-troff-me"
1800: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
1810: 20 20 20 7b 20 22 6d 65 73 68 22 2c 20 20 20 20 { "mesh",
1820: 20 20 20 34 2c 20 22 6d 6f 64 65 6c 2f 6d 65 73 4, "model/mes
1830: 68 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 h"
1840: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1850: 20 7b 20 22 6d 69 64 22 2c 20 20 20 20 20 20 20 { "mid",
1860: 20 33 2c 20 22 61 75 64 69 6f 2f 6d 69 64 69 22 3, "audio/midi"
1870: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1880: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
1890: 20 22 6d 69 64 69 22 2c 20 20 20 20 20 20 20 34 "midi", 4
18a0: 2c 20 22 61 75 64 69 6f 2f 6d 69 64 69 22 20 20 , "audio/midi"
18b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18c0: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
18d0: 6d 69 66 22 2c 20 20 20 20 20 20 20 20 33 2c 20 mif", 3,
18e0: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 76 6e 64 "application/vnd
18f0: 2e 6d 69 66 22 20 20 20 20 20 20 20 20 20 20 20 .mif"
1900: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6d 69 },. { "mi
1910: 66 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 f", 3, "a
1920: 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 6d 69 66 pplication/x-mif
1930: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
1940: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6d 69 6d 65 },. { "mime
1950: 22 2c 20 20 20 20 20 20 20 34 2c 20 22 77 77 77 ", 4, "www
1960: 2f 6d 69 6d 65 22 20 20 20 20 20 20 20 20 20 20 /mime"
1970: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1980: 7d 2c 0a 20 20 20 20 7b 20 22 6d 6f 76 69 65 22 },. { "movie"
1990: 2c 20 20 20 20 20 20 35 2c 20 22 76 69 64 65 6f , 5, "video
19a0: 2f 78 2d 73 67 69 2d 6d 6f 76 69 65 22 20 20 20 /x-sgi-movie"
19b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
19c0: 0a 20 20 20 20 7b 20 22 6d 6f 76 22 2c 20 20 20 . { "mov",
19d0: 20 20 20 20 20 33 2c 20 22 76 69 64 65 6f 2f 71 3, "video/q
19e0: 75 69 63 6b 74 69 6d 65 22 20 20 20 20 20 20 20 uicktime"
19f0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
1a00: 20 20 20 7b 20 22 6d 70 32 22 2c 20 20 20 20 20 { "mp2",
1a10: 20 20 20 33 2c 20 22 61 75 64 69 6f 2f 6d 70 65 3, "audio/mpe
1a20: 67 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 g"
1a30: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1a40: 20 7b 20 22 6d 70 32 22 2c 20 20 20 20 20 20 20 { "mp2",
1a50: 20 33 2c 20 22 76 69 64 65 6f 2f 6d 70 65 67 22 3, "video/mpeg"
1a60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a70: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
1a80: 20 22 6d 70 33 22 2c 20 20 20 20 20 20 20 20 33 "mp3", 3
1a90: 2c 20 22 61 75 64 69 6f 2f 6d 70 65 67 22 20 20 , "audio/mpeg"
1aa0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ab0: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
1ac0: 6d 70 65 67 22 2c 20 20 20 20 20 20 20 34 2c 20 mpeg", 4,
1ad0: 22 76 69 64 65 6f 2f 6d 70 65 67 22 20 20 20 20 "video/mpeg"
1ae0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1af0: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6d 70 },. { "mp
1b00: 65 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 76 e", 3, "v
1b10: 69 64 65 6f 2f 6d 70 65 67 22 20 20 20 20 20 20 ideo/mpeg"
1b20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b30: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6d 70 67 61 },. { "mpga
1b40: 22 2c 20 20 20 20 20 20 20 34 2c 20 22 61 75 64 ", 4, "aud
1b50: 69 6f 2f 6d 70 65 67 22 20 20 20 20 20 20 20 20 io/mpeg"
1b60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b70: 7d 2c 0a 20 20 20 20 7b 20 22 6d 70 67 22 2c 20 },. { "mpg",
1b80: 20 20 20 20 20 20 20 33 2c 20 22 76 69 64 65 6f 3, "video
1b90: 2f 6d 70 65 67 22 20 20 20 20 20 20 20 20 20 20 /mpeg"
1ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
1bb0: 0a 20 20 20 20 7b 20 22 6d 73 22 2c 20 20 20 20 . { "ms",
1bc0: 20 20 20 20 20 32 2c 20 22 61 70 70 6c 69 63 61 2, "applica
1bd0: 74 69 6f 6e 2f 78 2d 74 72 6f 66 66 2d 6d 73 22 tion/x-troff-ms"
1be0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
1bf0: 20 20 20 7b 20 22 6d 73 68 22 2c 20 20 20 20 20 { "msh",
1c00: 20 20 20 33 2c 20 22 6d 6f 64 65 6c 2f 6d 65 73 3, "model/mes
1c10: 68 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 h"
1c20: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1c30: 20 7b 20 22 6d 22 2c 20 20 20 20 20 20 20 20 20 { "m",
1c40: 20 31 2c 20 22 74 65 78 74 2f 70 6c 61 69 6e 22 1, "text/plain"
1c50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c60: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
1c70: 20 22 6e 63 22 2c 20 20 20 20 20 20 20 20 20 32 "nc", 2
1c80: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 , "application/x
1c90: 2d 6e 65 74 63 64 66 22 20 20 20 20 20 20 20 20 -netcdf"
1ca0: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
1cb0: 6f 64 61 22 2c 20 20 20 20 20 20 20 20 33 2c 20 oda", 3,
1cc0: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6f 64 61 "application/oda
1cd0: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
1ce0: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6f 67 },. { "og
1cf0: 67 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 g", 3, "a
1d00: 70 70 6c 69 63 61 74 69 6f 6e 2f 6f 67 67 22 20 pplication/ogg"
1d10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d20: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 6f 67 6d 22 },. { "ogm"
1d30: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
1d40: 6c 69 63 61 74 69 6f 6e 2f 6f 67 67 22 20 20 20 lication/ogg"
1d50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d60: 7d 2c 0a 20 20 20 20 7b 20 22 70 62 6d 22 2c 20 },. { "pbm",
1d70: 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 67 65 3, "image
1d80: 2f 78 2d 70 6f 72 74 61 62 6c 65 2d 62 69 74 6d /x-portable-bitm
1d90: 61 70 22 20 20 20 20 20 20 20 20 20 20 20 7d 2c ap" },
1da0: 0a 20 20 20 20 7b 20 22 70 64 62 22 2c 20 20 20 . { "pdb",
1db0: 20 20 20 20 20 33 2c 20 22 63 68 65 6d 69 63 61 3, "chemica
1dc0: 6c 2f 78 2d 70 64 62 22 20 20 20 20 20 20 20 20 l/x-pdb"
1dd0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
1de0: 20 20 20 7b 20 22 70 64 66 22 2c 20 20 20 20 20 { "pdf",
1df0: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
1e00: 6f 6e 2f 70 64 66 22 20 20 20 20 20 20 20 20 20 on/pdf"
1e10: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
1e20: 20 7b 20 22 70 67 6d 22 2c 20 20 20 20 20 20 20 { "pgm",
1e30: 20 33 2c 20 22 69 6d 61 67 65 2f 78 2d 70 6f 72 3, "image/x-por
1e40: 74 61 62 6c 65 2d 67 72 61 79 6d 61 70 22 20 20 table-graymap"
1e50: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
1e60: 20 22 70 67 6e 22 2c 20 20 20 20 20 20 20 20 33 "pgn", 3
1e70: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 , "application/x
1e80: 2d 63 68 65 73 73 2d 70 67 6e 22 20 20 20 20 20 -chess-pgn"
1e90: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
1ea0: 70 67 70 22 2c 20 20 20 20 20 20 20 20 33 2c 20 pgp", 3,
1eb0: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 70 67 70 "application/pgp
1ec0: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
1ed0: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 70 6c },. { "pl
1ee0: 22 2c 20 20 20 20 20 20 20 20 20 32 2c 20 22 61 ", 2, "a
1ef0: 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 70 65 72 pplication/x-per
1f00: 6c 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 l"
1f10: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 70 6d 22 2c },. { "pm",
1f20: 20 20 20 20 20 20 20 20 20 32 2c 20 22 61 70 70 2, "app
1f30: 6c 69 63 61 74 69 6f 6e 2f 78 2d 70 65 72 6c 22 lication/x-perl"
1f40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f50: 7d 2c 0a 20 20 20 20 7b 20 22 70 6e 67 22 2c 20 },. { "png",
1f60: 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 67 65 3, "image
1f70: 2f 70 6e 67 22 20 20 20 20 20 20 20 20 20 20 20 /png"
1f80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
1f90: 0a 20 20 20 20 7b 20 22 70 6e 6d 22 2c 20 20 20 . { "pnm",
1fa0: 20 20 20 20 20 33 2c 20 22 69 6d 61 67 65 2f 78 3, "image/x
1fb0: 2d 70 6f 72 74 61 62 6c 65 2d 61 6e 79 6d 61 70 -portable-anymap
1fc0: 22 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 " },.
1fd0: 20 20 20 7b 20 22 70 6f 74 22 2c 20 20 20 20 20 { "pot",
1fe0: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
1ff0: 6f 6e 2f 6d 73 70 6f 77 65 72 70 6f 69 6e 74 22 on/mspowerpoint"
2000: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
2010: 20 7b 20 22 70 70 6d 22 2c 20 20 20 20 20 20 20 { "ppm",
2020: 20 33 2c 20 22 69 6d 61 67 65 2f 78 2d 70 6f 72 3, "image/x-por
2030: 74 61 62 6c 65 2d 70 69 78 6d 61 70 22 20 20 20 table-pixmap"
2040: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2050: 20 22 70 70 73 22 2c 20 20 20 20 20 20 20 20 33 "pps", 3
2060: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6d , "application/m
2070: 73 70 6f 77 65 72 70 6f 69 6e 74 22 20 20 20 20 spowerpoint"
2080: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2090: 70 70 74 22 2c 20 20 20 20 20 20 20 20 33 2c 20 ppt", 3,
20a0: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6d 73 70 "application/msp
20b0: 6f 77 65 72 70 6f 69 6e 74 22 20 20 20 20 20 20 owerpoint"
20c0: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 70 70 },. { "pp
20d0: 7a 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 z", 3, "a
20e0: 70 70 6c 69 63 61 74 69 6f 6e 2f 6d 73 70 6f 77 pplication/mspow
20f0: 65 72 70 6f 69 6e 74 22 20 20 20 20 20 20 20 20 erpoint"
2100: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 70 72 65 22 },. { "pre"
2110: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
2120: 6c 69 63 61 74 69 6f 6e 2f 78 2d 66 72 65 65 6c lication/x-freel
2130: 61 6e 63 65 22 20 20 20 20 20 20 20 20 20 20 20 ance"
2140: 7d 2c 0a 20 20 20 20 7b 20 22 70 72 74 22 2c 20 },. { "prt",
2150: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
2160: 63 61 74 69 6f 6e 2f 70 72 6f 5f 65 6e 67 22 20 cation/pro_eng"
2170: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
2180: 0a 20 20 20 20 7b 20 22 70 73 22 2c 20 20 20 20 . { "ps",
2190: 20 20 20 20 20 32 2c 20 22 61 70 70 6c 69 63 61 2, "applica
21a0: 74 69 6f 6e 2f 70 6f 73 74 73 63 72 69 70 74 22 tion/postscript"
21b0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
21c0: 20 20 20 7b 20 22 71 74 22 2c 20 20 20 20 20 20 { "qt",
21d0: 20 20 20 32 2c 20 22 76 69 64 65 6f 2f 71 75 69 2, "video/qui
21e0: 63 6b 74 69 6d 65 22 20 20 20 20 20 20 20 20 20 cktime"
21f0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
2200: 20 7b 20 22 72 61 22 2c 20 20 20 20 20 20 20 20 { "ra",
2210: 20 32 2c 20 22 61 75 64 69 6f 2f 78 2d 72 65 61 2, "audio/x-rea
2220: 6c 61 75 64 69 6f 22 20 20 20 20 20 20 20 20 20 laudio"
2230: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2240: 20 22 72 61 6d 22 2c 20 20 20 20 20 20 20 20 33 "ram", 3
2250: 2c 20 22 61 75 64 69 6f 2f 78 2d 70 6e 2d 72 65 , "audio/x-pn-re
2260: 61 6c 61 75 64 69 6f 22 20 20 20 20 20 20 20 20 alaudio"
2270: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2280: 72 61 72 22 2c 20 20 20 20 20 20 20 20 33 2c 20 rar", 3,
2290: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 72 "application/x-r
22a0: 61 72 2d 63 6f 6d 70 72 65 73 73 65 64 22 20 20 ar-compressed"
22b0: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 72 61 },. { "ra
22c0: 73 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 69 s", 3, "i
22d0: 6d 61 67 65 2f 63 6d 75 2d 72 61 73 74 65 72 22 mage/cmu-raster"
22e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
22f0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 72 61 73 22 },. { "ras"
2300: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 , 3, "ima
2310: 67 65 2f 78 2d 63 6d 75 2d 72 61 73 74 65 72 22 ge/x-cmu-raster"
2320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2330: 7d 2c 0a 20 20 20 20 7b 20 22 72 67 62 22 2c 20 },. { "rgb",
2340: 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 67 65 3, "image
2350: 2f 78 2d 72 67 62 22 20 20 20 20 20 20 20 20 20 /x-rgb"
2360: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
2370: 0a 20 20 20 20 7b 20 22 72 6d 22 2c 20 20 20 20 . { "rm",
2380: 20 20 20 20 20 32 2c 20 22 61 75 64 69 6f 2f 78 2, "audio/x
2390: 2d 70 6e 2d 72 65 61 6c 61 75 64 69 6f 22 20 20 -pn-realaudio"
23a0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
23b0: 20 20 20 7b 20 22 72 6f 66 66 22 2c 20 20 20 20 { "roff",
23c0: 20 20 20 34 2c 20 22 61 70 70 6c 69 63 61 74 69 4, "applicati
23d0: 6f 6e 2f 78 2d 74 72 6f 66 66 22 20 20 20 20 20 on/x-troff"
23e0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
23f0: 20 7b 20 22 72 70 6d 22 2c 20 20 20 20 20 20 20 { "rpm",
2400: 20 33 2c 20 22 61 75 64 69 6f 2f 78 2d 70 6e 2d 3, "audio/x-pn-
2410: 72 65 61 6c 61 75 64 69 6f 2d 70 6c 75 67 69 6e realaudio-plugin
2420: 22 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b " },. {
2430: 20 22 72 74 66 22 2c 20 20 20 20 20 20 20 20 33 "rtf", 3
2440: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 72 , "application/r
2450: 74 66 22 20 20 20 20 20 20 20 20 20 20 20 20 20 tf"
2460: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2470: 72 74 66 22 2c 20 20 20 20 20 20 20 20 33 2c 20 rtf", 3,
2480: 22 74 65 78 74 2f 72 74 66 22 20 20 20 20 20 20 "text/rtf"
2490: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
24a0: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 72 74 },. { "rt
24b0: 78 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 74 x", 3, "t
24c0: 65 78 74 2f 72 69 63 68 74 65 78 74 22 20 20 20 ext/richtext"
24d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
24e0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 73 63 6d 22 },. { "scm"
24f0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
2500: 6c 69 63 61 74 69 6f 6e 2f 78 2d 6c 6f 74 75 73 lication/x-lotus
2510: 73 63 72 65 65 6e 63 61 6d 22 20 20 20 20 20 20 screencam"
2520: 7d 2c 0a 20 20 20 20 7b 20 22 73 65 74 22 2c 20 },. { "set",
2530: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
2540: 63 61 74 69 6f 6e 2f 73 65 74 22 20 20 20 20 20 cation/set"
2550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
2560: 0a 20 20 20 20 7b 20 22 73 67 6d 6c 22 2c 20 20 . { "sgml",
2570: 20 20 20 20 20 34 2c 20 22 74 65 78 74 2f 73 67 4, "text/sg
2580: 6d 6c 22 20 20 20 20 20 20 20 20 20 20 20 20 20 ml"
2590: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
25a0: 20 20 20 7b 20 22 73 67 6d 22 2c 20 20 20 20 20 { "sgm",
25b0: 20 20 20 33 2c 20 22 74 65 78 74 2f 73 67 6d 6c 3, "text/sgml
25c0: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
25d0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
25e0: 20 7b 20 22 73 68 22 2c 20 20 20 20 20 20 20 20 { "sh",
25f0: 20 32 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2, "application
2600: 2f 78 2d 73 68 22 20 20 20 20 20 20 20 20 20 20 /x-sh"
2610: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2620: 20 22 73 68 61 72 22 2c 20 20 20 20 20 20 20 34 "shar", 4
2630: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 , "application/x
2640: 2d 73 68 61 72 22 20 20 20 20 20 20 20 20 20 20 -shar"
2650: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2660: 73 69 6c 6f 22 2c 20 20 20 20 20 20 20 34 2c 20 silo", 4,
2670: 22 6d 6f 64 65 6c 2f 6d 65 73 68 22 20 20 20 20 "model/mesh"
2680: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2690: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 73 69 },. { "si
26a0: 74 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 t", 3, "a
26b0: 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 73 74 75 pplication/x-stu
26c0: 66 66 69 74 22 20 20 20 20 20 20 20 20 20 20 20 ffit"
26d0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 73 6b 64 22 },. { "skd"
26e0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
26f0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 6b 6f 61 6e 22 lication/x-koan"
2700: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2710: 7d 2c 0a 20 20 20 20 7b 20 22 73 6b 6d 22 2c 20 },. { "skm",
2720: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
2730: 63 61 74 69 6f 6e 2f 78 2d 6b 6f 61 6e 22 20 20 cation/x-koan"
2740: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
2750: 0a 20 20 20 20 7b 20 22 73 6b 70 22 2c 20 20 20 . { "skp",
2760: 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 3, "applica
2770: 74 69 6f 6e 2f 78 2d 6b 6f 61 6e 22 20 20 20 20 tion/x-koan"
2780: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
2790: 20 20 20 7b 20 22 73 6b 74 22 2c 20 20 20 20 20 { "skt",
27a0: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
27b0: 6f 6e 2f 78 2d 6b 6f 61 6e 22 20 20 20 20 20 20 on/x-koan"
27c0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
27d0: 20 7b 20 22 73 6d 69 22 2c 20 20 20 20 20 20 20 { "smi",
27e0: 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 3, "application
27f0: 2f 73 6d 69 6c 22 20 20 20 20 20 20 20 20 20 20 /smil"
2800: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2810: 20 22 73 6d 69 6c 22 2c 20 20 20 20 20 20 20 34 "smil", 4
2820: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 73 , "application/s
2830: 6d 69 6c 22 20 20 20 20 20 20 20 20 20 20 20 20 mil"
2840: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2850: 73 6e 64 22 2c 20 20 20 20 20 20 20 20 33 2c 20 snd", 3,
2860: 22 61 75 64 69 6f 2f 62 61 73 69 63 22 20 20 20 "audio/basic"
2870: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2880: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 73 6f },. { "so
2890: 6c 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 l", 3, "a
28a0: 70 70 6c 69 63 61 74 69 6f 6e 2f 73 6f 6c 69 64 pplication/solid
28b0: 73 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 s"
28c0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 73 70 6c 22 },. { "spl"
28d0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
28e0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 66 75 74 75 72 lication/x-futur
28f0: 65 73 70 6c 61 73 68 22 20 20 20 20 20 20 20 20 esplash"
2900: 7d 2c 0a 20 20 20 20 7b 20 22 73 72 63 22 2c 20 },. { "src",
2910: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
2920: 63 61 74 69 6f 6e 2f 78 2d 77 61 69 73 2d 73 6f cation/x-wais-so
2930: 75 72 63 65 22 20 20 20 20 20 20 20 20 20 7d 2c urce" },
2940: 0a 20 20 20 20 7b 20 22 73 74 65 70 22 2c 20 20 . { "step",
2950: 20 20 20 20 20 34 2c 20 22 61 70 70 6c 69 63 61 4, "applica
2960: 74 69 6f 6e 2f 53 54 45 50 22 20 20 20 20 20 20 tion/STEP"
2970: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
2980: 20 20 20 7b 20 22 73 74 6c 22 2c 20 20 20 20 20 { "stl",
2990: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
29a0: 6f 6e 2f 53 4c 41 22 20 20 20 20 20 20 20 20 20 on/SLA"
29b0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
29c0: 20 7b 20 22 73 74 70 22 2c 20 20 20 20 20 20 20 { "stp",
29d0: 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 3, "application
29e0: 2f 53 54 45 50 22 20 20 20 20 20 20 20 20 20 20 /STEP"
29f0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2a00: 20 22 73 76 34 63 70 69 6f 22 2c 20 20 20 20 37 "sv4cpio", 7
2a10: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 , "application/x
2a20: 2d 73 76 34 63 70 69 6f 22 20 20 20 20 20 20 20 -sv4cpio"
2a30: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2a40: 73 76 34 63 72 63 22 2c 20 20 20 20 20 36 2c 20 sv4crc", 6,
2a50: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 73 "application/x-s
2a60: 76 34 63 72 63 22 20 20 20 20 20 20 20 20 20 20 v4crc"
2a70: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 73 77 },. { "sw
2a80: 66 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 f", 3, "a
2a90: 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 73 68 6f pplication/x-sho
2aa0: 63 6b 77 61 76 65 2d 66 6c 61 73 68 22 20 20 20 ckwave-flash"
2ab0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 74 22 2c 20 },. { "t",
2ac0: 20 20 20 20 20 20 20 20 20 31 2c 20 22 61 70 70 1, "app
2ad0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 74 72 6f 66 66 lication/x-troff
2ae0: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
2af0: 7d 2c 0a 20 20 20 20 7b 20 22 74 61 72 22 2c 20 },. { "tar",
2b00: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
2b10: 63 61 74 69 6f 6e 2f 78 2d 74 61 72 22 20 20 20 cation/x-tar"
2b20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
2b30: 0a 20 20 20 20 7b 20 22 74 63 6c 22 2c 20 20 20 . { "tcl",
2b40: 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 3, "applica
2b50: 74 69 6f 6e 2f 78 2d 74 63 6c 22 20 20 20 20 20 tion/x-tcl"
2b60: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
2b70: 20 20 20 7b 20 22 74 65 78 22 2c 20 20 20 20 20 { "tex",
2b80: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
2b90: 6f 6e 2f 78 2d 74 65 78 22 20 20 20 20 20 20 20 on/x-tex"
2ba0: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
2bb0: 20 7b 20 22 74 65 78 69 22 2c 20 20 20 20 20 20 { "texi",
2bc0: 20 34 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 4, "application
2bd0: 2f 78 2d 74 65 78 69 6e 66 6f 22 20 20 20 20 20 /x-texinfo"
2be0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2bf0: 20 22 74 65 78 69 6e 66 6f 22 2c 20 20 20 20 37 "texinfo", 7
2c00: 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 , "application/x
2c10: 2d 74 65 78 69 6e 66 6f 22 20 20 20 20 20 20 20 -texinfo"
2c20: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2c30: 74 67 7a 22 2c 20 20 20 20 20 20 20 20 33 2c 20 tgz", 3,
2c40: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 74 "application/x-t
2c50: 61 72 2d 67 7a 22 20 20 20 20 20 20 20 20 20 20 ar-gz"
2c60: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 74 69 },. { "ti
2c70: 66 66 22 2c 20 20 20 20 20 20 20 34 2c 20 22 69 ff", 4, "i
2c80: 6d 61 67 65 2f 74 69 66 66 22 20 20 20 20 20 20 mage/tiff"
2c90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2ca0: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 74 69 66 22 },. { "tif"
2cb0: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 , 3, "ima
2cc0: 67 65 2f 74 69 66 66 22 20 20 20 20 20 20 20 20 ge/tiff"
2cd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2ce0: 7d 2c 0a 20 20 20 20 7b 20 22 74 69 66 22 2c 20 },. { "tif",
2cf0: 20 20 20 20 20 20 20 33 2c 20 22 69 6d 61 67 65 3, "image
2d00: 2f 74 69 66 66 22 20 20 20 20 20 20 20 20 20 20 /tiff"
2d10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
2d20: 0a 20 20 20 20 7b 20 22 74 72 22 2c 20 20 20 20 . { "tr",
2d30: 20 20 20 20 20 32 2c 20 22 61 70 70 6c 69 63 61 2, "applica
2d40: 74 69 6f 6e 2f 78 2d 74 72 6f 66 66 22 20 20 20 tion/x-troff"
2d50: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
2d60: 20 20 20 7b 20 22 74 73 69 22 2c 20 20 20 20 20 { "tsi",
2d70: 20 20 20 33 2c 20 22 61 75 64 69 6f 2f 54 53 50 3, "audio/TSP
2d80: 2d 61 75 64 69 6f 22 20 20 20 20 20 20 20 20 20 -audio"
2d90: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
2da0: 20 7b 20 22 74 73 70 22 2c 20 20 20 20 20 20 20 { "tsp",
2db0: 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 6f 6e 3, "application
2dc0: 2f 64 73 70 74 79 70 65 22 20 20 20 20 20 20 20 /dsptype"
2dd0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2de0: 20 22 74 73 76 22 2c 20 20 20 20 20 20 20 20 33 "tsv", 3
2df0: 2c 20 22 74 65 78 74 2f 74 61 62 2d 73 65 70 61 , "text/tab-sepa
2e00: 72 61 74 65 64 2d 76 61 6c 75 65 73 22 20 20 20 rated-values"
2e10: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
2e20: 74 78 74 22 2c 20 20 20 20 20 20 20 20 33 2c 20 txt", 3,
2e30: 22 74 65 78 74 2f 70 6c 61 69 6e 22 20 20 20 20 "text/plain"
2e40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2e50: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 75 6e },. { "un
2e60: 76 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 v", 3, "a
2e70: 70 70 6c 69 63 61 74 69 6f 6e 2f 69 2d 64 65 61 pplication/i-dea
2e80: 73 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 s"
2e90: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 75 73 74 61 },. { "usta
2ea0: 72 22 2c 20 20 20 20 20 20 35 2c 20 22 61 70 70 r", 5, "app
2eb0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 75 73 74 61 72 lication/x-ustar
2ec0: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
2ed0: 7d 2c 0a 20 20 20 20 7b 20 22 76 63 64 22 2c 20 },. { "vcd",
2ee0: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
2ef0: 63 61 74 69 6f 6e 2f 78 2d 63 64 6c 69 6e 6b 22 cation/x-cdlink"
2f00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
2f10: 0a 20 20 20 20 7b 20 22 76 64 61 22 2c 20 20 20 . { "vda",
2f20: 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 3, "applica
2f30: 74 69 6f 6e 2f 76 64 61 22 20 20 20 20 20 20 20 tion/vda"
2f40: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
2f50: 20 20 20 7b 20 22 76 69 76 6f 22 2c 20 20 20 20 { "vivo",
2f60: 20 20 20 34 2c 20 22 76 69 64 65 6f 2f 76 6e 64 4, "video/vnd
2f70: 2e 76 69 76 6f 22 20 20 20 20 20 20 20 20 20 20 .vivo"
2f80: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
2f90: 20 7b 20 22 76 69 76 22 2c 20 20 20 20 20 20 20 { "viv",
2fa0: 20 33 2c 20 22 76 69 64 65 6f 2f 76 6e 64 2e 76 3, "video/vnd.v
2fb0: 69 76 6f 22 20 20 20 20 20 20 20 20 20 20 20 20 ivo"
2fc0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
2fd0: 20 22 76 72 6d 6c 22 2c 20 20 20 20 20 20 20 34 "vrml", 4
2fe0: 2c 20 22 6d 6f 64 65 6c 2f 76 72 6d 6c 22 20 20 , "model/vrml"
2ff0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3000: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
3010: 77 61 76 22 2c 20 20 20 20 20 20 20 20 33 2c 20 wav", 3,
3020: 22 61 75 64 69 6f 2f 78 2d 77 61 76 22 20 20 20 "audio/x-wav"
3030: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3040: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 77 61 },. { "wa
3050: 78 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 x", 3, "a
3060: 75 64 69 6f 2f 78 2d 6d 73 2d 77 61 78 22 20 20 udio/x-ms-wax"
3070: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3080: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 77 69 6b 69 },. { "wiki
3090: 22 2c 20 20 20 20 20 20 20 34 2c 20 22 61 70 70 ", 4, "app
30a0: 6c 69 63 61 74 69 6f 6e 2f 78 2d 66 6f 73 73 69 lication/x-fossi
30b0: 6c 2d 77 69 6b 69 22 20 20 20 20 20 20 20 20 20 l-wiki"
30c0: 7d 2c 0a 20 20 20 20 7b 20 22 77 6d 61 22 2c 20 },. { "wma",
30d0: 20 20 20 20 20 20 20 33 2c 20 22 61 75 64 69 6f 3, "audio
30e0: 2f 78 2d 6d 73 2d 77 6d 61 22 20 20 20 20 20 20 /x-ms-wma"
30f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c },
3100: 0a 20 20 20 20 7b 20 22 77 6d 76 22 2c 20 20 20 . { "wmv",
3110: 20 20 20 20 20 33 2c 20 22 76 69 64 65 6f 2f 78 3, "video/x
3120: 2d 6d 73 2d 77 6d 76 22 20 20 20 20 20 20 20 20 -ms-wmv"
3130: 20 20 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 },.
3140: 20 20 20 7b 20 22 77 6d 78 22 2c 20 20 20 20 20 { "wmx",
3150: 20 20 20 33 2c 20 22 76 69 64 65 6f 2f 78 2d 6d 3, "video/x-m
3160: 73 2d 77 6d 78 22 20 20 20 20 20 20 20 20 20 20 s-wmx"
3170: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
3180: 20 7b 20 22 77 72 6c 22 2c 20 20 20 20 20 20 20 { "wrl",
3190: 20 33 2c 20 22 6d 6f 64 65 6c 2f 76 72 6d 6c 22 3, "model/vrml"
31a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
31b0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
31c0: 20 22 77 76 78 22 2c 20 20 20 20 20 20 20 20 33 "wvx", 3
31d0: 2c 20 22 76 69 64 65 6f 2f 78 2d 6d 73 2d 77 76 , "video/x-ms-wv
31e0: 78 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 x"
31f0: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
3200: 78 62 6d 22 2c 20 20 20 20 20 20 20 20 33 2c 20 xbm", 3,
3210: 22 69 6d 61 67 65 2f 78 2d 78 62 69 74 6d 61 70 "image/x-xbitmap
3220: 22 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
3230: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 78 6c },. { "xl
3240: 63 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 c", 3, "a
3250: 70 70 6c 69 63 61 74 69 6f 6e 2f 76 6e 64 2e 6d pplication/vnd.m
3260: 73 2d 65 78 63 65 6c 22 20 20 20 20 20 20 20 20 s-excel"
3270: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 78 6c 6c 22 },. { "xll"
3280: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
3290: 6c 69 63 61 74 69 6f 6e 2f 76 6e 64 2e 6d 73 2d lication/vnd.ms-
32a0: 65 78 63 65 6c 22 20 20 20 20 20 20 20 20 20 20 excel"
32b0: 7d 2c 0a 20 20 20 20 7b 20 22 78 6c 6d 22 2c 20 },. { "xlm",
32c0: 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 3, "appli
32d0: 63 61 74 69 6f 6e 2f 76 6e 64 2e 6d 73 2d 65 78 cation/vnd.ms-ex
32e0: 63 65 6c 22 20 20 20 20 20 20 20 20 20 20 7d 2c cel" },
32f0: 0a 20 20 20 20 7b 20 22 78 6c 73 22 2c 20 20 20 . { "xls",
3300: 20 20 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 3, "applica
3310: 74 69 6f 6e 2f 76 6e 64 2e 6d 73 2d 65 78 63 65 tion/vnd.ms-exce
3320: 6c 22 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 l" },.
3330: 20 20 20 7b 20 22 78 6c 77 22 2c 20 20 20 20 20 { "xlw",
3340: 20 20 20 33 2c 20 22 61 70 70 6c 69 63 61 74 69 3, "applicati
3350: 6f 6e 2f 76 6e 64 2e 6d 73 2d 65 78 63 65 6c 22 on/vnd.ms-excel"
3360: 20 20 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 },.
3370: 20 7b 20 22 78 6d 6c 22 2c 20 20 20 20 20 20 20 { "xml",
3380: 20 33 2c 20 22 74 65 78 74 2f 78 6d 6c 22 20 20 3, "text/xml"
3390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
33a0: 20 20 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b },. {
33b0: 20 22 78 70 6d 22 2c 20 20 20 20 20 20 20 20 33 "xpm", 3
33c0: 2c 20 22 69 6d 61 67 65 2f 78 2d 78 70 69 78 6d , "image/x-xpixm
33d0: 61 70 22 20 20 20 20 20 20 20 20 20 20 20 20 20 ap"
33e0: 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 },. { "
33f0: 78 77 64 22 2c 20 20 20 20 20 20 20 20 33 2c 20 xwd", 3,
3400: 22 69 6d 61 67 65 2f 78 2d 78 77 69 6e 64 6f 77 "image/x-xwindow
3410: 64 75 6d 70 22 20 20 20 20 20 20 20 20 20 20 20 dump"
3420: 20 20 20 20 7d 2c 0a 20 20 20 20 7b 20 22 78 79 },. { "xy
3430: 7a 22 2c 20 20 20 20 20 20 20 20 33 2c 20 22 63 z", 3, "c
3440: 68 65 6d 69 63 61 6c 2f 78 2d 70 64 62 22 20 20 hemical/x-pdb"
3450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3460: 20 20 7d 2c 0a 20 20 20 20 7b 20 22 7a 69 70 22 },. { "zip"
3470: 2c 20 20 20 20 20 20 20 20 33 2c 20 22 61 70 70 , 3, "app
3480: 6c 69 63 61 74 69 6f 6e 2f 7a 69 70 22 20 20 20 lication/zip"
3490: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
34a0: 7d 2c 0a 20 20 7d 3b 0a 0a 20 20 7a 20 3d 20 7a },. };.. z = z
34b0: 4e 61 6d 65 3b 0a 20 20 66 6f 72 28 69 3d 30 3b Name;. for(i=0;
34c0: 20 7a 4e 61 6d 65 5b 69 5d 3b 20 69 2b 2b 29 7b zName[i]; i++){
34d0: 0a 20 20 20 20 69 66 28 20 7a 4e 61 6d 65 5b 69 . if( zName[i
34e0: 5d 3d 3d 27 2e 27 20 29 20 7a 20 3d 20 26 7a 4e ]=='.' ) z = &zN
34f0: 61 6d 65 5b 69 2b 31 5d 3b 0a 20 20 7d 0a 20 20 ame[i+1];. }.
3500: 6c 65 6e 20 3d 20 73 74 72 6c 65 6e 28 7a 29 3b len = strlen(z);
3510: 0a 20 20 69 66 28 20 6c 65 6e 3c 73 69 7a 65 6f . if( len<sizeo
3520: 66 28 7a 53 75 66 66 69 78 29 2d 31 20 29 7b 0a f(zSuffix)-1 ){.
3530: 20 20 20 20 73 74 72 63 70 79 28 7a 53 75 66 66 strcpy(zSuff
3540: 69 78 2c 20 7a 29 3b 0a 20 20 20 20 66 6f 72 28 ix, z);. for(
3550: 69 3d 30 3b 20 7a 53 75 66 66 69 78 5b 69 5d 3b i=0; zSuffix[i];
3560: 20 69 2b 2b 29 20 7a 53 75 66 66 69 78 5b 69 5d i++) zSuffix[i]
3570: 20 3d 20 74 6f 6c 6f 77 65 72 28 7a 53 75 66 66 = tolower(zSuff
3580: 69 78 5b 69 5d 29 3b 0a 20 20 20 20 66 69 72 73 ix[i]);. firs
3590: 74 20 3d 20 30 3b 0a 20 20 20 20 6c 61 73 74 20 t = 0;. last
35a0: 3d 20 73 69 7a 65 6f 66 28 61 4d 69 6d 65 29 2f = sizeof(aMime)/
35b0: 73 69 7a 65 6f 66 28 61 4d 69 6d 65 5b 30 5d 29 sizeof(aMime[0])
35c0: 3b 0a 20 20 20 20 77 68 69 6c 65 28 20 66 69 72 ;. while( fir
35d0: 73 74 3c 3d 6c 61 73 74 20 29 7b 0a 20 20 20 20 st<=last ){.
35e0: 20 20 69 6e 74 20 63 3b 0a 20 20 20 20 20 20 69 int c;. i
35f0: 20 3d 20 28 66 69 72 73 74 2b 6c 61 73 74 29 2f = (first+last)/
3600: 32 3b 0a 20 20 20 20 20 20 63 20 3d 20 73 74 72 2;. c = str
3610: 63 6d 70 28 7a 53 75 66 66 69 78 2c 20 61 4d 69 cmp(zSuffix, aMi
3620: 6d 65 5b 69 5d 2e 7a 53 75 66 66 69 78 29 3b 0a me[i].zSuffix);.
3630: 20 20 20 20 20 20 69 66 28 20 63 3d 3d 30 20 29 if( c==0 )
3640: 20 72 65 74 75 72 6e 20 61 4d 69 6d 65 5b 69 5d return aMime[i]
3650: 2e 7a 4d 69 6d 65 74 79 70 65 3b 0a 20 20 20 20 .zMimetype;.
3660: 20 20 69 66 28 20 63 3c 30 20 29 7b 0a 20 20 20 if( c<0 ){.
3670: 20 20 20 20 20 6c 61 73 74 20 3d 20 69 2d 31 3b last = i-1;
3680: 0a 20 20 20 20 20 20 7d 65 6c 73 65 7b 0a 20 20 . }else{.
3690: 20 20 20 20 20 20 66 69 72 73 74 20 3d 20 69 2b first = i+
36a0: 31 3b 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 1;. }. }
36b0: 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 22 61 . }. return "a
36c0: 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 66 6f 73 pplication/x-fos
36d0: 73 69 6c 2d 61 72 74 69 66 61 63 74 22 3b 0a 7d sil-artifact";.}
36e0: 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 45 3a ../*.** WEBPAGE:
36f0: 20 64 6f 63 0a 2a 2a 20 55 52 4c 3a 20 2f 64 6f doc.** URL: /do
3700: 63 3f 6e 61 6d 65 3d 42 41 53 45 4c 49 4e 45 2f c?name=BASELINE/
3710: 50 41 54 48 0a 2a 2a 0a 2a 2a 20 42 41 53 45 4c PATH.**.** BASEL
3720: 49 4e 45 20 63 61 6e 20 62 65 20 65 69 74 68 65 INE can be eithe
3730: 72 20 61 20 62 61 73 65 6c 69 6e 65 20 75 75 69 r a baseline uui
3740: 64 20 70 72 65 66 69 78 20 6f 72 20 6d 61 67 69 d prefix or magi
3750: 63 20 77 6f 72 64 73 20 22 74 69 70 22 0a 2a 2a c words "tip".**
3760: 20 74 6f 20 6d 65 20 74 68 65 20 6d 6f 73 74 20 to me the most
3770: 72 65 63 65 6e 74 6c 79 20 63 68 65 63 6b 65 64 recently checked
3780: 20 69 6e 20 62 61 73 65 6c 69 6e 65 20 6f 72 20 in baseline or
3790: 22 63 6b 6f 75 74 22 20 74 6f 20 6d 65 61 6e 20 "ckout" to mean
37a0: 74 68 65 0a 2a 2a 20 63 6f 6e 74 65 6e 74 20 6f the.** content o
37b0: 66 20 74 68 65 20 6c 6f 63 61 6c 20 63 68 65 63 f the local chec
37c0: 6b 6f 75 74 2c 20 69 66 20 61 6e 79 2e 20 20 50 kout, if any. P
37d0: 41 54 48 20 69 73 20 74 68 65 20 72 65 6c 61 74 ATH is the relat
37e0: 69 76 65 20 70 61 74 68 6e 61 6d 65 0a 2a 2a 20 ive pathname.**
37f0: 6f 66 20 73 6f 6d 65 20 66 69 6c 65 2e 20 20 54 of some file. T
3800: 68 69 73 20 6d 65 74 68 6f 64 20 72 65 74 75 72 his method retur
3810: 6e 73 20 74 68 65 20 66 69 6c 65 20 63 6f 6e 74 ns the file cont
3820: 65 6e 74 2e 0a 2a 2a 0a 2a 2a 20 49 66 20 50 41 ent..**.** If PA
3830: 54 48 20 6d 61 74 63 68 65 73 20 74 68 65 20 70 TH matches the p
3840: 61 74 74 65 72 6e 73 20 2a 2e 77 69 6b 69 20 6f atterns *.wiki o
3850: 72 20 2a 2e 74 78 74 20 74 68 65 6e 20 66 6f 72 r *.txt then for
3860: 6d 61 74 74 69 6e 67 20 63 6f 6e 74 65 6e 74 0a matting content.
3870: 2a 2a 20 69 73 20 61 64 64 65 64 20 62 65 66 6f ** is added befo
3880: 72 65 20 72 65 74 75 72 6e 69 6e 67 20 74 68 65 re returning the
3890: 20 66 69 6c 65 2e 20 20 46 6f 72 20 61 6c 6c 20 file. For all
38a0: 6f 74 68 65 72 20 6e 61 6d 65 73 2c 20 74 68 65 other names, the
38b0: 20 63 6f 6e 74 65 6e 74 0a 2a 2a 20 69 73 20 72 content.** is r
38c0: 65 74 75 72 6e 65 64 20 73 74 72 61 69 67 68 74 eturned straight
38d0: 20 77 69 74 68 6f 75 74 20 61 6e 79 20 69 6e 74 without any int
38e0: 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 72 20 70 erpretation or p
38f0: 72 6f 63 65 73 73 69 6e 67 2e 0a 2a 2f 0a 76 6f rocessing..*/.vo
3900: 69 64 20 64 6f 63 5f 70 61 67 65 28 76 6f 69 64 id doc_page(void
3910: 29 7b 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 ){. const char
3920: 2a 7a 4e 61 6d 65 3b 20 20 20 20 20 20 20 20 20 *zName;
3930: 20 20 20 20 20 20 20 2f 2a 20 41 72 67 75 6d 65 /* Argume
3940: 6e 74 20 74 6f 20 74 68 65 20 2f 64 6f 63 20 70 nt to the /doc p
3950: 61 67 65 20 2a 2f 0a 20 20 63 6f 6e 73 74 20 63 age */. const c
3960: 68 61 72 20 2a 7a 4d 69 6d 65 3b 20 20 20 20 20 har *zMime;
3970: 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 44 6f /* Do
3980: 63 75 6d 65 6e 74 20 4d 49 4d 45 20 74 79 70 65 cument MIME type
3990: 20 2a 2f 0a 20 20 69 6e 74 20 76 69 64 20 3d 20 */. int vid =
39a0: 30 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0;
39b0: 20 20 20 20 20 20 20 20 2f 2a 20 41 72 74 69 66 /* Artif
39c0: 61 63 74 20 6f 66 20 62 61 73 65 6c 69 6e 65 20 act of baseline
39d0: 2a 2f 0a 20 20 69 6e 74 20 72 69 64 20 3d 20 30 */. int rid = 0
39e0: 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ;
39f0: 20 20 20 20 20 20 20 2f 2a 20 41 72 74 69 66 61 /* Artifa
3a00: 63 74 20 6f 66 20 66 69 6c 65 20 2a 2f 0a 20 20 ct of file */.
3a10: 69 6e 74 20 69 3b 20 20 20 20 20 20 20 20 20 20 int i;
3a20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3a30: 20 20 2f 2a 20 4c 6f 6f 70 20 63 6f 75 6e 74 65 /* Loop counte
3a40: 72 20 2a 2f 0a 20 20 42 6c 6f 62 20 66 69 6c 65 r */. Blob file
3a50: 62 6f 64 79 3b 20 20 20 20 20 20 20 20 20 20 20 body;
3a60: 20 20 20 20 20 20 20 20 20 2f 2a 20 43 6f 6e 74 /* Cont
3a70: 65 6e 74 20 6f 66 20 74 68 65 20 64 6f 63 75 6d ent of the docum
3a80: 65 6e 74 61 74 69 6f 6e 20 66 69 6c 65 20 2a 2f entation file */
3a90: 0a 20 20 63 68 61 72 20 7a 42 61 73 65 6c 69 6e . char zBaselin
3aa0: 65 5b 55 55 49 44 5f 53 49 5a 45 2b 31 5d 3b 20 e[UUID_SIZE+1];
3ab0: 20 20 20 20 20 2f 2a 20 42 61 73 65 6c 69 6e 65 /* Baseline
3ac0: 20 55 55 49 44 20 2a 2f 0a 0a 20 20 6c 6f 67 69 UUID */.. logi
3ad0: 6e 5f 63 68 65 63 6b 5f 63 72 65 64 65 6e 74 69 n_check_credenti
3ae0: 61 6c 73 28 29 3b 0a 20 20 69 66 28 20 21 67 2e als();. if( !g.
3af0: 6f 6b 52 65 61 64 20 29 7b 20 6c 6f 67 69 6e 5f okRead ){ login_
3b00: 6e 65 65 64 65 64 28 29 3b 20 72 65 74 75 72 6e needed(); return
3b10: 3b 20 7d 0a 20 20 7a 4e 61 6d 65 20 3d 20 50 44 ; }. zName = PD
3b20: 28 22 6e 61 6d 65 22 2c 20 22 74 69 70 2f 69 6e ("name", "tip/in
3b30: 64 65 78 2e 77 69 6b 69 22 29 3b 0a 20 20 66 6f dex.wiki");. fo
3b40: 72 28 69 3d 30 3b 20 7a 4e 61 6d 65 5b 69 5d 20 r(i=0; zName[i]
3b50: 26 26 20 7a 4e 61 6d 65 5b 69 5d 21 3d 27 2f 27 && zName[i]!='/'
3b60: 3b 20 69 2b 2b 29 7b 7d 0a 20 20 69 66 28 20 7a ; i++){}. if( z
3b70: 4e 61 6d 65 5b 69 5d 3d 3d 30 20 7c 7c 20 69 3e Name[i]==0 || i>
3b80: 55 55 49 44 5f 53 49 5a 45 20 29 7b 0a 20 20 20 UUID_SIZE ){.
3b90: 20 67 6f 74 6f 20 64 6f 63 5f 6e 6f 74 5f 66 6f goto doc_not_fo
3ba0: 75 6e 64 3b 0a 20 20 7d 0a 20 20 6d 65 6d 63 70 und;. }. memcp
3bb0: 79 28 7a 42 61 73 65 6c 69 6e 65 2c 20 7a 4e 61 y(zBaseline, zNa
3bc0: 6d 65 2c 20 69 29 3b 0a 20 20 7a 42 61 73 65 6c me, i);. zBasel
3bd0: 69 6e 65 5b 69 5d 20 3d 20 30 3b 0a 20 20 7a 4e ine[i] = 0;. zN
3be0: 61 6d 65 20 2b 3d 20 69 3b 0a 20 20 77 68 69 6c ame += i;. whil
3bf0: 65 28 20 7a 4e 61 6d 65 5b 30 5d 3d 3d 27 2f 27 e( zName[0]=='/'
3c00: 20 29 7b 20 7a 4e 61 6d 65 2b 2b 3b 20 7d 0a 20 ){ zName++; }.
3c10: 20 69 66 28 20 21 66 69 6c 65 5f 69 73 5f 73 69 if( !file_is_si
3c20: 6d 70 6c 65 5f 70 61 74 68 6e 61 6d 65 28 7a 4e mple_pathname(zN
3c30: 61 6d 65 29 20 29 7b 0a 20 20 20 20 67 6f 74 6f ame) ){. goto
3c40: 20 64 6f 63 5f 6e 6f 74 5f 66 6f 75 6e 64 3b 0a doc_not_found;.
3c50: 20 20 7d 0a 20 20 69 66 28 20 73 74 72 63 6d 70 }. if( strcmp
3c60: 28 7a 42 61 73 65 6c 69 6e 65 2c 22 63 6b 6f 75 (zBaseline,"ckou
3c70: 74 22 29 3d 3d 30 20 29 7b 0a 20 20 20 20 2f 2a t")==0 ){. /*
3c80: 20 52 65 61 64 20 66 72 6f 6d 20 74 68 65 20 6c Read from the l
3c90: 6f 63 61 6c 20 63 68 65 63 6b 6f 75 74 20 2a 2f ocal checkout */
3ca0: 0a 20 20 20 20 63 68 61 72 20 2a 7a 46 75 6c 6c . char *zFull
3cb0: 70 61 74 68 3b 0a 20 20 20 20 64 62 5f 6d 75 73 path;. db_mus
3cc0: 74 5f 62 65 5f 77 69 74 68 69 6e 5f 74 72 65 65 t_be_within_tree
3cd0: 28 29 3b 0a 20 20 20 20 7a 46 75 6c 6c 70 61 74 ();. zFullpat
3ce0: 68 20 3d 20 6d 70 72 69 6e 74 66 28 22 25 73 2f h = mprintf("%s/
3cf0: 25 73 22 2c 20 67 2e 7a 4c 6f 63 61 6c 52 6f 6f %s", g.zLocalRoo
3d00: 74 2c 20 7a 4e 61 6d 65 29 3b 0a 20 20 20 20 69 t, zName);. i
3d10: 66 28 20 21 66 69 6c 65 5f 69 73 66 69 6c 65 28 f( !file_isfile(
3d20: 7a 46 75 6c 6c 70 61 74 68 29 20 29 7b 0a 20 20 zFullpath) ){.
3d30: 20 20 20 20 67 6f 74 6f 20 64 6f 63 5f 6e 6f 74 goto doc_not
3d40: 5f 66 6f 75 6e 64 3b 0a 20 20 20 20 7d 0a 20 20 _found;. }.
3d50: 20 20 69 66 28 20 62 6c 6f 62 5f 72 65 61 64 5f if( blob_read_
3d60: 66 72 6f 6d 5f 66 69 6c 65 28 26 66 69 6c 65 62 from_file(&fileb
3d70: 6f 64 79 2c 20 7a 46 75 6c 6c 70 61 74 68 29 3c ody, zFullpath)<
3d80: 30 20 29 7b 0a 20 20 20 20 20 20 67 6f 74 6f 20 0 ){. goto
3d90: 64 6f 63 5f 6e 6f 74 5f 66 6f 75 6e 64 3b 0a 20 doc_not_found;.
3da0: 20 20 20 7d 0a 20 20 7d 65 6c 73 65 7b 0a 20 20 }. }else{.
3db0: 20 20 64 62 5f 62 65 67 69 6e 5f 74 72 61 6e 73 db_begin_trans
3dc0: 61 63 74 69 6f 6e 28 29 3b 0a 20 20 20 20 69 66 action();. if
3dd0: 28 20 73 74 72 63 6d 70 28 7a 42 61 73 65 6c 69 ( strcmp(zBaseli
3de0: 6e 65 2c 22 74 69 70 22 29 3d 3d 30 20 29 7b 0a ne,"tip")==0 ){.
3df0: 20 20 20 20 20 20 76 69 64 20 3d 20 64 62 5f 69 vid = db_i
3e00: 6e 74 28 30 2c 20 22 53 45 4c 45 43 54 20 6f 62 nt(0, "SELECT ob
3e10: 6a 69 64 20 46 52 4f 4d 20 65 76 65 6e 74 20 57 jid FROM event W
3e20: 48 45 52 45 20 74 79 70 65 3d 27 63 69 27 22 0a HERE type='ci'".
3e30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3e40: 20 20 20 20 20 20 22 20 4f 52 44 45 52 20 42 59 " ORDER BY
3e50: 20 6d 74 69 6d 65 20 44 45 53 43 20 4c 49 4d 49 mtime DESC LIMI
3e60: 54 20 31 22 29 3b 0a 20 20 20 20 7d 65 6c 73 65 T 1");. }else
3e70: 7b 0a 20 20 20 20 20 20 76 69 64 20 3d 20 6e 61 {. vid = na
3e80: 6d 65 5f 74 6f 5f 72 69 64 28 7a 42 61 73 65 6c me_to_rid(zBasel
3e90: 69 6e 65 29 3b 0a 20 20 20 20 7d 0a 0a 20 20 20 ine);. }..
3ea0: 20 2f 2a 20 43 72 65 61 74 65 20 74 68 65 20 62 /* Create the b
3eb0: 61 73 65 6c 69 6e 65 20 63 61 63 68 65 20 69 66 aseline cache if
3ec0: 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 61 6c 72 it does not alr
3ed0: 65 61 64 79 20 65 78 69 73 74 20 2a 2f 0a 20 20 eady exist */.
3ee0: 20 20 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 db_multi_exec(
3ef0: 0a 20 20 20 20 20 20 22 43 52 45 41 54 45 20 54 . "CREATE T
3f00: 41 42 4c 45 20 49 46 20 4e 4f 54 20 45 58 49 53 ABLE IF NOT EXIS
3f10: 54 53 20 76 63 61 63 68 65 28 5c 6e 22 0a 20 20 TS vcache(\n".
3f20: 20 20 20 20 22 20 20 76 69 64 20 49 4e 54 45 47 " vid INTEG
3f30: 45 52 2c 20 20 20 20 20 20 20 20 20 2d 2d 20 62 ER, -- b
3f40: 61 73 65 6c 69 6e 65 20 49 44 5c 6e 22 0a 20 20 aseline ID\n".
3f50: 20 20 20 20 22 20 20 66 6e 61 6d 65 20 54 45 58 " fname TEX
3f60: 54 2c 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 T, -- f
3f70: 69 6c 65 6e 61 6d 65 5c 6e 22 0a 20 20 20 20 20 ilename\n".
3f80: 20 22 20 20 72 69 64 20 49 4e 54 45 47 45 52 2c " rid INTEGER,
3f90: 20 20 20 20 20 20 20 20 20 2d 2d 20 61 72 74 69 -- arti
3fa0: 66 61 63 74 20 49 44 5c 6e 22 0a 20 20 20 20 20 fact ID\n".
3fb0: 20 22 20 20 55 4e 49 51 55 45 28 76 69 64 2c 66 " UNIQUE(vid,f
3fc0: 6e 61 6d 65 2c 72 69 64 29 5c 6e 22 0a 20 20 20 name,rid)\n".
3fd0: 20 20 20 22 29 22 0a 20 20 20 20 29 3b 0a 0a 20 ")". );..
3fe0: 20 20 20 2f 2a 20 43 68 65 63 6b 20 74 6f 20 73 /* Check to s
3ff0: 65 65 20 69 66 20 74 68 65 20 64 6f 63 75 6d 65 ee if the docume
4000: 6e 74 61 74 69 6f 6e 20 66 69 6c 65 20 61 72 74 ntation file art
4010: 69 66 61 63 74 20 49 44 20 69 73 20 63 6f 6e 74 ifact ID is cont
4020: 61 69 6e 65 64 0a 20 20 20 20 2a 2a 20 69 6e 20 ained. ** in
4030: 74 68 65 20 62 61 73 65 6c 69 6e 65 20 63 61 63 the baseline cac
4040: 68 65 20 2a 2f 0a 20 20 20 20 72 69 64 20 3d 20 he */. rid =
4050: 64 62 5f 69 6e 74 28 30 2c 20 22 53 45 4c 45 43 db_int(0, "SELEC
4060: 54 20 72 69 64 20 46 52 4f 4d 20 76 63 61 63 68 T rid FROM vcach
4070: 65 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e".
4080: 20 20 20 20 20 20 20 22 20 57 48 45 52 45 20 76 " WHERE v
4090: 69 64 3d 25 64 20 41 4e 44 20 66 6e 61 6d 65 3d id=%d AND fname=
40a0: 25 51 22 2c 20 76 69 64 2c 20 7a 4e 61 6d 65 29 %Q", vid, zName)
40b0: 3b 0a 20 20 20 20 69 66 28 20 72 69 64 3d 3d 30 ;. if( rid==0
40c0: 20 26 26 20 64 62 5f 65 78 69 73 74 73 28 22 53 && db_exists("S
40d0: 45 4c 45 43 54 20 31 20 46 52 4f 4d 20 76 63 61 ELECT 1 FROM vca
40e0: 63 68 65 20 57 48 45 52 45 20 76 69 64 3d 25 64 che WHERE vid=%d
40f0: 22 2c 20 76 69 64 29 20 29 7b 0a 20 20 20 20 20 ", vid) ){.
4100: 20 67 6f 74 6f 20 64 6f 63 5f 6e 6f 74 5f 66 6f goto doc_not_fo
4110: 75 6e 64 3b 0a 20 20 20 20 7d 0a 0a 20 20 20 20 und;. }..
4120: 69 66 28 20 72 69 64 3d 3d 30 20 29 7b 0a 20 20 if( rid==0 ){.
4130: 20 20 20 20 53 74 6d 74 20 73 3b 0a 20 20 20 20 Stmt s;.
4140: 20 20 42 6c 6f 62 20 62 61 73 65 6c 69 6e 65 3b Blob baseline;
4150: 0a 20 20 20 20 20 20 4d 61 6e 69 66 65 73 74 20 . Manifest
4160: 6d 3b 0a 0a 20 20 20 20 20 20 2f 2a 20 41 64 64 m;.. /* Add
4170: 20 74 68 65 20 76 69 64 20 62 61 73 65 6c 69 6e the vid baselin
4180: 65 20 74 6f 20 74 68 65 20 63 61 63 68 65 20 2a e to the cache *
4190: 2f 0a 20 20 20 20 20 20 69 66 28 20 64 62 5f 69 /. if( db_i
41a0: 6e 74 28 30 2c 20 22 53 45 4c 45 43 54 20 63 6f nt(0, "SELECT co
41b0: 75 6e 74 28 2a 29 20 46 52 4f 4d 20 76 63 61 63 unt(*) FROM vcac
41c0: 68 65 22 29 3e 31 30 30 30 30 20 29 7b 0a 20 20 he")>10000 ){.
41d0: 20 20 20 20 20 20 64 62 5f 6d 75 6c 74 69 5f 65 db_multi_e
41e0: 78 65 63 28 22 44 45 4c 45 54 45 20 46 52 4f 4d xec("DELETE FROM
41f0: 20 76 63 61 63 68 65 22 29 3b 0a 20 20 20 20 20 vcache");.
4200: 20 7d 0a 20 20 20 20 20 20 69 66 28 20 63 6f 6e }. if( con
4210: 74 65 6e 74 5f 67 65 74 28 76 69 64 2c 20 26 62 tent_get(vid, &b
4220: 61 73 65 6c 69 6e 65 29 3d 3d 30 20 29 7b 0a 20 aseline)==0 ){.
4230: 20 20 20 20 20 20 20 67 6f 74 6f 20 64 6f 63 5f goto doc_
4240: 6e 6f 74 5f 66 6f 75 6e 64 3b 0a 20 20 20 20 20 not_found;.
4250: 20 7d 0a 20 20 20 20 20 20 69 66 28 20 6d 61 6e }. if( man
4260: 69 66 65 73 74 5f 70 61 72 73 65 28 26 6d 2c 20 ifest_parse(&m,
4270: 26 62 61 73 65 6c 69 6e 65 29 3d 3d 30 20 7c 7c &baseline)==0 ||
4280: 20 6d 2e 74 79 70 65 21 3d 43 46 54 59 50 45 5f m.type!=CFTYPE_
4290: 4d 41 4e 49 46 45 53 54 20 29 7b 0a 20 20 20 20 MANIFEST ){.
42a0: 20 20 20 20 67 6f 74 6f 20 64 6f 63 5f 6e 6f 74 goto doc_not
42b0: 5f 66 6f 75 6e 64 3b 0a 20 20 20 20 20 20 7d 0a _found;. }.
42c0: 20 20 20 20 20 20 64 62 5f 70 72 65 70 61 72 65 db_prepare
42d0: 28 26 73 2c 0a 20 20 20 20 20 20 20 20 22 49 4e (&s,. "IN
42e0: 53 45 52 54 20 49 4e 54 4f 20 76 63 61 63 68 65 SERT INTO vcache
42f0: 28 76 69 64 2c 66 6e 61 6d 65 2c 72 69 64 29 22 (vid,fname,rid)"
4300: 0a 20 20 20 20 20 20 20 20 22 20 53 45 4c 45 43 . " SELEC
4310: 54 20 25 64 2c 20 3a 66 6e 61 6d 65 2c 20 72 69 T %d, :fname, ri
4320: 64 20 46 52 4f 4d 20 62 6c 6f 62 22 0a 20 20 20 d FROM blob".
4330: 20 20 20 20 20 22 20 20 57 48 45 52 45 20 75 75 " WHERE uu
4340: 69 64 3d 3a 75 75 69 64 22 2c 0a 20 20 20 20 20 id=:uuid",.
4350: 20 20 20 76 69 64 0a 20 20 20 20 20 20 29 3b 0a vid. );.
4360: 20 20 20 20 20 20 66 6f 72 28 69 3d 30 3b 20 69 for(i=0; i
4370: 3c 6d 2e 6e 46 69 6c 65 3b 20 69 2b 2b 29 7b 0a <m.nFile; i++){.
4380: 20 20 20 20 20 20 20 20 64 62 5f 62 69 6e 64 5f db_bind_
4390: 74 65 78 74 28 26 73 2c 20 22 3a 66 6e 61 6d 65 text(&s, ":fname
43a0: 22 2c 20 6d 2e 61 46 69 6c 65 5b 69 5d 2e 7a 4e ", m.aFile[i].zN
43b0: 61 6d 65 29 3b 0a 20 20 20 20 20 20 20 20 64 62 ame);. db
43c0: 5f 62 69 6e 64 5f 74 65 78 74 28 26 73 2c 20 22 _bind_text(&s, "
43d0: 3a 75 75 69 64 22 2c 20 6d 2e 61 46 69 6c 65 5b :uuid", m.aFile[
43e0: 69 5d 2e 7a 55 75 69 64 29 3b 0a 20 20 20 20 20 i].zUuid);.
43f0: 20 20 20 64 62 5f 73 74 65 70 28 26 73 29 3b 0a db_step(&s);.
4400: 20 20 20 20 20 20 20 20 64 62 5f 72 65 73 65 74 db_reset
4410: 28 26 73 29 3b 0a 20 20 20 20 20 20 7d 0a 20 20 (&s);. }.
4420: 20 20 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 db_finalize(
4430: 26 73 29 3b 0a 20 20 20 20 20 20 6d 61 6e 69 66 &s);. manif
4440: 65 73 74 5f 63 6c 65 61 72 28 26 6d 29 3b 0a 0a est_clear(&m);..
4450: 20 20 20 20 20 20 2f 2a 20 54 72 79 20 61 67 61 /* Try aga
4460: 69 6e 20 74 6f 20 66 69 6e 64 20 74 68 65 20 66 in to find the f
4470: 69 6c 65 20 2a 2f 0a 20 20 20 20 20 20 72 69 64 ile */. rid
4480: 20 3d 20 64 62 5f 69 6e 74 28 30 2c 20 22 53 45 = db_int(0, "SE
4490: 4c 45 43 54 20 72 69 64 20 46 52 4f 4d 20 76 63 LECT rid FROM vc
44a0: 61 63 68 65 22 0a 20 20 20 20 20 20 20 20 20 20 ache".
44b0: 20 20 20 20 20 20 20 20 20 20 20 20 22 20 57 48 " WH
44c0: 45 52 45 20 76 69 64 3d 25 64 20 41 4e 44 20 66 ERE vid=%d AND f
44d0: 6e 61 6d 65 3d 25 51 22 2c 20 76 69 64 2c 20 7a name=%Q", vid, z
44e0: 4e 61 6d 65 29 3b 0a 20 20 20 20 7d 0a 20 20 20 Name);. }.
44f0: 20 69 66 28 20 72 69 64 3d 3d 30 20 29 7b 0a 20 if( rid==0 ){.
4500: 20 20 20 20 20 67 6f 74 6f 20 64 6f 63 5f 6e 6f goto doc_no
4510: 74 5f 66 6f 75 6e 64 3b 0a 20 20 20 20 7d 0a 0a t_found;. }..
4520: 20 20 20 20 2f 2a 20 47 65 74 20 74 68 65 20 66 /* Get the f
4530: 69 6c 65 20 63 6f 6e 74 65 6e 74 20 2a 2f 0a 20 ile content */.
4540: 20 20 20 69 66 28 20 63 6f 6e 74 65 6e 74 5f 67 if( content_g
4550: 65 74 28 72 69 64 2c 20 26 66 69 6c 65 62 6f 64 et(rid, &filebod
4560: 79 29 3d 3d 30 20 29 7b 0a 20 20 20 20 20 20 67 y)==0 ){. g
4570: 6f 74 6f 20 64 6f 63 5f 6e 6f 74 5f 66 6f 75 6e oto doc_not_foun
4580: 64 3b 0a 20 20 20 20 7d 0a 20 20 20 20 64 62 5f d;. }. db_
4590: 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 end_transaction(
45a0: 30 29 3b 0a 20 20 7d 0a 0a 20 20 2f 2a 20 54 68 0);. }.. /* Th
45b0: 65 20 66 69 6c 65 20 69 73 20 6e 6f 77 20 63 6f e file is now co
45c0: 6e 74 61 69 6e 65 64 20 69 6e 20 74 68 65 20 66 ntained in the f
45d0: 69 6c 65 62 6f 64 79 20 62 6c 6f 62 2e 20 20 44 ilebody blob. D
45e0: 65 6c 69 76 65 72 20 74 68 65 0a 20 20 2a 2a 20 eliver the. **
45f0: 66 69 6c 65 20 74 6f 20 74 68 65 20 75 73 65 72 file to the user
4600: 20 0a 20 20 2a 2f 0a 20 20 7a 4d 69 6d 65 20 3d . */. zMime =
4610: 20 6d 69 6d 65 74 79 70 65 5f 66 72 6f 6d 5f 6e mimetype_from_n
4620: 61 6d 65 28 7a 4e 61 6d 65 29 3b 0a 20 20 69 66 ame(zName);. if
4630: 28 20 73 74 72 63 6d 70 28 7a 4d 69 6d 65 2c 20 ( strcmp(zMime,
4640: 22 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 66 "application/x-f
4650: 6f 73 73 69 6c 2d 77 69 6b 69 22 29 3d 3d 30 20 ossil-wiki")==0
4660: 29 7b 0a 20 20 20 20 73 74 79 6c 65 5f 68 65 61 ){. style_hea
4670: 64 65 72 28 22 44 6f 63 75 6d 65 6e 74 61 74 69 der("Documentati
4680: 6f 6e 22 29 3b 0a 20 20 20 20 77 69 6b 69 5f 63 on");. wiki_c
4690: 6f 6e 76 65 72 74 28 26 66 69 6c 65 62 6f 64 79 onvert(&filebody
46a0: 2c 20 30 2c 20 30 29 3b 0a 20 20 20 20 73 74 79 , 0, 0);. sty
46b0: 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 20 20 7d le_footer();. }
46c0: 65 6c 73 65 20 69 66 28 20 73 74 72 63 6d 70 28 else if( strcmp(
46d0: 7a 4d 69 6d 65 2c 20 22 74 65 78 74 2f 70 6c 61 zMime, "text/pla
46e0: 69 6e 22 29 3d 3d 30 20 29 7b 0a 20 20 20 20 73 in")==0 ){. s
46f0: 74 79 6c 65 5f 68 65 61 64 65 72 28 22 44 6f 63 tyle_header("Doc
4700: 75 6d 65 6e 74 61 74 69 6f 6e 22 29 3b 0a 20 20 umentation");.
4710: 20 20 40 20 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e @ <blockquote>
4720: 3c 70 72 65 3e 0a 20 20 20 20 40 20 25 68 28 62 <pre>. @ %h(b
4730: 6c 6f 62 5f 73 74 72 28 26 66 69 6c 65 62 6f 64 lob_str(&filebod
4740: 79 29 29 0a 20 20 20 20 40 20 3c 2f 70 72 65 3e y)). @ </pre>
4750: 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 </blockquote>.
4760: 20 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 style_footer()
4770: 3b 0a 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 63 ;. }else{. c
4780: 67 69 5f 73 65 74 5f 63 6f 6e 74 65 6e 74 5f 74 gi_set_content_t
4790: 79 70 65 28 7a 4d 69 6d 65 29 3b 0a 20 20 20 20 ype(zMime);.
47a0: 63 67 69 5f 73 65 74 5f 63 6f 6e 74 65 6e 74 28 cgi_set_content(
47b0: 26 66 69 6c 65 62 6f 64 79 29 3b 0a 20 20 7d 0a &filebody);. }.
47c0: 20 20 72 65 74 75 72 6e 3b 0a 0a 64 6f 63 5f 6e return;..doc_n
47d0: 6f 74 5f 66 6f 75 6e 64 3a 0a 20 20 2f 2a 20 4a ot_found:. /* J
47e0: 75 6d 70 20 68 65 72 65 20 77 68 65 6e 20 75 6e ump here when un
47f0: 61 62 6c 65 20 74 6f 20 6c 6f 63 61 74 65 20 74 able to locate t
4800: 68 65 20 64 6f 63 75 6d 65 6e 74 20 2a 2f 0a 20 he document */.
4810: 20 64 62 5f 65 6e 64 5f 74 72 61 6e 73 61 63 74 db_end_transact
4820: 69 6f 6e 28 30 29 3b 0a 20 20 73 74 79 6c 65 5f ion(0);. style_
4830: 68 65 61 64 65 72 28 22 44 6f 63 75 6d 65 6e 74 header("Document
4840: 20 4e 6f 74 20 46 6f 75 6e 64 22 29 3b 0a 20 20 Not Found");.
4850: 40 20 3c 70 3e 4e 6f 20 73 75 63 68 20 64 6f 63 @ <p>No such doc
4860: 75 6d 65 6e 74 3a 20 25 68 28 50 44 28 22 6e 61 ument: %h(PD("na
4870: 6d 65 22 2c 22 74 69 70 2f 69 6e 64 65 78 2e 77 me","tip/index.w
4880: 69 6b 69 22 29 29 3c 2f 70 3e 0a 20 20 73 74 79 iki"))</p>. sty
4890: 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 20 20 72 le_footer();. r
48a0: 65 74 75 72 6e 3b 20 20 0a 7d 0a eturn; .}.