This namespace is not part of the public API of urlocal and may change without notice.
This namespace is not part of the public API of urlocal and may change without notice.
(base64-encode x)
Returns a BASE64 encoded representation (a String) of the UTF-8 String representation of x, or nil if x is nil
Returns a BASE64 encoded representation (a String) of the UTF-8 String representation of x, or nil if x is nil
(cache-hit! url metadata-file metadata)
Handles a cache hit, by updating the :last-checked-at metadata.
Throws on IO errors.
Handles a cache hit, by updating the :last-checked-at metadata. Throws on IO errors.
(cache-key->cache-file cache-key)
(cache-key->cache-file cache-key extension)
Returns a File for the given cache-key (a String), optionally with the given extension. Return nil if cache-key is blank.
Returns a File for the given cache-key (a String), optionally with the given extension. Return nil if cache-key is blank.
(cache-miss! url opts)
(cache-miss! url
already-redirected?
{:keys [follow-redirects?] :or {follow-redirects? false} :as opts})
Handles a cache miss, by downloading the content for the given url and caching it locally, and also capturing metadata from the response for the purposes of cache management.
Throws on IO errors or unexpected HTTP status code responses.
Handles a cache miss, by downloading the content for the given url and caching it locally, and also capturing metadata from the response for the purposes of cache management. Throws on IO errors or unexpected HTTP status code responses.
(check-cache! url {:keys [request-headers] :as opts})
Handles a potential cache hit, by determining whether the cached content needs to be checked for staleness via an ETag request, or whether it can simply be served directly.
Throws on IO errors or unexpected HTTP status code responses.
Handles a potential cache hit, by determining whether the cached content needs to be checked for staleness via an ETag request, or whether it can simply be served directly. Throws on IO errors or unexpected HTTP status code responses.
(http-get url)
(http-get url
{:keys [connect-timeout read-timeout follow-redirects?
request-headers]
:or {connect-timeout 1000
read-timeout 1000
follow-redirects? false
request-headers {"User-Agent" "com.github.pmonks/urlocal"}}})
Perform an HTTP get request for the given URL, using the given options, returning an HTTPUrlConnection object.
Throws on IO errors.
Perform an HTTP get request for the given URL, using the given options, returning an HTTPUrlConnection object. Throws on IO errors.
(prep-cache! url opts)
Ensures the cache is populated for the given url.
Ensures the cache is populated for the given url.
(remove-cache-entry! url)
Removes the cache entry for a single URL, if it exists. Returns nil.
Throws on IO errors.
Removes the cache entry for a single URL, if it exists. Returns nil. Throws on IO errors.
(seconds-since inst)
Returns how many seconds have passed since inst (a Date or Temporal), or Long/MAX_VALUE if inst is nil.
Returns how many seconds have passed since inst (a Date or Temporal), or Long/MAX_VALUE if inst is nil.
(url->content-file url)
Returns a content file for the given url, or nil if the url is nil.
Returns a content file for the given url, or nil if the url is nil.
(url->metadata-file url)
Returns a metadata file for the given url, or nil if the url is nil.
Returns a metadata file for the given url, or nil if the url is nil.
(write-metadata! url conn)
Writes out a metadata file for the given url, using the open connection for that url.
Note: does nothing if the connection did not return an ETag - this ensures that future requests to the same URL will always be treated as a cache miss.
Writes out a metadata file for the given url, using the open connection for that url. Note: does nothing if the connection did not return an ETag - this ensures that future requests to the same URL will always be treated as a cache miss.
(write-metadata-file! f m)
Writes the metadata m to the file f, overwriting it if it already exists.
Writes the metadata m to the file f, overwriting it if it already exists.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close