This allows us and our users to parse out the charset of
a content type, so we can cleanly create Readers and Strings
for content of any type.
This is similar to Guava's MediaType but with many differences.
* Guava's MediaType parses all parameters independently. We don't.
We may later want to support this lazily for users like MimeCraft.
* Guava uses a custom Tokenizer; we use regular expressions.
* Guava includes a registry of common media types; we don't.
* Guava supports media queries and building media types; we don't.
Applications that need advanced features should probably use
Guava's MediaType class. My goal here was to get everything we
need in a small amount of code.
This is very experimental right now but it sets us up
for a full asynchronous API. The current implementation
builds an async API over our existing synchronous API.
Future refactorings to the internals should promote the
async API throughout the codebase, particularly in SPDY.
That way we can have more requests in flight than threads
processing those requests.
Provide a public but internal API for setting this to different values. For example, the Android OS will need to call this method with 'X-Android' as a value.
Previously HTTPS connection reuse was broken because the
hostname verifier is included as a route identifier, and
with a different hostname verifier on every request we weren't
reusing connections.
This is needed to implement public android APIs
android.net.HttpResponseCache.{flush,size,maxSize,close}
as well android.net.HttpResponseCache.install.
install needs to inspect the underlying DiskLruCache because
it promises not to install a new cache if the file directory and
size are the same as the old cache.
The list is specified via a magic request property
"X-Android-Transports" and can be queried via the request
property "X-Android-Selected-Transport".
System wide defaults / switches don't need any changes
to okhttp. They can be set as options on the OkHttpClient
used by the platform UrlStreamHandlers.
AOSP moved OpenSSLSocketImpl to com.android.org.conscrypt.* so add that
as the first choice for unbundled apps.
Change-Id: I7bad6533dcb86ee1cac3b15f42dd386bd651eaed
Certain Motorola RAZRs always throw a SocketException when
you call that method. We don't _really_ need a perfect MTU,
so for those devices just return the default MTU.