private static final class Cache.Entry
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
code |
private Handshake |
handshake |
private java.lang.String |
message |
private Protocol |
protocol |
private static java.lang.String |
RECEIVED_MILLIS
Synthetic response header: the local time when the response was received.
|
private long |
receivedResponseMillis |
private java.lang.String |
requestMethod |
private Headers |
responseHeaders |
private static java.lang.String |
SENT_MILLIS
Synthetic response header: the local time when the request was sent.
|
private long |
sentRequestMillis |
private java.lang.String |
url |
private Headers |
varyHeaders |
Constructor and Description |
---|
Entry(Response response) |
Entry(okio.Source in)
Reads an entry from an input stream.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
isHttps() |
boolean |
matches(Request request,
Response response) |
private java.util.List<java.security.cert.Certificate> |
readCertificateList(okio.BufferedSource source) |
Response |
response(DiskLruCache.Snapshot snapshot) |
private void |
writeCertList(okio.BufferedSink sink,
java.util.List<java.security.cert.Certificate> certificates) |
void |
writeTo(DiskLruCache.Editor editor) |
private static final java.lang.String SENT_MILLIS
private static final java.lang.String RECEIVED_MILLIS
private final java.lang.String url
private final Headers varyHeaders
private final java.lang.String requestMethod
private final Protocol protocol
private final int code
private final java.lang.String message
private final Headers responseHeaders
@Nullable private final Handshake handshake
private final long sentRequestMillis
private final long receivedResponseMillis
Entry(okio.Source in) throws java.io.IOException
http://google.com/foo
GET
2
Accept-Language: fr-CA
Accept-Charset: UTF-8
HTTP/1.1 200 OK
3
Content-Type: image/png
Content-Length: 100
Cache-Control: max-age=600
A typical HTTPS file looks like this:
https://google.com/foo
GET
2
Accept-Language: fr-CA
Accept-Charset: UTF-8
HTTP/1.1 200 OK
3
Content-Type: image/png
Content-Length: 100
Cache-Control: max-age=600
AES_256_WITH_MD5
2
base64-encoded peerCertificate[0]
base64-encoded peerCertificate[1]
-1
TLSv1.2
The file is newline separated. The first two lines are the URL and the request method. Next
is the number of HTTP Vary request header lines, followed by those lines.
Next is the response status line, followed by the number of HTTP response header lines, followed by those lines.
HTTPS responses also contain SSL session information. This begins with a blank line, and then a line containing the cipher suite. Next is the length of the peer certificate chain. These certificates are base64-encoded and appear each on their own line. The next line contains the length of the local certificate chain. These certificates are also base64-encoded and appear each on their own line. A length of -1 is used to encode a null array. The last line is optional. If present, it contains the TLS version.
java.io.IOException
Entry(Response response)
public void writeTo(DiskLruCache.Editor editor) throws java.io.IOException
java.io.IOException
private boolean isHttps()
private java.util.List<java.security.cert.Certificate> readCertificateList(okio.BufferedSource source) throws java.io.IOException
java.io.IOException
private void writeCertList(okio.BufferedSink sink, java.util.List<java.security.cert.Certificate> certificates) throws java.io.IOException
java.io.IOException
public Response response(DiskLruCache.Snapshot snapshot)