Skip to content

Commit

Permalink
Consistent use of getLocalAddr() without DNS lookups in request adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller authored and Benjamin Reed committed Jul 26, 2022
1 parent a45c399 commit ffcb07f
Showing 1 changed file with 4 additions and 3 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
Expand Down Expand Up @@ -148,7 +148,7 @@ public Principal getPrincipal() {

@Override
public InetSocketAddress getLocalAddress() {
return new InetSocketAddress(this.servletRequest.getLocalName(), this.servletRequest.getLocalPort());
return new InetSocketAddress(this.servletRequest.getLocalAddr(), this.servletRequest.getLocalPort());
}

@Override
Expand All @@ -167,7 +167,8 @@ public InputStream getBody() throws IOException {
}

private boolean isFormPost(HttpServletRequest request) {
return (request.getContentType() != null && request.getContentType().contains(FORM_CONTENT_TYPE) &&
String contentType = request.getContentType();
return (contentType != null && contentType.contains(FORM_CONTENT_TYPE) &&
METHOD_POST.equalsIgnoreCase(request.getMethod()));
}

Expand Down

0 comments on commit ffcb07f

Please sign in to comment.