Browse Source

Consistent use of getLocalAddr() without DNS lookups in request adapters

Closes gh-28280
pull/28694/head
Juergen Hoeller 4 years ago
parent
commit
87b5080586
  1. 6
      spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -195,7 +195,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest { @@ -195,7 +195,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
@Override
public InetSocketAddress getLocalAddress() {
return new InetSocketAddress(this.servletRequest.getLocalName(), this.servletRequest.getLocalPort());
return new InetSocketAddress(this.servletRequest.getLocalAddr(), this.servletRequest.getLocalPort());
}
@Override
@ -216,7 +216,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest { @@ -216,7 +216,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
@Override
public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse response) {
if (this.asyncRequestControl == null) {
if (!ServletServerHttpResponse.class.isInstance(response)) {
if (!(response instanceof ServletServerHttpResponse)) {
throw new IllegalArgumentException(
"Response must be a ServletServerHttpResponse: " + response.getClass());
}

Loading…
Cancel
Save