Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some code comments #8361

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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