diff --git a/docs/https.md b/docs/https.md index 6cfc7b4f4..5cdd7889b 100644 --- a/docs/https.md +++ b/docs/https.md @@ -13,7 +13,7 @@ Specific security vs. connectivity decisions are implemented by [ConnectionSpec] * `RESTRICTED_TLS` is a secure configuration, intended to meet stricter compliance requirements. * `MODERN_TLS` is a secure configuration that connects to modern HTTPS servers. * `COMPATIBLE_TLS` is a secure configuration that connects to secure–but not current–HTTPS servers. - * `CLEARTEXT` is an insecure configuration that is used for `https://` URLs. + * `CLEARTEXT` is an insecure configuration that is used for `http://` URLs. These loosely follow the model set in [Google Cloud Policies](https://cloud.google.com/load-balancing/docs/ssl-policies-concepts). We [track changes](tls_configuration_history.md) to this policy. diff --git a/docs/interceptors.md b/docs/interceptors.md index e42661f89..944045ae5 100644 --- a/docs/interceptors.md +++ b/docs/interceptors.md @@ -85,13 +85,13 @@ response.body().close(); When we run this code, the interceptor runs twice. Once for the initial request to `http://www.publicobject.com/helloworld.txt`, and another for the redirect to `https://publicobject.com/helloworld.txt`. ``` -INFO: Sending request https://www.publicobject.com/helloworld.txt on Connection{www.publicobject.com:80, proxy=DIRECT hostAddress=54.187.32.157 cipherSuite=none protocol=http/1.1} +INFO: Sending request http://www.publicobject.com/helloworld.txt on Connection{www.publicobject.com:80, proxy=DIRECT hostAddress=54.187.32.157 cipherSuite=none protocol=http/1.1} User-Agent: OkHttp Example Host: www.publicobject.com Connection: Keep-Alive Accept-Encoding: gzip -INFO: Received response for https://www.publicobject.com/helloworld.txt in 115.6ms +INFO: Received response for http://www.publicobject.com/helloworld.txt in 115.6ms Server: nginx/1.4.6 (Ubuntu) Content-Type: text/html Content-Length: 193 diff --git a/docs/recipes.md b/docs/recipes.md index 1e920e8b0..e9c6e81de 100644 --- a/docs/recipes.md +++ b/docs/recipes.md @@ -61,7 +61,7 @@ Download a file on a worker thread, and get called back when the response is rea fun run() { val request = Request.Builder() - .url("https://publicobject.com/helloworld.txt") + .url("http://publicobject.com/helloworld.txt") .build() client.newCall(request).enqueue(object : Callback { @@ -89,7 +89,7 @@ Download a file on a worker thread, and get called back when the response is rea public void run() throws Exception { Request request = new Request.Builder() - .url("https://publicobject.com/helloworld.txt") + .url("http://publicobject.com/helloworld.txt") .build(); client.newCall(request).enqueue(new Callback() { @@ -115,7 +115,7 @@ Download a file on a worker thread, and get called back when the response is rea ### Accessing Headers ([.kt][AccessHeadersKotlin], [.java][AccessHeadersJava]) -Typically HTTP headers work like a `Map`: each field has one value or none. But some headers permit multiple values, like Guava's [Multimap](https://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multimap.html). For example, it's legal and common for an HTTP response to supply multiple `Vary` headers. OkHttp's APIs attempt to make both cases comfortable. +Typically HTTP headers work like a `Map`: each field has one value or none. But some headers permit multiple values, like Guava's [Multimap](https://guava.dev/releases/23.0/api/docs/com/google/common/collect/Multimap.html). For example, it's legal and common for an HTTP response to supply multiple `Vary` headers. OkHttp's APIs attempt to make both cases comfortable. When writing request headers, use `header(name, value)` to set the only occurrence of `name` to `value`. If there are existing values, they will be removed before the new value is added. Use `addHeader(name, value)` to add a header without removing the headers already present. @@ -570,7 +570,7 @@ Response caching uses HTTP headers for all configuration. You can add request he fun run() { val request = Request.Builder() - .url("https://publicobject.com/helloworld.txt") + .url("http://publicobject.com/helloworld.txt") .build() val response1Body = client.newCall(request).execute().use { @@ -609,7 +609,7 @@ Response caching uses HTTP headers for all configuration. You can add request he public void run() throws Exception { Request request = new Request.Builder() - .url("https://publicobject.com/helloworld.txt") + .url("http://publicobject.com/helloworld.txt") .build(); String response1Body; @@ -649,7 +649,7 @@ Use `Call.cancel()` to stop an ongoing call immediately. If a thread is currentl fun run() { val request = Request.Builder() - .url("https://httpbin.org/delay/2") // This URL is served with a 2 second delay. + .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay. .build() val startNanos = System.nanoTime() @@ -681,7 +681,7 @@ Use `Call.cancel()` to stop an ongoing call immediately. If a thread is currentl public void run() throws Exception { Request request = new Request.Builder() - .url("https://httpbin.org/delay/2") // This URL is served with a 2 second delay. + .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay. .build(); final long startNanos = System.nanoTime(); @@ -722,7 +722,7 @@ Use timeouts to fail a call when its peer is unreachable. Network partitions can fun run() { val request = Request.Builder() - .url("https://httpbin.org/delay/2") // This URL is served with a 2 second delay. + .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay. .build() client.newCall(request).execute().use { response -> @@ -744,7 +744,7 @@ Use timeouts to fail a call when its peer is unreachable. Network partitions can public void run() throws Exception { Request request = new Request.Builder() - .url("https://httpbin.org/delay/2") // This URL is served with a 2 second delay. + .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay. .build(); try (Response response = client.newCall(request).execute()) { @@ -763,7 +763,7 @@ All the HTTP client configuration lives in `OkHttpClient` including proxy settin fun run() { val request = Request.Builder() - .url("https://httpbin.org/delay/1") // This URL is served with a 1 second delay. + .url("http://httpbin.org/delay/1") // This URL is served with a 1 second delay. .build() // Copy to customize OkHttp for this request. @@ -797,7 +797,7 @@ All the HTTP client configuration lives in `OkHttpClient` including proxy settin public void run() throws Exception { Request request = new Request.Builder() - .url("https://httpbin.org/delay/1") // This URL is served with a 1 second delay. + .url("http://httpbin.org/delay/1") // This URL is served with a 1 second delay. .build(); // Copy to customize OkHttp for this request. @@ -850,7 +850,7 @@ Use `Response.challenges()` to get the schemes and realms of any authentication fun run() { val request = Request.Builder() - .url("https://publicobject.com/secrets/hellosecret.txt") + .url("http://publicobject.com/secrets/hellosecret.txt") .build() client.newCall(request).execute().use { response -> @@ -885,7 +885,7 @@ Use `Response.challenges()` to get the schemes and realms of any authentication public void run() throws Exception { Request request = new Request.Builder() - .url("https://publicobject.com/secrets/hellosecret.txt") + .url("http://publicobject.com/secrets/hellosecret.txt") .build(); try (Response response = client.newCall(request).execute()) {