??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
mfc @ sq d Z d d l Z d d l Z d d l Z d d l Z y d d l Z Wn e k
r_ d Z n Xd d d d d d g Z d d
d d d
d d d d g Z e
a d a d d- d YZ
e d Z e d Z e d Z e d Z d d Z d Z d Z e e d k rmd d l Z d Z d d Z y/ e j e j d d d d! d" g \ Z Z Wn# e j k
rZ e d e n Xd Z d# Z xW e D]O \ Z! Z" e! d. k re d# qe! d/ k rd# Z qe! d0 k rd Z qqWxx e D]m Z# e r.e e# e Z$ e$ s&d* Ge# GHqfe$ GHqe e# e \ Z$ Z% e$ sUd* Ge# GHqd+ Ge$ Gd, Ge% GHqWn d S(1 s Guess the MIME type of a file.
This module defines two useful functions:
guess_type(url, strict=1) -- guess the MIME type and encoding of a URL.
guess_extension(type, strict=1) -- guess the extension for a given MIME type.
It also contains the following, for tuning the behavior:
Data:
knownfiles -- list of files to parse
inited -- flag set when init() has been called
suffix_map -- dictionary mapping suffixes to suffixes
encodings_map -- dictionary mapping suffixes to encodings
types_map -- dictionary mapping suffixes to types
Functions:
init([files]) -- parse a list of files, default knownfiles (on Windows, the
default values are taken from the registry)
read_mime_types(file) -- parse one file, return a dictionary or None
iNt
guess_typet guess_extensiont guess_all_extensionst add_typet read_mime_typest inits /etc/mime.typess /etc/httpd/mime.typess /etc/httpd/conf/mime.typess /etc/apache/mime.typess /etc/apache2/mime.typess$ /usr/local/etc/httpd/conf/mime.typess" /usr/local/lib/netscape/mime.typess /usr/local/etc/mime.typest MimeTypesc B sq e Z d Z d e d Z e d Z e d Z e d Z e d Z e d Z e d Z
e d Z RS(
s MIME-types datastore.
This datastore can handle information from mime.types-style files
and supports basic determination of MIME type from a filename or
URL, and can guess a reasonable extension given a MIME type.
c C s t s t n t j | _ t j | _ i i f | _ i i f | _ x- t j D] \ } } | j | | t qY Wx- t
j D] \ } } | j | | t q Wx | D] } | j | | q Wd S( N(
t initedR t
encodings_mapt copyt
suffix_mapt types_mapt
types_map_invt itemsR t Truet common_typest Falset read( t selft filenamest strictt extt typet name( ( s! /usr/lib64/python2.7/mimetypes.pyt __init__@ s
c C sJ | | j | | <| j | j | g } | | k rF | j | n d S( s Add a mapping between a type and an extension.
When the extension is already known, the new
type will replace the old one. When the type
is already known the extension will be added
to the list of known extensions.
If strict is true, information will be added to
list of standard types, else to the list of non-standard
types.
N( R R t
setdefaultt append( R R R R t exts( ( s! /usr/lib64/python2.7/mimetypes.pyR N s c C s t j | \ } } | d k r | j d } | d k r@ d S| j d d | } | d k rn | | } n
| | } d | k s d | k r d } n | d f St j | \ } } x3 | | j k r t j | | j | \ } } q W| | j k r"| j | } t j | \ } } n d } | j t }
| |
k rO|
| | f S| j
|
k ru|
| j
| f S| rd | f S| j t }
| |
k r|
| | f S| j
|
k r|
| j
| f Sd | f Sd S(
s: Guess the type of a file based on its URL.
Return value is a tuple (type, encoding) where type is None if
the type can't be guessed (no or unknown suffix) or a string
of the form type/subtype, usable for a MIME Content-type
header; and encoding is None for no encoding or the name of
the program used to encode (e.g. compress or gzip). The
mappings are table driven. Encoding suffixes are case
sensitive; type suffixes are first tried case sensitive, then
case insensitive.
The suffixes .tgz, .taz and .tz (case sensitive!) are all
mapped to '.tar.gz'. (This is table-driven too, using the
dictionary suffix_map.)
Optional `strict' argument when False adds a bunch of commonly found,
but non-standard types.
t datat ,i t ;t =t /s
text/plainN( NN( t urllibt splittypet findt Nonet posixpatht splitextR
R R R t lowerR ( R t urlR t schemet commat semiR t baseR t encodingR ( ( s! /usr/lib64/python2.7/mimetypes.pyR _ s@
$
c C sr | j } | j t j | g } | sn x@ | j t j | g D]" } | | k rE | j | qE qE Wn | S( s Guess the extensions for a file based on its MIME type.
Return value is a list of strings giving the possible filename
extensions, including the leading dot ('.'). The extension is not
guaranteed to have been associated with any particular data stream,
but would be mapped to the MIME type `type' by guess_type().
Optional `strict' argument when false adds a bunch of commonly found,
but non-standard types.
( R' R R t getR R ( R R R t
extensionsR ( ( s! /usr/lib64/python2.7/mimetypes.pyR s c C s$ | j | | } | s d S| d S( s Guess the extension for a file based on its MIME type.
Return value is a string giving a filename extension,
including the leading dot ('.'). The extension is not
guaranteed to have been associated with any particular data
stream, but would be mapped to the MIME type `type' by
guess_type(). If no extension can be guessed for `type', None
is returned.
Optional `strict' argument when false adds a bunch of commonly found,
but non-standard types.
i N( R R$ ( R R R R/ ( ( s! /usr/lib64/python2.7/mimetypes.pyR s
c C s) t | } | j | | Wd QXd S( s
Read a single mime.types-format file, specified by pathname.
If strict is true, information will be added to
list of standard types, else to the list of non-standard
types.
N( t opent readfp( R t filenameR t fp( ( s! /usr/lib64/python2.7/mimetypes.pyR s c C s x | j } | s Pn | j } x9 t t | D]% } | | d d k r8 | | 3Pq8 q8 W| sm q n | d | d } } x% | D] } | j | d | | q Wq d S( s
Read a single mime.types-format file.
If strict is true, information will be added to
list of standard types, else to the list of non-standard
types.
i t #i t .N( t readlinet splitt ranget lenR ( R R3 R t linet wordst iR t suffixest suff( ( s! /usr/lib64/python2.7/mimetypes.pyR1 s
c s t s
d S f d } t j t j t j d } x | | D] } y7 t j | | } t j | d \ } } Wd QXWn t k
r qJ n X| t j k r qJ n y | j } Wn t k
r qJ n X| j
| | | qJ WWd QXd S( s
Load the MIME types database from Windows registry.
If strict is true, information will be added to
list of standard types, else to the list of non-standard
types.
Nc 3 sx d } xk t rs y t j | | } Wn t k
r9 Pn Xy | j } Wn t k
r` n X| V| d 7} q Wd S( Ni i ( R t _winregt EnumKeyt EnvironmentErrort encodet UnicodeEncodeError( t mimedbR<