CachedCurlNetwork

libcurl-based implementation of Network which caches responses. Allows quickly re-running some deterministic process without redownloading all URLs.

Constructors

this
this()
Undocumented in source.

Members

Classes

CachedCurlException
class CachedCurlException

Exception thrown for failed requests (server errors).

Functions

cachedReq
Response cachedReq(Request request)
Response cachedReq(string url, HTTP.Method method, const(ubyte)[] data)

Perform a raw request and return information about the resulting cached response.

downloadFile
string downloadFile(string url)
Undocumented in source. Be warned that the author may not have intended to support it.
downloadFile
void downloadFile(string url, string target)
Undocumented in source. Be warned that the author may not have intended to support it.
getFile
ubyte[] getFile(string url)
Undocumented in source. Be warned that the author may not have intended to support it.
httpRequest
HttpResponse httpRequest(HttpRequest request)
Undocumented in source. Be warned that the author may not have intended to support it.
post
ubyte[] post(string url, const(ubyte)[] data)
Undocumented in source. Be warned that the author may not have intended to support it.
resolveRedirect
string resolveRedirect(string url)
Undocumented in source. Be warned that the author may not have intended to support it.
urlOK
bool urlOK(string url)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

_req
void _req(CachedCurlNetwork instance, Request request, string target, string metadataPath)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

Metadata
struct Metadata

Response metadata.

Request
struct Request
Undocumented in source.
Response
struct Response
Undocumented in source.

Variables

cacheDir
string cacheDir;

Directory for caching responses

cookieDir
string cookieDir;
cookieExt
string cookieExt;

Directory for reading cookies. May be moved to a lambda in the future. Format is one file per host, with hostname ~ cookieExt being the file name. Contents is one line for the entire HTTP "Cookie" header.

epoch
StdTime epoch;

Ignore cache entries older than the given time

http
HTTP http;

Curl HTTP object Can be customized after construction.

Inherited Members

From Network

downloadFile
void downloadFile(string url, string target)

Download file located at the indicated URL, unless the target file already exists.

getFile
ubyte[] getFile(string url)

Get resource located at the indicated URL.

post
ubyte[] post(string url, const(ubyte)[] data)

Post data to the specified URL.

urlOK
bool urlOK(string url)

Check if the resource exists and is downloadable. E.g. the HTTP status code for a HEAD request should be 200.

resolveRedirect
string resolveRedirect(string url)

Get the destination of an HTTP redirect.

httpRequest
HttpResponse httpRequest(HttpRequest request)

Perform a HTTP request.

Meta