File tree 3 files changed +6
-3
lines changed
clients/src/main/java/org/apache/kafka/common/requests
test/scala/unit/kafka/network
3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ public class RequestContext implements AuthorizableRequestContext {
41
41
public final KafkaPrincipal principal ;
42
42
public final ListenerName listenerName ;
43
43
public final SecurityProtocol securityProtocol ;
44
- public final ClientInformation clientInformation ;
44
+ // The client information can be updated if the request is ApiVersionRequest,
45
+ // so the client information will not be unknown for ApiVersionRequest.
46
+ public ClientInformation clientInformation ;
45
47
public final boolean fromPrivilegedListener ;
46
48
public final Optional <KafkaPrincipalSerde > principalSerde ;
47
49
Original file line number Diff line number Diff line change @@ -1145,6 +1145,7 @@ private[kafka] class Processor(
1145
1145
channel.channelMetadataRegistry.registerClientInformation(new ClientInformation (
1146
1146
apiVersionsRequest.data.clientSoftwareName,
1147
1147
apiVersionsRequest.data.clientSoftwareVersion))
1148
+ context.clientInformation = channel.channelMetadataRegistry.clientInformation
1148
1149
}
1149
1150
}
1150
1151
requestChannel.sendRequest(req)
Original file line number Diff line number Diff line change @@ -274,8 +274,8 @@ class SocketServerTest {
274
274
sendRequest(plainSocket, apiVersionRequestBytes(clientId, version))
275
275
var receivedReq = receiveRequest(server.dataPlaneRequestChannel)
276
276
277
- assertEquals(ClientInformation . UNKNOWN_NAME_OR_VERSION , receivedReq.context.clientInformation.softwareName)
278
- assertEquals(ClientInformation . UNKNOWN_NAME_OR_VERSION , receivedReq.context.clientInformation.softwareVersion)
277
+ assertEquals(expectedClientSoftwareName , receivedReq.context.clientInformation.softwareName)
278
+ assertEquals(expectedClientSoftwareVersion , receivedReq.context.clientInformation.softwareVersion)
279
279
280
280
server.dataPlaneRequestChannel.sendNoOpResponse(receivedReq)
281
281
You can’t perform that action at this time.
0 commit comments