[Date Index]
[Thread Index]

[Date Prev] bullet [Date Next] bullet [Thread Prev] bullet [Thread Next]
bullet
Synchronization of mime-like types among multiple servers
bullet bullet bullet bullet

# My apologies to those who received this twice.

Dear team members.

I'm personally maintaining a list of agendas that I believe not-park team must solve before going into full operational status. One of them is a synchronization of mime-like types among multiple CP servers.

Some one suggested me that we only have to throw a mail to not-park, and have appropriate mime-types related files updated. This is simple, but may not always work, e.g. we have no common starting point, so the incremental update does not work, or a new mirror site may come up in the middle of the year and with no archive of not-park mailing list, there's no way to know what types to add.

There's a definite need for a master list. I've created one and my very first perl program to generate http server type dependent files from the master list. I propose that we distribute a list of this kind in the same fashion that CP contents are mirrored.

Attached you will see my list and the program.

The syntax of the list is obvious.

Genmime.pl accepts two arguments:

% genmime.pl server-type master-filename

where server-type = [ncsa|cern|ns].

If the server-type is "ncsa", then it will generate two files, ncsa.mime.types and ncsa.srm.conf.add. The former is to replace conf/mime.types file and the latter is to replace Add[Type|Encoding] directives in the conf/srm.conf file.

If the server-type is ns (for netscape), it will generate a single file ns.mime.types which is a replacement for config/mime.types file.

If the server-type is cern, it will generate cern.conf.add filled with directives to replace Add[Type,Encoding] directives in configs/<your-configuration-filename>.

I've tested this setup with the ncsa server on our staging server and seem to work okay. I want to know if this works on other server types, especially, the netscape's server.

Comments, suggestions, criticisms as well as additional entries for the master list are all welcome.

--- shinoda

---- Cut Here and feed the following to sh ---- #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # made 01/05/1996 16:40 UTC by shinoda@is26e0s00 # Source directory /tmp_mnt/home/fs000/shinoda/doc/expo/cp/types # # existing files will NOT be overwritten unless -c is specified # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 3411 -rw-r--r-- types.master # 2231 -rwxr-xr-x genmime.pl # # ============= types.master ============== if test -f 'types.master' -a X"$1" != X"-c"; then echo 'x - skipping types.master (File already exists)' else echo 'x - extracting types.master (Text)' sed 's/^X//' << 'SHAR_EOF' > 'types.master' && X # This is a comment # # Master type list # # # Types # # ctx class mime-type/subtype[:encoding] extension # all type application/activemessage# I love comments all type application/andrew-inset all type application/applefile all type application/atomicmail all type application/dca-rft all type application/dec-dx all type application/mac-binhex40 hqx all type application/macwriteii all type application/msword all type application/news-message-id all type application/news-transmission all type application/octet-stream bin exe all type application/oda oda all type application/pdf pdf all type application/postscript ai eps ps all type application/remote-printing all type application/rtf rtf all type application/slate all type application/x-mif mif all type application/wita all type application/wordperfect5.1 all type application/x-csh csh all type application/x-dvi dvi all type application/x-hdf hdf all type application/x-latex latex all type application/x-netcdf nc cdf all type application/x-sh sh all type application/x-tcl tcl all type application/x-tex tex all type application/x-texinfo texinfo texi all type application/x-troff t tr roff all type application/x-troff-man man all type application/x-troff-me me all type application/x-troff-ms ms all type application/x-wais-source src all type application/zip zip all type application/x-bcpio bcpio all type application/x-cpio cpio all type application/x-gtar gtar all type application/x-shar shar all type application/x-sv4cpio sv4cpio all type application/x-sv4crc sv4crc all type application/x-tar tar all type application/x-ustar ustar all type audio/basic au snd all type audio/x-aiff aif aiff aifc all type audio/x-wav wav cern type audio/x-pn-realaudio:binary ram !cern type audio/x-pn-realaudio ram all type image/gif gif all type image/ief ief all type image/jpeg jpeg jpg jpe all type image/tiff tiff tif all type image/x-cmu-raster ras all type image/x-portable-anymap pnm all type image/x-portable-bitmap pbm all type image/x-portable-graymap pgm all type image/x-portable-pixmap ppm all type image/x-rgb rgb all type image/x-xbitmap xbm all type image/x-xpixmap xpm all type image/x-xwindowdump xwd all type message/external-body all type message/news all type message/partial all type message/rfc822 all type multipart/alternative all type multipart/appledouble all type multipart/digest all type multipart/mixed all type multipart/parallel all type text/html htm html all type text/x-sgml sgm sgml all type text/plain txt all type text/richtext rtx all type text/tab-separated-values tsv all type text/x-setext etx all type video/mpeg mpeg mpg mpe all type video/quicktime qt mov all type video/x-fli fli all type video/x-msvideo avi all type video/x-sgi-movie movie # # Things added since installation # all type x-world/x-vrml vrml wrl all type image/x-MS-bmp bmp all type application/x-tcl tcl all type application/x-kinemation wkn # # Encodings # !ns enc x-compress Z ns enc x-compress z all enc x-gzip gz # # Magic (server internal) types # ncsa int text/x-server-parsed-html shtml ncsa int text/x-imagemap map ncsa int application/x-httpd-cgi cgi # ns int magnus-internal/imagemap map ns int magnus-internal/parsed-html shtml ns int magnus-internal/cgi cgi SHAR_EOF chmod 0644 types.master || echo 'restore of types.master failed' Wc_c="`wc -c < 'types.master'`" test 3411 -eq "$Wc_c" || echo 'types.master: original size 3411, current size' "$Wc_c" fi # ============= genmime.pl ============== if test -f 'genmime.pl' -a X"$1" != X"-c"; then echo 'x - skipping genmime.pl (File already exists)' else echo 'x - extracting genmime.pl (Text)' sed 's/^X//' << 'SHAR_EOF' > 'genmime.pl' && #!/usr/local/bin/perl X $optexist=0; $sysctx = $ARGV[0] ; $optexist=1, shift if $ARGV[0] ne ''; X # print "$sysctx\n" ; X if ( $sysctx eq "ns" ) { X open (MTFILE, ">ns.mime.types") || die "can't open ns.mime.types" ; X print MTFILE "#--Netscape Communications Corporation MIME Information\n\n" } elsif ( $sysctx eq "ncsa" ) { X open (MTFILE, ">ncsa.mime.types") || die "can't open ncsa.mime.types" ; X open (ENCFILE, ">ncsa.srm.conf.add") || die "can't open ncsa.srm.conf.add" ; } elsif ( $sysctx eq "cern" ) { X open (MTFILE, ">cern.conf.add") || die "can't open ncsa.mime.types" ; } X while (<>) { X chop ; X s/\#.*// ; X s/[\s]+/ /g ; X next if ( $_ =~ /^[\s]*$/ ) ; X @field = split(' ') ; X X # print "$field[1],$field[2],$field[3],$field[4]\n" ; X # print "$field[0]\n" ; X X # X # Accept all,$sysctx,!<other context> X # X if ($field[0] ne "all") { X if (substr($field[0],0,1) eq "!") { X next if (substr($field[0],1) eq $sysctx) ; X } else { X next if ($field[0] ne $sysctx) ; X } X } X X print "$field[0]\n" ; X X $ext = "" ; X X if ( $sysctx eq "ncsa" ) { X &packext(" ") ; X if ( $field[1] eq "type" ) { X print MTFILE "$field[2] $ext\n"; X } elsif ( $field[1] eq "enc" ) { X print ENCFILE "AddEncoding $field[2] $ext\n" ; X } elsif ( $field[1] eq "int" ) { X print ENCFILE "AddType $field[2] $ext\n" ; X } X } elsif ( $sysctx eq "cern" ) { X &packext(" ") ; X next if ($ext eq "") ; X # X # Mime-type/subtype may have optional fields. X # Check them out. X # X @tfield = split(':', $field[2]) ; X if ( $field[1] eq "type" ) { X foreach $exname ($ext) { X print MTFILE "AddType .$exname $tfield[0] $tfield[1] $tfield[2]\n" ; X } X } elsif ( $field[1] eq "enc" ) { X foreach $exname ($ext) { X print MTFILE "AddEncoding .$exname $field[2]\n"; X } X } X } elsif ( $sysctx eq "ns" ) { X &packext(",") ; X next if ($ext eq "") ; X if ( $field[1] eq "type" ) { X print MTFILE "type=$field[2] exts=$ext\n"; X } elsif ( $field[1] eq "enc" ) { X print MTFILE "enc=$field[2] exts=$ext\n" ; X } elsif ( $field[1] eq "int" ) { X print MTFILE "type=$field[2] exts=$ext\n" ; X } X } } X sub packext { X local($delim) = @_ ; X $pos = 3 ; X while ($field[$pos] ne "") { X if ($ext ne "") { X $ext .= $delim ; X } X $ext .= $field[$pos] ; X $pos++ ; X } } SHAR_EOF chmod 0755 genmime.pl || echo 'restore of genmime.pl failed' Wc_c="`wc -c < 'genmime.pl'`" test 2231 -eq "$Wc_c" || echo 'genmime.pl: original size 2231, current size' "$Wc_c" fi exit 0

bullet
[Date Prev] bullet [Date Next] bullet [Thread Prev] bullet [Thread Next]
bullet