Skip to content

Commit

Permalink
Improve some code comments (#8361)
Browse files Browse the repository at this point in the history
  • Loading branch information
swankjesse committed Apr 15, 2024
1 parent 06a0529 commit 6bc0862
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.RegisterExtension

/**
* Sanity test for checking which environment and IDE is picking up.
* Validates which environment is used by the IDE.
*/
class PlatformRuleTest {
@RegisterExtension @JvmField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package okhttp3.internal.connection
import okhttp3.Route

/**
* A blacklist of failed routes to avoid when creating a new connection to a target address. This is
* A denylist of failed routes to avoid when creating a new connection to a target address. This is
* used so that OkHttp can learn from its mistakes: if there was a failure attempting to connect to
* a specific IP address or proxy server, that failure is remembered and alternate routes are
* preferred.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,18 @@ object OkHostnameVerifier : HostnameVerifier {
): Boolean {
var hostname = hostname
var pattern = pattern
// Basic sanity checks
if (hostname.isNullOrEmpty() ||
hostname.startsWith(".") ||
hostname.endsWith("..")
) {
// Invalid domain name
// Invalid domain name.
return false
}
if (pattern.isNullOrEmpty() ||
pattern.startsWith(".") ||
pattern.endsWith("..")
) {
// Invalid pattern/domain name
// Invalid pattern.
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ class DiskLruCacheTest {
}
taskFaker.runNextTask()

// Sanity check that a rebuilt journal behaves normally.
// Check that a rebuilt journal behaves normally.
assertValue("a", "a", "a")
assertValue("b", "b", "b")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
public final class CheckHandshake {
/** Rejects otherwise-trusted certificates. */
private static final Interceptor CHECK_HANDSHAKE_INTERCEPTOR = new Interceptor() {
final Set<String> blacklist = Collections.singleton(
final Set<String> denylist = Collections.singleton(
"sha256/afwiKY3RxoMmLkuRW1l7QsPZTJPwDS2pdDROQjXw8ig=");

@Override public Response intercept(Chain chain) throws IOException {
for (Certificate certificate : chain.connection().handshake().peerCertificates()) {
String pin = CertificatePinner.pin(certificate);
if (blacklist.contains(pin)) {
throw new IOException("Blacklisted peer certificate: " + pin);
if (denylist.contains(pin)) {
throw new IOException("Denylisted peer certificate: " + pin);
}
}
return chain.proceed(chain.request());
Expand Down

0 comments on commit 6bc0862

Please sign in to comment.