Skip to content

Commit 8c1d359

Browse files
jhoellerBenjamin Reed
authored and
Benjamin Reed
committed
Consistent use of getLocalAddr() without DNS lookups in request adapters
Closes spring-projectsgh-28280
1 parent 5b68213 commit 8c1d359

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -181,7 +181,7 @@ public Principal getPrincipal() {
181181

182182
@Override
183183
public InetSocketAddress getLocalAddress() {
184-
return new InetSocketAddress(this.servletRequest.getLocalName(), this.servletRequest.getLocalPort());
184+
return new InetSocketAddress(this.servletRequest.getLocalAddr(), this.servletRequest.getLocalPort());
185185
}
186186

187187
@Override
@@ -202,7 +202,7 @@ public InputStream getBody() throws IOException {
202202
@Override
203203
public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse response) {
204204
if (this.asyncRequestControl == null) {
205-
if (!ServletServerHttpResponse.class.isInstance(response)) {
205+
if (!(response instanceof ServletServerHttpResponse)) {
206206
throw new IllegalArgumentException(
207207
"Response must be a ServletServerHttpResponse: " + response.getClass());
208208
}

0 commit comments

Comments
 (0)