CACHING AVAILABLE IN HTTP CLIENTS Because caching is always the problem. This document is to record if caching is typically done or supported by various HTTP clients other than web browsers. The only time where it seems you cannot use HTTP caching reliably is with terminal programs. == Terminal Supported: no. `curl`, `wget`, 'httpie', do not support HTTP1.1 caching behaviors. They should not be considered HTTP1.1 complaint clients though since their usage is far and wide, and apply to more than just HTTP. In many cases it doesn't make sense for these tools to cache. == Desktop Absolutely. Especially since everything is just Blink and Gecko now. == Mobile HTTP1.1 caching is supported by the major mobile vendors. There is no point covering WebViews of these because they are just embedded browsers. === Android Supported: yes. According to https://stackoverflow.com/questions/3505930/make-an-http-request-with-android OkHttp and Android's HttpUrlConnection are de-facto ways to create and use HTTP clients (probably the latter even more). Below is proof that they support caching mechanisms that follow Cache-Control headers. ==== HttpUrlConnection ---- Android 4.0 (Ice Cream Sandwich, API level 15) includes a response cache. See android.net.http.HttpResponseCache for instructions on enabling HTTP caching in your application. ---- https://developer.android.com/reference/java/net/HttpURLConnection.html#response-caching ---- The best way to improve the cache hit rate is by configuring the web server to return cacheable responses. Although this client honors all HTTP/1.1 (RFC 2068) cache headers, it doesn't cache partial responses. ---- https://developer.android.com/reference/android/net/http/HttpResponseCache ==== OkHttp .... fun cache(cache:Cache?):OkHttpClient.Builder Sets the response cache to be used to read and write cached responses. .... http://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/-builder/cache/ === iOS Supported: yes. ---- You use a URLSession instance to create one or more URLSessionTask instances, which can fetch and return data to your app, download files, or upload data and files to remote locations. To configure a session, you use a URLSessionConfiguration object, which controls behavior like how to use caches and cookies, or whether to allow connections on a cellular network. ---- https://developer.apple.com/documentation/foundation/url_loading_system ---- Ephemeral sessions are similar to default sessions, but they don’t write caches, cookies, or credentials to disk. You can create an ephemeral session configuration by calling the ephemeral method on the URLSessionConfiguration class. ---- https://developer.apple.com/documentation/foundation/urlsessionconfiguration So by default, *they do write to caches*. But does it do it by what the protocol (HTTP) says or no? The answer: yes. ---- The default policy is NSURLRequest.CachePolicy.useProtocolCachePolicy. [...] Use the caching logic defined in the protocol implementation, if any, for a particular URL load request. ---- https://developer.apple.com/documentation/foundation/nsurlrequest/cachepolicy