;ELC   
;;; Compiled by aatharuv@cutter-john.mit.edu on Sun Jan  5 18:41:46 2003
;;; from file /afs/sipb.mit.edu/contrib/emacs/packages/url-cvs-20030105-src/lisp/url-cache.el
;;; in Emacs version 21.1.1
;;; with bytecomp version 2.85
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`url-cache.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(require 'url-parse)
#@52 *The directory where cache files should be stored.
(custom-declare-variable 'url-cache-directory '(expand-file-name "cache" url-configuration-directory) '(#$ . -677) :type 'directory :group 'url-file)
#@75 Follows the documentation of `file-writable-p', unlike `file-writable-p'.
(defalias 'url-cache-file-writable-p #[(file) "\301!\205 \302!\203 \303!?\207\303\304!!\207" [file file-writable-p file-exists-p file-directory-p file-name-directory] 3 (#$ . 884)])
#@502 Makes it possible to cache data in FILE.
Creates any necessary parent directories, deleting any non-directory files
that would stop this.  Returns nil if parent directories can not be
created.  If FILE already exists as a non-directory, it changes
permissions of FILE or deletes FILE to make it possible to write a new
version of FILE.  Returns nil if this can not be done.  Returns nil if
FILE already exists as a directory.  Otherwise, returns t, indicating that
FILE can be created or overwritten.
(defalias 'url-cache-prepare #[(file) "\301!\203 \302\207\303!\203 \304\207\304\305\306\217\207" [file url-cache-file-writable-p t file-directory-p nil (byte-code "\301\302!\303\"\206\n \303\207" [file make-directory file-name-directory t] 3) ((error))] 3 (#$ . 1153)])
#@33 Store buffer BUFF in the cache.
(defalias 'url-store-in-cache #[(&optional buff) "\205) \303!\205) \212\203 q\210\304\305\306!!\307	!\205( \310\311ed	\312\313%)*\207" [buff fname coding-system-for-write get-buffer url-cache-create-filename url-view-url t url-cache-prepare binary write-region nil 5] 6 (#$ . 1935)])
#@38 Return non-nil if the URL is cached.
(defalias 'url-is-cached #[(url) "\303!\304	!	\205 \305	!\205 \n@\306=?\205 \307\n8*\207" [url fname attribs url-cache-create-filename file-attributes file-exists-p t 5] 2 (#$ . 2264)])
#@46 Return a filename in the local cache for URL
(defalias 'url-cache-create-filename-human-readable #[(url) "\205\302 \306!\203 \307!\202 \310!\211\311H	\312H\313 \n\206% \314\315\316\206, \317\320\"!BB	\321H\211\203N G\311U\204N \311H\322U\203N \323\324O\203\\ \324\325\326\327#)\205e \325\330\327#\211\204n \324\202\257 \327\230\204z \331\230\203 \202\257 \332!\322U\203\236 \333\324O\331\230\203\227 P\202\257 \323\324O\202\257 \333\324O\331\230\203\256 P\202\257 \211\205\300 \334\334\325\335\f\331# \"\".\207" [url urlobj protocol hostname host-components fname vectorp url-recreate-url url-generic-parse-url 0 3 user-real-login-name "file" reverse split-string "localhost" "\\." 5 47 1 nil mapconcat #[(x) "\302U\203 	\203 \303\304\207\302U\203 \305\306\207\303\307!\207" [x slash 47 nil "%2F" t "/" char-to-string] 2] "" #[(x) "\301U\203 \302\207\303!\207" [x 126 "" char-to-string] 2] "/" string-to-char -1 expand-file-name identity slash url-directory-index-file url-cache-directory] 8 (#$ . 2499)])
#@95 Create a cached filename using MD5.
 Very fast if you are in XEmacs, suitably fast otherwise.
(defalias 'url-cache-create-filename-using-md5 #[(url) "\306\307!\210\205S \310!\203 \311!\202 \307!\312!\211\313H\n\314H\315 \206- \316\317\320\321\f\2065 \322\323\"\"\237BB\n\324H\211\205Q \325	\325\326\327\330#\"\".\207" [url checksum urlobj protocol hostname host-components require md5 vectorp url-recreate-url url-generic-parse-url 0 3 user-real-login-name "file" delq nil split-string "localhost" "\\." 5 expand-file-name mapconcat identity "/" fname url-cache-directory] 8 (#$ . 3569)])
#@52 *What function to use to create a cached filename.
(custom-declare-variable 'url-cache-creation-function ''url-cache-create-filename-using-md5 '(#$ . -4185) :type '(choice (const :tag "MD5 of filename (low collision rate)" :value url-cache-create-filename-using-md5) (const :tag "Human readable filenames (higher collision rate)" :value url-cache-create-filename-human-readable) (function :tag "Other")) :group 'url-cache)
(defalias 'url-cache-create-filename #[(url) "	!\207" [url-cache-creation-function url] 2])
#@40 Extract FNAM from the local disk cache
(defalias 'url-cache-extract #[(fnam) "\301 \210\302!\207" [fnam erase-buffer insert-file-contents-literally] 2 (#$ . 4707)])
#@41 Return t iff a cached file has expired.
(defalias 'url-cache-expired #[(url mod) "\305!\203\n \202 \306!\211\307H\203 \310\311!!?\202R \n\312\230\203) \313\202R \n\314\235\203Q \f\315\232\2049 \f\204= \313\202R \f@\316 @V\206R \fA@\316 A@V\202R \317*\207" [url urlobj type url-standalone-mode mod vectorp url-generic-parse-url 0 file-exists-p url-cache-create-filename "http" t ("file" "ftp") (0 0) current-time nil] 4 (#$ . 4879)])
(provide 'url-cache)
