diff --git a/MODULE.bazel b/MODULE.bazel index 81d80ed7e1a..342254f7ceb 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,6 @@ module( name = "grpc-java", - version = "1.80.0-SNAPSHOT", # CURRENT_GRPC_VERSION + version = "1.80.1-SNAPSHOT", # CURRENT_GRPC_VERSION compatibility_level = 0, repo_name = "io_grpc_grpc_java", ) diff --git a/README.md b/README.md index 47502009c3f..4448ccf17cc 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ For a guided tour, take a look at the [quick start guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC basics](https://grpc.io/docs/languages/java/basics). -The [examples](https://github.com/grpc/grpc-java/tree/v1.79.0/examples) and the -[Android example](https://github.com/grpc/grpc-java/tree/v1.79.0/examples/android) +The [examples](https://github.com/grpc/grpc-java/tree/v1.80.0/examples) and the +[Android example](https://github.com/grpc/grpc-java/tree/v1.80.0/examples/android) are standalone projects that showcase the usage of gRPC. Download @@ -56,34 +56,34 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`: io.grpc grpc-netty-shaded - 1.79.0 + 1.80.0 runtime io.grpc grpc-protobuf - 1.79.0 + 1.80.0 io.grpc grpc-stub - 1.79.0 + 1.80.0 ``` Or for Gradle with non-Android, add to your dependencies: ```gradle -runtimeOnly 'io.grpc:grpc-netty-shaded:1.79.0' -implementation 'io.grpc:grpc-protobuf:1.79.0' -implementation 'io.grpc:grpc-stub:1.79.0' +runtimeOnly 'io.grpc:grpc-netty-shaded:1.80.0' +implementation 'io.grpc:grpc-protobuf:1.80.0' +implementation 'io.grpc:grpc-stub:1.80.0' ``` For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and `grpc-protobuf-lite` instead of `grpc-protobuf`: ```gradle -implementation 'io.grpc:grpc-okhttp:1.79.0' -implementation 'io.grpc:grpc-protobuf-lite:1.79.0' -implementation 'io.grpc:grpc-stub:1.79.0' +implementation 'io.grpc:grpc-okhttp:1.80.0' +implementation 'io.grpc:grpc-protobuf-lite:1.80.0' +implementation 'io.grpc:grpc-stub:1.80.0' ``` For [Bazel](https://bazel.build), you can either @@ -91,7 +91,7 @@ For [Bazel](https://bazel.build), you can either (with the GAVs from above), or use `@io_grpc_grpc_java//api` et al (see below). [the JARs]: -https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.79.0 +https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.80.0 Development snapshots are available in [Sonatypes's snapshot repository](https://central.sonatype.com/repository/maven-snapshots/). @@ -123,7 +123,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use com.google.protobuf:protoc:3.25.8:exe:${os.detected.classifier} grpc-java - io.grpc:protoc-gen-grpc-java:1.79.0:exe:${os.detected.classifier} + io.grpc:protoc-gen-grpc-java:1.80.0:exe:${os.detected.classifier} @@ -153,7 +153,7 @@ protobuf { } plugins { grpc { - artifact = 'io.grpc:protoc-gen-grpc-java:1.79.0' + artifact = 'io.grpc:protoc-gen-grpc-java:1.80.0' } } generateProtoTasks { @@ -186,7 +186,7 @@ protobuf { } plugins { grpc { - artifact = 'io.grpc:protoc-gen-grpc-java:1.79.0' + artifact = 'io.grpc:protoc-gen-grpc-java:1.80.0' } } generateProtoTasks { diff --git a/build.gradle b/build.gradle index 10a5c5cbbc2..0221580874b 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ subprojects { apply plugin: "net.ltgt.errorprone" group = "io.grpc" - version = "1.80.0-SNAPSHOT" // CURRENT_GRPC_VERSION + version = "1.80.1-SNAPSHOT" // CURRENT_GRPC_VERSION repositories { maven { // The google mirror is less flaky than mavenCentral() diff --git a/buildscripts/kokoro/android.sh b/buildscripts/kokoro/android.sh index 5af55b2f551..677825ae66b 100755 --- a/buildscripts/kokoro/android.sh +++ b/buildscripts/kokoro/android.sh @@ -132,15 +132,18 @@ fi # Update the statuses with the deltas +set +x gsutil cp gs://grpc-testing-secrets/github_credentials/oauth_token.txt ~/ desc="New DEX reference count: $(printf "%'d" "$new_dex_count") (delta: $(printf "%'d" "$dex_count_delta"))" +echo "Setting status: $desc" curl -f -s -X POST -H "Content-Type: application/json" \ -H "Authorization: token $(cat ~/oauth_token.txt | tr -d '\n')" \ -d '{"state": "success", "context": "android/dex_diff", "description": "'"${desc}"'"}' \ "https://api.github.com/repos/grpc/grpc-java/statuses/${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" desc="New APK size in bytes: $(printf "%'d" "$new_apk_size") (delta: $(printf "%'d" "$apk_size_delta"))" +echo "Setting status: $desc" curl -f -s -X POST -H "Content-Type: application/json" \ -H "Authorization: token $(cat ~/oauth_token.txt | tr -d '\n')" \ -d '{"state": "success", "context": "android/apk_diff", "description": "'"${desc}"'"}' \ diff --git a/compiler/src/test/golden/TestDeprecatedService.java.txt b/compiler/src/test/golden/TestDeprecatedService.java.txt index ed2eab9a696..59be53e7d6d 100644 --- a/compiler/src/test/golden/TestDeprecatedService.java.txt +++ b/compiler/src/test/golden/TestDeprecatedService.java.txt @@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.80.0-SNAPSHOT)", + value = "by gRPC proto compiler (version 1.80.1-SNAPSHOT)", comments = "Source: grpc/testing/compiler/test.proto") @io.grpc.stub.annotations.GrpcGenerated @java.lang.Deprecated diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt index 2afdfdbf206..8115c13d5b0 100644 --- a/compiler/src/test/golden/TestService.java.txt +++ b/compiler/src/test/golden/TestService.java.txt @@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.80.0-SNAPSHOT)", + value = "by gRPC proto compiler (version 1.80.1-SNAPSHOT)", comments = "Source: grpc/testing/compiler/test.proto") @io.grpc.stub.annotations.GrpcGenerated public final class TestServiceGrpc { diff --git a/core/src/main/java/io/grpc/internal/GrpcUtil.java b/core/src/main/java/io/grpc/internal/GrpcUtil.java index c3ff3628465..86cf8cefa52 100644 --- a/core/src/main/java/io/grpc/internal/GrpcUtil.java +++ b/core/src/main/java/io/grpc/internal/GrpcUtil.java @@ -219,7 +219,7 @@ public byte[] parseAsciiString(byte[] serialized) { public static final Splitter ACCEPT_ENCODING_SPLITTER = Splitter.on(',').trimResults(); - public static final String IMPLEMENTATION_VERSION = "1.80.0-SNAPSHOT"; // CURRENT_GRPC_VERSION + public static final String IMPLEMENTATION_VERSION = "1.80.1-SNAPSHOT"; // CURRENT_GRPC_VERSION /** * The default timeout in nanos for a keepalive ping request. diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 489cf3e3f5c..129daee2891 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -1,4 +1,4 @@ -bazel_dep(name = "grpc-java", version = "1.80.0-SNAPSHOT", repo_name = "io_grpc_grpc_java") # CURRENT_GRPC_VERSION +bazel_dep(name = "grpc-java", version = "1.80.1-SNAPSHOT", repo_name = "io_grpc_grpc_java") # CURRENT_GRPC_VERSION bazel_dep(name = "rules_java", version = "9.3.0") bazel_dep(name = "grpc-proto", version = "0.0.0-20240627-ec30f58", repo_name = "io_grpc_grpc_proto") bazel_dep(name = "protobuf", version = "33.1", repo_name = "com_google_protobuf") diff --git a/examples/android/clientcache/app/build.gradle b/examples/android/clientcache/app/build.gradle index 2870850562d..c149433dbb2 100644 --- a/examples/android/clientcache/app/build.gradle +++ b/examples/android/clientcache/app/build.gradle @@ -34,7 +34,7 @@ android { protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.25.1' } plugins { - grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } } generateProtoTasks { @@ -54,11 +54,11 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' // You need to build grpc-java to obtain these libraries below. - implementation 'io.grpc:grpc-okhttp:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-protobuf-lite:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-stub:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-okhttp:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-protobuf-lite:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-stub:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION testImplementation 'junit:junit:4.13.2' testImplementation 'com.google.truth:truth:1.4.5' - testImplementation 'io.grpc:grpc-testing:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + testImplementation 'io.grpc:grpc-testing:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } diff --git a/examples/android/helloworld/app/build.gradle b/examples/android/helloworld/app/build.gradle index afc2a97e92f..a9d15f71164 100644 --- a/examples/android/helloworld/app/build.gradle +++ b/examples/android/helloworld/app/build.gradle @@ -32,7 +32,7 @@ android { protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.25.1' } plugins { - grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } } generateProtoTasks { @@ -52,7 +52,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' // You need to build grpc-java to obtain these libraries below. - implementation 'io.grpc:grpc-okhttp:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-protobuf-lite:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-stub:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-okhttp:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-protobuf-lite:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-stub:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } diff --git a/examples/android/routeguide/app/build.gradle b/examples/android/routeguide/app/build.gradle index c6fb344e82e..41bb7ffe8b5 100644 --- a/examples/android/routeguide/app/build.gradle +++ b/examples/android/routeguide/app/build.gradle @@ -32,7 +32,7 @@ android { protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.25.1' } plugins { - grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } } generateProtoTasks { @@ -52,7 +52,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' // You need to build grpc-java to obtain these libraries below. - implementation 'io.grpc:grpc-okhttp:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-protobuf-lite:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-stub:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-okhttp:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-protobuf-lite:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-stub:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } diff --git a/examples/android/strictmode/app/build.gradle b/examples/android/strictmode/app/build.gradle index fad9bfb58fb..f67ba6d4fcd 100644 --- a/examples/android/strictmode/app/build.gradle +++ b/examples/android/strictmode/app/build.gradle @@ -33,7 +33,7 @@ android { protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.25.1' } plugins { - grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } } generateProtoTasks { @@ -53,7 +53,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' // You need to build grpc-java to obtain these libraries below. - implementation 'io.grpc:grpc-okhttp:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-protobuf-lite:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-stub:1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-okhttp:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-protobuf-lite:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-stub:1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION } diff --git a/examples/build.gradle b/examples/build.gradle index cfaea82333a..9169f7aeb43 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protobufVersion = '3.25.8' def protocVersion = protobufVersion diff --git a/examples/example-alts/build.gradle b/examples/example-alts/build.gradle index 939b6ff73e4..cf40106d660 100644 --- a/examples/example-alts/build.gradle +++ b/examples/example-alts/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' dependencies { diff --git a/examples/example-debug/build.gradle b/examples/example-debug/build.gradle index bb7c85cb2be..9377da8a313 100644 --- a/examples/example-debug/build.gradle +++ b/examples/example-debug/build.gradle @@ -23,7 +23,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protobufVersion = '3.25.8' dependencies { diff --git a/examples/example-debug/pom.xml b/examples/example-debug/pom.xml index cef96ad17fe..b645f19f04e 100644 --- a/examples/example-debug/pom.xml +++ b/examples/example-debug/pom.xml @@ -6,13 +6,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT example-debug https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 1.8 diff --git a/examples/example-dualstack/build.gradle b/examples/example-dualstack/build.gradle index 0b5e165f692..ece6bb6328b 100644 --- a/examples/example-dualstack/build.gradle +++ b/examples/example-dualstack/build.gradle @@ -23,7 +23,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protobufVersion = '3.25.8' dependencies { diff --git a/examples/example-dualstack/pom.xml b/examples/example-dualstack/pom.xml index 96be352c45f..e027cfd2766 100644 --- a/examples/example-dualstack/pom.xml +++ b/examples/example-dualstack/pom.xml @@ -6,13 +6,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT example-dualstack https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 1.8 diff --git a/examples/example-gauth/build.gradle b/examples/example-gauth/build.gradle index 48294d0a5b3..948c1c4f455 100644 --- a/examples/example-gauth/build.gradle +++ b/examples/example-gauth/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protobufVersion = '3.25.8' def protocVersion = protobufVersion diff --git a/examples/example-gauth/pom.xml b/examples/example-gauth/pom.xml index 9c520141027..508ffc7ecf4 100644 --- a/examples/example-gauth/pom.xml +++ b/examples/example-gauth/pom.xml @@ -6,13 +6,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT example-gauth https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 1.8 diff --git a/examples/example-gcp-csm-observability/build.gradle b/examples/example-gcp-csm-observability/build.gradle index 6d20464e567..7fd10e592e2 100644 --- a/examples/example-gcp-csm-observability/build.gradle +++ b/examples/example-gcp-csm-observability/build.gradle @@ -22,7 +22,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' def openTelemetryVersion = '1.56.0' def openTelemetryPrometheusVersion = '1.56.0-alpha' diff --git a/examples/example-gcp-observability/build.gradle b/examples/example-gcp-observability/build.gradle index c64eed714c9..fb4b5dae14f 100644 --- a/examples/example-gcp-observability/build.gradle +++ b/examples/example-gcp-observability/build.gradle @@ -22,7 +22,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' dependencies { diff --git a/examples/example-hostname/build.gradle b/examples/example-hostname/build.gradle index 0facab784d3..013d59141c6 100644 --- a/examples/example-hostname/build.gradle +++ b/examples/example-hostname/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protobufVersion = '3.25.8' dependencies { diff --git a/examples/example-hostname/pom.xml b/examples/example-hostname/pom.xml index c21e85d1333..b4fdff79770 100644 --- a/examples/example-hostname/pom.xml +++ b/examples/example-hostname/pom.xml @@ -6,13 +6,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT example-hostname https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 1.8 diff --git a/examples/example-jwt-auth/build.gradle b/examples/example-jwt-auth/build.gradle index 224d822f2e3..713fa5c6203 100644 --- a/examples/example-jwt-auth/build.gradle +++ b/examples/example-jwt-auth/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protobufVersion = '3.25.8' def protocVersion = protobufVersion diff --git a/examples/example-jwt-auth/pom.xml b/examples/example-jwt-auth/pom.xml index 6208b1251f0..fde026c45fa 100644 --- a/examples/example-jwt-auth/pom.xml +++ b/examples/example-jwt-auth/pom.xml @@ -7,13 +7,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT example-jwt-auth https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 3.25.8 diff --git a/examples/example-oauth/build.gradle b/examples/example-oauth/build.gradle index 63dd47fc61b..b8d2d29a0ba 100644 --- a/examples/example-oauth/build.gradle +++ b/examples/example-oauth/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protobufVersion = '3.25.8' def protocVersion = protobufVersion diff --git a/examples/example-oauth/pom.xml b/examples/example-oauth/pom.xml index cac1a949a85..8ceefdcb743 100644 --- a/examples/example-oauth/pom.xml +++ b/examples/example-oauth/pom.xml @@ -7,13 +7,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT example-oauth https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 3.25.8 diff --git a/examples/example-opentelemetry/build.gradle b/examples/example-opentelemetry/build.gradle index ab703b5acda..3d811f1248a 100644 --- a/examples/example-opentelemetry/build.gradle +++ b/examples/example-opentelemetry/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' def openTelemetryVersion = '1.56.0' def openTelemetryPrometheusVersion = '1.56.0-alpha' diff --git a/examples/example-orca/build.gradle b/examples/example-orca/build.gradle index 049158088ec..797308a9359 100644 --- a/examples/example-orca/build.gradle +++ b/examples/example-orca/build.gradle @@ -16,7 +16,7 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 } -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' dependencies { diff --git a/examples/example-reflection/build.gradle b/examples/example-reflection/build.gradle index c06f276c2a0..e4c7abbcab0 100644 --- a/examples/example-reflection/build.gradle +++ b/examples/example-reflection/build.gradle @@ -16,7 +16,7 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 } -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' dependencies { diff --git a/examples/example-servlet/build.gradle b/examples/example-servlet/build.gradle index a41e998a455..452ade5f6d4 100644 --- a/examples/example-servlet/build.gradle +++ b/examples/example-servlet/build.gradle @@ -15,7 +15,7 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 } -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' dependencies { diff --git a/examples/example-tls/build.gradle b/examples/example-tls/build.gradle index 8d410146570..2b0cf703b12 100644 --- a/examples/example-tls/build.gradle +++ b/examples/example-tls/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' dependencies { diff --git a/examples/example-tls/pom.xml b/examples/example-tls/pom.xml index 9dd823ad563..6602ba6822f 100644 --- a/examples/example-tls/pom.xml +++ b/examples/example-tls/pom.xml @@ -6,13 +6,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT example-tls https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 1.8 diff --git a/examples/example-xds/build.gradle b/examples/example-xds/build.gradle index f04cedc5a74..121c2cf356b 100644 --- a/examples/example-xds/build.gradle +++ b/examples/example-xds/build.gradle @@ -21,7 +21,7 @@ java { // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. -def grpcVersion = '1.80.0-SNAPSHOT' // CURRENT_GRPC_VERSION +def grpcVersion = '1.80.1-SNAPSHOT' // CURRENT_GRPC_VERSION def protocVersion = '3.25.8' dependencies { diff --git a/examples/pom.xml b/examples/pom.xml index 4deaaca54a4..b74139817f8 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -6,13 +6,13 @@ jar - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT examples https://github.com/grpc/grpc-java UTF-8 - 1.80.0-SNAPSHOT + 1.80.1-SNAPSHOT 3.25.8 3.25.8 diff --git a/xds/src/main/java/io/grpc/xds/RoutingUtils.java b/xds/src/main/java/io/grpc/xds/RoutingUtils.java index bff6756a9a4..2b60e90deda 100644 --- a/xds/src/main/java/io/grpc/xds/RoutingUtils.java +++ b/xds/src/main/java/io/grpc/xds/RoutingUtils.java @@ -92,24 +92,15 @@ static VirtualHost findVirtualHostForHostName(List virtualHosts, St * */ private static boolean matchHostName(String hostName, String pattern) { - checkArgument(hostName.length() != 0 && !hostName.startsWith("."), + checkArgument(hostName.length() != 0 && !hostName.startsWith(".") && !hostName.endsWith("."), "Invalid host name"); - checkArgument(pattern.length() != 0 && !pattern.startsWith("."), + checkArgument(pattern.length() != 0 && !pattern.startsWith(".") && !pattern.endsWith("."), "Invalid pattern/domain name"); hostName = hostName.toLowerCase(Locale.US); pattern = pattern.toLowerCase(Locale.US); // hostName and pattern are now in lower case -- domain names are case-insensitive. - // Strip trailing dot to normalize FQDN (e.g. "example.com.") to a relative form, - // as per RFC 1034 Section 3.1 the two are semantically equivalent. - if (hostName.endsWith(".")) { - hostName = hostName.substring(0, hostName.length() - 1); - } - if (pattern.endsWith(".")) { - pattern = pattern.substring(0, pattern.length() - 1); - } - if (!pattern.contains("*")) { // Not a wildcard pattern -- hostName and pattern must match exactly. return hostName.equals(pattern); diff --git a/xds/src/main/java/io/grpc/xds/XdsNameResolver.java b/xds/src/main/java/io/grpc/xds/XdsNameResolver.java index ec3e417e53a..196d51fb5a6 100644 --- a/xds/src/main/java/io/grpc/xds/XdsNameResolver.java +++ b/xds/src/main/java/io/grpc/xds/XdsNameResolver.java @@ -73,6 +73,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -340,6 +341,66 @@ private void updateResolutionResult(XdsConfig xdsConfig) { } } + /** + * Returns {@code true} iff {@code hostName} matches the domain name {@code pattern} with + * case-insensitive. + * + *

Wildcard pattern rules: + *

    + *
  1. A single asterisk (*) matches any domain.
  2. + *
  3. Asterisk (*) is only permitted in the left-most or the right-most part of the pattern, + * but not both.
  4. + *
+ */ + @VisibleForTesting + static boolean matchHostName(String hostName, String pattern) { + checkArgument(hostName.length() != 0 && !hostName.startsWith(".") && !hostName.endsWith("."), + "Invalid host name"); + checkArgument(pattern.length() != 0 && !pattern.startsWith(".") && !pattern.endsWith("."), + "Invalid pattern/domain name"); + + hostName = hostName.toLowerCase(Locale.US); + pattern = pattern.toLowerCase(Locale.US); + // hostName and pattern are now in lower case -- domain names are case-insensitive. + + if (!pattern.contains("*")) { + // Not a wildcard pattern -- hostName and pattern must match exactly. + return hostName.equals(pattern); + } + // Wildcard pattern + + if (pattern.length() == 1) { + return true; + } + + int index = pattern.indexOf('*'); + + // At most one asterisk (*) is allowed. + if (pattern.indexOf('*', index + 1) != -1) { + return false; + } + + // Asterisk can only match prefix or suffix. + if (index != 0 && index != pattern.length() - 1) { + return false; + } + + // HostName must be at least as long as the pattern because asterisk has to + // match one or more characters. + if (hostName.length() < pattern.length()) { + return false; + } + + if (index == 0 && hostName.endsWith(pattern.substring(1))) { + // Prefix matching fails. + return true; + } + + // Pattern matches hostname if suffix matching succeeds. + return index == pattern.length() - 1 + && hostName.startsWith(pattern.substring(0, pattern.length() - 1)); + } + private final class ConfigSelector extends InternalConfigSelector { @Override public Result selectConfig(PickSubchannelArgs args) { diff --git a/xds/src/test/java/io/grpc/xds/RoutingUtilsTest.java b/xds/src/test/java/io/grpc/xds/RoutingUtilsTest.java index e9fde9f4c4a..a460501e85b 100644 --- a/xds/src/test/java/io/grpc/xds/RoutingUtilsTest.java +++ b/xds/src/test/java/io/grpc/xds/RoutingUtilsTest.java @@ -17,7 +17,6 @@ package io.grpc.xds; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertThrows; import static org.mockito.Mockito.mock; import com.google.common.collect.ImmutableMap; @@ -89,170 +88,6 @@ public void findVirtualHostForHostName_asteriskMatchAnyDomain() { .isEqualTo(vHost1); } - @Test - public void findVirtualHostForHostName_trailingDot() { - // FQDN (trailing dot) is semantically equivalent to the relative form - // per RFC 1034 Section 3.1. - List routes = Collections.emptyList(); - VirtualHost vHost1 = VirtualHost.create("virtualhost01.googleapis.com", - Collections.singletonList("a.googleapis.com"), routes, - ImmutableMap.of()); - VirtualHost vHost2 = VirtualHost.create("virtualhost02.googleapis.com", - Collections.singletonList("*.googleapis.com"), routes, - ImmutableMap.of()); - VirtualHost vHost3 = VirtualHost.create("virtualhost03.googleapis.com", - Collections.singletonList("*"), routes, - ImmutableMap.of()); - List virtualHosts = Arrays.asList(vHost1, vHost2, vHost3); - - // Trailing dot in hostName, exact match. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "a.googleapis.com.")).isEqualTo(vHost1); - // Trailing dot in hostName, wildcard match. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "b.googleapis.com.")).isEqualTo(vHost2); - - // Trailing dot in domain pattern, exact match. - VirtualHost vHost4 = VirtualHost.create("virtualhost04.googleapis.com", - Collections.singletonList("a.googleapis.com."), routes, - ImmutableMap.of()); - List virtualHosts2 = - Arrays.asList(vHost4, vHost2, vHost3); - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts2, "a.googleapis.com")).isEqualTo(vHost4); - - // Trailing dot in both hostName and domain pattern. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts2, "a.googleapis.com.")).isEqualTo(vHost4); - - // Trailing dot in domain pattern, wildcard match. - VirtualHost vHost5 = VirtualHost.create("virtualhost05.googleapis.com", - Collections.singletonList("*.googleapis.com."), routes, - ImmutableMap.of()); - List virtualHosts3 = - Arrays.asList(vHost5, vHost3); - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts3, "b.googleapis.com")).isEqualTo(vHost5); - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts3, "b.googleapis.com.")).isEqualTo(vHost5); - } - - @Test - public void findVirtualHostForHostName_exactMatch() { - List routes = Collections.emptyList(); - VirtualHost vHostFoo = VirtualHost.create("vhost-foo", - Collections.singletonList("foo.googleapis.com"), routes, - ImmutableMap.of()); - VirtualHost vHostBar = VirtualHost.create("vhost-bar", - Collections.singletonList("bar.googleapis.com"), routes, - ImmutableMap.of()); - List virtualHosts = - Arrays.asList(vHostFoo, vHostBar); - - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "foo.googleapis.com")).isEqualTo(vHostFoo); - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "bar.googleapis.com")).isEqualTo(vHostBar); - // No match returns null. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "baz.googleapis.com")).isNull(); - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "foo.googleapis")).isNull(); - } - - @Test - public void findVirtualHostForHostName_invalidHostName() { - List routes = Collections.emptyList(); - VirtualHost vHost = VirtualHost.create("vhost", - Collections.singletonList("a.googleapis.com"), routes, - ImmutableMap.of()); - List virtualHosts = Collections.singletonList(vHost); - - // Empty hostName. - assertThrows(IllegalArgumentException.class, - () -> RoutingUtils.findVirtualHostForHostName( - virtualHosts, "")); - // HostName starting with dot. - assertThrows(IllegalArgumentException.class, - () -> RoutingUtils.findVirtualHostForHostName( - virtualHosts, ".a.googleapis.com")); - } - - @Test - public void findVirtualHostForHostName_invalidPattern() { - List routes = Collections.emptyList(); - // Empty domain pattern. - VirtualHost vHostEmpty = VirtualHost.create("vhost-empty", - Collections.singletonList(""), routes, - ImmutableMap.of()); - assertThrows(IllegalArgumentException.class, - () -> RoutingUtils.findVirtualHostForHostName( - Collections.singletonList(vHostEmpty), - "a.googleapis.com")); - // Domain pattern starting with dot. - VirtualHost vHostDot = VirtualHost.create("vhost-dot", - Collections.singletonList(".a.googleapis.com"), routes, - ImmutableMap.of()); - assertThrows(IllegalArgumentException.class, - () -> RoutingUtils.findVirtualHostForHostName( - Collections.singletonList(vHostDot), - "a.googleapis.com")); - } - - @Test - public void findVirtualHostForHostName_prefixWildcard() { - List routes = Collections.emptyList(); - VirtualHost vHostWild = VirtualHost.create("vhost-wild", - Collections.singletonList("*.foo.googleapis.com"), - routes, ImmutableMap.of()); - VirtualHost vHostOther = VirtualHost.create("vhost-other", - Collections.singletonList("other.googleapis.com"), - routes, ImmutableMap.of()); - List virtualHosts = - Arrays.asList(vHostWild, vHostOther); - - // Prefix wildcard matches. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "bar.foo.googleapis.com")) - .isEqualTo(vHostWild); - // Base domain without subdomain does not match *.foo.googleapis.com. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "foo.googleapis.com")).isNull(); - - // Longer prefix wildcard is preferred over shorter one. - VirtualHost vHostLong = VirtualHost.create("vhost-long", - Collections.singletonList("*.bar.foo.googleapis.com"), - routes, ImmutableMap.of()); - List virtualHosts2 = - Arrays.asList(vHostLong, vHostWild); - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts2, "baz.bar.foo.googleapis.com")) - .isEqualTo(vHostLong); - } - - @Test - public void findVirtualHostForHostName_postfixWildcard() { - List routes = Collections.emptyList(); - VirtualHost vHostWild = VirtualHost.create("vhost-wild", - Collections.singletonList("foo.*"), routes, - ImmutableMap.of()); - VirtualHost vHostOther = VirtualHost.create("vhost-other", - Collections.singletonList("bar.googleapis.com"), - routes, ImmutableMap.of()); - List virtualHosts = - Arrays.asList(vHostWild, vHostOther); - - // Postfix wildcard matches. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "foo.googleapis.com")) - .isEqualTo(vHostWild); - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "foo.com")).isEqualTo(vHostWild); - // Different prefix does not match foo.*. - assertThat(RoutingUtils.findVirtualHostForHostName( - virtualHosts, "bar.foo.googleapis.com")).isNull(); - } - @Test public void routeMatching_pathOnly() { Metadata headers = new Metadata(); diff --git a/xds/src/test/java/io/grpc/xds/XdsNameResolverTest.java b/xds/src/test/java/io/grpc/xds/XdsNameResolverTest.java index 3f50d92c2b5..45a96ee172f 100644 --- a/xds/src/test/java/io/grpc/xds/XdsNameResolverTest.java +++ b/xds/src/test/java/io/grpc/xds/XdsNameResolverTest.java @@ -2020,6 +2020,48 @@ public void generateServiceConfig_forPerMethodConfig() throws IOException { .isEqualTo(expectedServiceConfig); } + @Test + public void matchHostName_exactlyMatch() { + String pattern = "foo.googleapis.com"; + assertThat(XdsNameResolver.matchHostName("bar.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("fo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("oo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("foo.googleapis", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("foo.googleapis.com", pattern)).isTrue(); + } + + @Test + public void matchHostName_prefixWildcard() { + String pattern = "*.foo.googleapis.com"; + assertThat(XdsNameResolver.matchHostName("foo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("bar-baz.foo.googleapis", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("bar.foo.googleapis.com", pattern)).isTrue(); + pattern = "*-bar.foo.googleapis.com"; + assertThat(XdsNameResolver.matchHostName("bar.foo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("baz-bar.foo.googleapis", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("-bar.foo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("baz-bar.foo.googleapis.com", pattern)) + .isTrue(); + } + + @Test + public void matchHostName_postfixWildCard() { + String pattern = "foo.*"; + assertThat(XdsNameResolver.matchHostName("bar.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("bar.foo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("foo.googleapis.com", pattern)).isTrue(); + assertThat(XdsNameResolver.matchHostName("foo.com", pattern)).isTrue(); + pattern = "foo-*"; + assertThat(XdsNameResolver.matchHostName("bar-.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("foo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("foo.googleapis.com", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("foo-", pattern)).isFalse(); + assertThat(XdsNameResolver.matchHostName("foo-bar.com", pattern)).isTrue(); + assertThat(XdsNameResolver.matchHostName("foo-.com", pattern)).isTrue(); + assertThat(XdsNameResolver.matchHostName("foo-bar", pattern)).isTrue(); + } + @Test public void resolved_faultAbortInLdsUpdate() { resolver.start(mockListener);