Skip to content

Commit 87b5080

Browse files
committed
Consistent use of getLocalAddr() without DNS lookups in request adapters
Closes gh-28280
1 parent 5cbf85a commit 87b5080

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

+3-3
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.
@@ -195,7 +195,7 @@ public Principal getPrincipal() {
195195

196196
@Override
197197
public InetSocketAddress getLocalAddress() {
198-
return new InetSocketAddress(this.servletRequest.getLocalName(), this.servletRequest.getLocalPort());
198+
return new InetSocketAddress(this.servletRequest.getLocalAddr(), this.servletRequest.getLocalPort());
199199
}
200200

201201
@Override
@@ -216,7 +216,7 @@ public InputStream getBody() throws IOException {
216216
@Override
217217
public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse response) {
218218
if (this.asyncRequestControl == null) {
219-
if (!ServletServerHttpResponse.class.isInstance(response)) {
219+
if (!(response instanceof ServletServerHttpResponse)) {
220220
throw new IllegalArgumentException(
221221
"Response must be a ServletServerHttpResponse: " + response.getClass());
222222
}

0 commit comments

Comments
 (0)