public class StripPortsFromHostInterceptor
extends java.lang.Object
implements org.apache.hc.core5.http.HttpRequestInterceptor
A HTTP request interceptor that strips the default ports :80 and :443 from
the request's Host header unless the host has been explicitly
specified by the user.
This interceptor should be put at the end of the request interceptor list.
It modifies the Host header set by the RequestTargetHost
interceptor, which always adds a port to the host even if it is a default
one. According to the HTTP specification, default ports can be omitted.
Other HTTP clients such as curl, wget, or web browsers do not include the
port, so we should not do that either. For more information, see
https://github.com/michel-kraemer/gradle-download-task/issues/241.
| Constructor and Description |
|---|
StripPortsFromHostInterceptor(java.util.Map<java.lang.String,java.lang.String> headers)
Create a new interceptor
|
| Modifier and Type | Method and Description |
|---|---|
void |
process(org.apache.hc.core5.http.HttpRequest request,
org.apache.hc.core5.http.EntityDetails entity,
org.apache.hc.core5.http.protocol.HttpContext context) |