Fixes #4808 - Review HttpClient Request header APIs.
Fixed test failures. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
cf9df70935
commit
a93b2c6084
|
@ -118,7 +118,7 @@ public class HttpResponse implements Response
|
|||
|
||||
public HttpFields getTrailers()
|
||||
{
|
||||
return trailers.asImmutable();
|
||||
return trailers == null ? null : trailers.asImmutable();
|
||||
}
|
||||
|
||||
public HttpResponse trailer(HttpField trailer)
|
||||
|
|
|
@ -538,8 +538,12 @@ public abstract class AbstractProxyServlet extends HttpServlet
|
|||
{
|
||||
proxyRequest.headers(headers -> headers.add(HttpHeader.X_FORWARDED_FOR, clientRequest.getRemoteAddr()));
|
||||
proxyRequest.headers(headers -> headers.add(HttpHeader.X_FORWARDED_PROTO, clientRequest.getScheme()));
|
||||
proxyRequest.headers(headers -> headers.add(HttpHeader.X_FORWARDED_HOST, clientRequest.getHeader(HttpHeader.HOST.asString())));
|
||||
proxyRequest.headers(headers -> headers.add(HttpHeader.X_FORWARDED_SERVER, clientRequest.getLocalName()));
|
||||
String hostHeader = clientRequest.getHeader(HttpHeader.HOST.asString());
|
||||
if (hostHeader != null)
|
||||
proxyRequest.headers(headers -> headers.add(HttpHeader.X_FORWARDED_HOST, hostHeader));
|
||||
String localName = clientRequest.getLocalName();
|
||||
if (localName != null)
|
||||
proxyRequest.headers(headers -> headers.add(HttpHeader.X_FORWARDED_SERVER, localName));
|
||||
}
|
||||
|
||||
protected void sendProxyRequest(HttpServletRequest clientRequest, HttpServletResponse proxyResponse, Request proxyRequest)
|
||||
|
|
Loading…
Reference in New Issue