`RequestHandlerRegistry` to resolve 127.0.0.1 as primary host
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestHandlerRegistry.java b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestHandlerRegistry.java
index 6618806..581d87a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestHandlerRegistry.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestHandlerRegistry.java
@@ -51,6 +51,7 @@
 public class RequestHandlerRegistry<T> implements HttpRequestMapper<T> {
 
     private final static String LOCALHOST = "localhost";
+    private final static String IP_127_0_0_1 = "127.0.0.1";
 
     private final String canonicalHostName;
     private final Supplier<LookupRegistry<T>> registrySupplier;
@@ -91,10 +92,8 @@
     }
 
     private LookupRegistry<T> getPatternMatcher(final String hostname) {
-        if (hostname == null) {
-            return primary;
-        }
-        if (hostname.equals(canonicalHostName) || hostname.equals(LOCALHOST)) {
+        if (hostname == null ||
+                hostname.equals(canonicalHostName) || hostname.equals(LOCALHOST) || hostname.equals(IP_127_0_0_1)) {
             return primary;
         }
         return virtualMap.get(hostname);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestRequestHandlerRegistry.java b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestRequestHandlerRegistry.java
index 35e43ba..dbbfa71 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestRequestHandlerRegistry.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestRequestHandlerRegistry.java
@@ -82,6 +82,7 @@
         handlerRegistry.register("myhost", "/test*", "stuff");
         Assert.assertEquals("stuff", handlerRegistry.resolve(new BasicHttpRequest(Method.GET, new HttpHost("localhost"), "/test"), context));
         Assert.assertEquals("stuff", handlerRegistry.resolve(new BasicHttpRequest(Method.GET, new HttpHost("LocalHost"), "/testabc"), context));
+        Assert.assertEquals("stuff", handlerRegistry.resolve(new BasicHttpRequest(Method.GET, new HttpHost("127.0.0.1"), "/testabc"), context));
     }
 
     @Test(expected = MisdirectedRequestException.class)