Repository: huaweicloud/sermant
Issue: 【fix】fix protocol of feign for spring-boot-registry

### What happened?

feign maybe not effect

### How can we reproduce it (as minimally and precisely as possible)?

N/A

### Anything else we need to know?

_No response_

### Sermant version

<details>
0.7.0
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```
</details>


Changed files:
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpAsyncClient4xInterceptor.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionResponseStreamInterceptor.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionConnectInterceptor.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/RestTemplateInterceptor.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/FeignInvokeInterceptor.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttpClientInterceptor.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/HttpConstants.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttp3ClientInterceptor.java

diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/FeignInvokeInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/FeignInvokeInterceptor.java
index e86e3bc3..66d23623 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/FeignInvokeInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/FeignInvokeInterceptor.java
@@ -48,14 +48,15 @@ public class FeignInvokeInterceptor extends MarkInterceptor {
         final InvokerService invokerService = PluginServiceManager.getPluginService(InvokerService.class);
         Request request = (Request) context.getArguments()[0];
         Map<String, String> urlInfo = RequestInterceptorUtils.recoverUrl(request.url());
-        if (!PlugEffectWhiteBlackUtils.isAllowRun(request.url(), urlInfo.get(HttpConstants.HTTP_URI_HOST))) {
+        if (!PlugEffectWhiteBlackUtils.isAllowRun(urlInfo.get(HttpConstants.HTTP_URI_HOST),
+                urlInfo.get(HttpConstants.HTTP_URI_SERVICE))) {
             return context;
         }
         RequestInterceptorUtils.printRequestLog("feign", urlInfo);
         Optional<Object> result = invokerService.invoke(
             buildInvokerFunc(context, request, urlInfo),
             ex -> ex,
-            urlInfo.get(HttpConstants.HTTP_URI_HOST));
+            urlInfo.get(HttpConstants.HTTP_URI_SERVICE));
         if (result.isPresent()) {
             Object obj = result.get();
             if (obj instanceof Exception) {
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttp3ClientInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttp3ClientInterceptor.java
index daca8098..dc1ae2da 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttp3ClientInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttp3ClientInterceptor.java
@@ -68,7 +68,7 @@ public class OkHttp3ClientInterceptor extends MarkInterceptor {
             return context;
         }
         Map<String, String> hostAndPath = RequestInterceptorUtils.recoverHostAndPath(uri.getPath());
-        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_HOST))) {
+        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_SERVICE))) {
             return context;
         }
         RequestInterceptorUtils.printRequestLog("OkHttp3", hostAndPath);
@@ -77,7 +77,7 @@ public class OkHttp3ClientInterceptor extends MarkInterceptor {
         invokerService.invoke(
                 buildInvokerFunc(uri, hostAndPath, request, rebuildRequest, context),
                 buildExFunc(rebuildRequest),
-                hostAndPath.get(HttpConstants.HTTP_URI_HOST))
+                hostAndPath.get(HttpConstants.HTTP_URI_SERVICE))
                 .ifPresent(o -> setResultOrThrow(context, o, uri.getPath()));
         return context;
     }
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttpClientInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttpClientInterceptor.java
index 6070583c..ebcee18e 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttpClientInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/OkHttpClientInterceptor.java
@@ -70,7 +70,7 @@ public class OkHttpClientInterceptor extends MarkInterceptor {
             return context;
         }
         Map<String, String> hostAndPath = RequestInterceptorUtils.recoverHostAndPath(uri.getPath());
-        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_HOST))) {
+        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_SERVICE))) {
             return context;
         }
         RequestInterceptorUtils.printRequestLog("OkHttp", hostAndPath);
@@ -79,7 +79,7 @@ public class OkHttpClientInterceptor extends MarkInterceptor {
         invokerService.invoke(
                 buildInvokerFunc(uri, hostAndPath, request, rebuildRequest, context),
                 buildExFunc(rebuildRequest),
-                hostAndPath.get(HttpConstants.HTTP_URI_HOST))
+                hostAndPath.get(HttpConstants.HTTP_URI_SERVICE))
                 .ifPresent(o -> setResultOrThrow(context, o, uri.getPath()));
         return context;
     }
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/RestTemplateInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/RestTemplateInterceptor.java
index 73dcf258..c64b0f6b 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/RestTemplateInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/RestTemplateInterceptor.java
@@ -54,14 +54,14 @@ public class RestTemplateInterceptor extends MarkInterceptor {
             return context;
         }
         Map<String, String> hostAndPath = RequestInterceptorUtils.recoverHostAndPath(uri.getPath());
-        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_HOST))) {
+        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_SERVICE))) {
             return context;
         }
         RequestInterceptorUtils.printRequestLog("restTemplate", hostAndPath);
         Optional<Object> result = invokerService.invoke(
             buildInvokerFunc(uri, hostAndPath, context, httpMethod),
             ex -> ex,
-            hostAndPath.get(HttpConstants.HTTP_URI_HOST));
+            hostAndPath.get(HttpConstants.HTTP_URI_SERVICE));
         if (result.isPresent()) {
             Object obj = result.get();
             if (obj instanceof Exception) {
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpAsyncClient4xInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpAsyncClient4xInterceptor.java
index d8d525dd..0a1752f1 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpAsyncClient4xInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpAsyncClient4xInterceptor.java
@@ -117,7 +117,7 @@ public class HttpAsyncClient4xInterceptor implements Interceptor {
             if (hostAndPath == null) {
                 return context;
             }
-            final String serviceName = hostAndPath.get(HttpConstants.HTTP_URI_HOST);
+            final String serviceName = hostAndPath.get(HttpConstants.HTTP_URI_SERVICE);
             cleanCallback();
             final InvokerService invokerService = PluginServiceManager.getPluginService(InvokerService.class);
             final HttpAsyncContext asyncContext = HttpAsyncUtils.getOrCreateContext();
@@ -139,7 +139,7 @@ public class HttpAsyncClient4xInterceptor implements Interceptor {
         if (originHostName == null || hostAndPath == null) {
             return false;
         }
-        return PlugEffectWhiteBlackUtils.isAllowRun(originHostName, hostAndPath.get(HttpConstants.HTTP_URI_HOST));
+        return PlugEffectWhiteBlackUtils.isAllowRun(originHostName, hostAndPath.get(HttpConstants.HTTP_URI_SERVICE));
     }
 
     private void acquireHostPath(HttpAsyncRequestProducer httpAsyncRequestProducer) throws Exception {
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
index ac970729..ce365260 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
@@ -75,14 +75,14 @@ public class HttpClient4xInterceptor extends MarkInterceptor {
         if (hostAndPath.isEmpty()) {
             return context;
         }
-        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_HOST))) {
+        if (!PlugEffectWhiteBlackUtils.isPlugEffect(hostAndPath.get(HttpConstants.HTTP_URI_SERVICE))) {
             return context;
         }
         RequestInterceptorUtils.printRequestLog("HttpClient", hostAndPath);
         invokerService.invoke(
                 buildInvokerFunc(hostAndPath, httpRequest, context),
                 buildExFunc(httpRequest, Thread.currentThread().getContextClassLoader()),
-                hostAndPath.get(HttpConstants.HTTP_URI_HOST))
+                hostAndPath.get(HttpConstants.HTTP_URI_SERVICE))
                 .ifPresent(result -> this.setResultOrThrow(context, result,
                         hostAndPath.get(HttpConstants.HTTP_URI_PATH)));
         return context;
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionConnectInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionConnectInterceptor.java
index a4faf8ec..a19f0834 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionConnectInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionConnectInterceptor.java
@@ -86,7 +86,7 @@ public class HttpUrlConnectionConnectInterceptor extends MarkInterceptor {
         }
         final String fullUrl = url.toString();
         Map<String, String> urlInfo = RequestInterceptorUtils.recoverUrl(url);
-        if (!PlugEffectWhiteBlackUtils.isPlugEffect(urlInfo.get(HttpConstants.HTTP_URI_HOST))) {
+        if (!PlugEffectWhiteBlackUtils.isPlugEffect(urlInfo.get(HttpConstants.HTTP_URI_SERVICE))) {
             return context;
         }
         HttpConnectionUtils.save(new HttpConnectionContext(urlInfo, url));
@@ -94,7 +94,7 @@ public class HttpUrlConnectionConnectInterceptor extends MarkInterceptor {
         invokerService.invoke(
             buildInvokerFunc(context, url, urlInfo),
             ex -> ex,
-            urlInfo.get(HttpConstants.HTTP_URI_HOST))
+            urlInfo.get(HttpConstants.HTTP_URI_SERVICE))
                 .ifPresent(obj -> {
                     if (obj instanceof Exception) {
                         LOGGER.log(Level.SEVERE, "request is error, uri is " + fullUrl, (Exception) obj);
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionResponseStreamInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionResponseStreamInterceptor.java
index 85e78dc7..2a629e81 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionResponseStreamInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpconnection/HttpUrlConnectionResponseStreamInterceptor.java
@@ -90,7 +90,7 @@ public class HttpUrlConnectionResponseStreamInterceptor implements Interceptor {
         Optional<Object> result = invokerService.invoke(
             invokerContextObjectFunction,
             ex -> ex,
-            urlInfo.get(HttpConstants.HTTP_URI_HOST));
+            urlInfo.get(HttpConstants.HTTP_URI_SERVICE));
         if (result.isPresent()) {
             Object obj = result.get();
             if (obj instanceof Exception) {
@@ -117,11 +117,15 @@ public class HttpUrlConnectionResponseStreamInterceptor implements Interceptor {
         if (ex instanceof SocketTimeoutException) {
             // 此处仅SocketTimeoutException: Read timed out进行重试
             final String message = ex.getMessage();
-            return "Read timed out".equalsIgnoreCase(message) && this.lbConfig.isEnableSocketReadTimeoutRetry();
+            return "Read timed out".equalsIgnoreCase(message) && isEnableRetry();
         }
         return false;
     }
 
+    private boolean isEnableRetry() {
+        return this.lbConfig.isEnableSocketReadTimeoutRetry() && this.lbConfig.getMaxRetry() > 0;
+    }
+
     private void resetStats(ExecuteContext context) {
         ReflectUtils.setFieldValue(context.getObject(), "rememberedException", null);
         ReflectUtils.setFieldValue(context.getObject(), "failedOnce", false);
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/HttpConstants.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/HttpConstants.java
index 25ddef6c..261d8a22 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/HttpConstants.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/HttpConstants.java
@@ -33,7 +33,12 @@ public class HttpConstants {
     public static final String HTTP_GET = "GET";
 
     /**
-     * 主机名
+     * 从url解析的服务名
+     */
+    public static final String HTTP_URI_SERVICE = "serviceName";
+
+    /**
+     * 域名
      */
     public static final String HTTP_URI_HOST = "host";
 
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
index 885d17c5..4b05f568 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
@@ -96,7 +96,7 @@ public class RequestInterceptorUtils {
         }
         final Map<String, String> result = new HashMap<>(URL_INFO_INIT_SIZE);
         result.put(HttpConstants.HTTP_URL_SCHEME, protocol);
-        result.put(HttpConstants.HTTP_URI_HOST, tokenizer.nextToken(delim));
+        result.put(HttpConstants.HTTP_URI_SERVICE, tokenizer.nextToken(delim));
         result.put(HttpConstants.HTTP_URI_PATH,
                 formatPath(tokenizer.nextToken(HttpConstants.EMPTY_STR), url.getQuery()));
         return result;
@@ -123,11 +123,11 @@ public class RequestInterceptorUtils {
         String scheme = rawScheme.substring(0, rawScheme.length() - 1);
 
         // domain 域名
-        urlTokens.nextToken(baseSlash);
+        Map<String, String> result = new HashMap<>(URL_INFO_INIT_SIZE);
+        result.put(HttpConstants.HTTP_URI_HOST, urlTokens.nextToken(baseSlash));
         final String serviceName = urlTokens.nextToken(baseSlash);
         final String path = urlTokens.nextToken(HttpConstants.EMPTY_STR);
-        Map<String, String> result = new HashMap<>(URL_INFO_INIT_SIZE);
-        result.put(HttpConstants.HTTP_URI_HOST, serviceName);
+        result.put(HttpConstants.HTTP_URI_SERVICE, serviceName);
         result.put(HttpConstants.HTTP_URL_SCHEME, scheme);
         result.put(HttpConstants.HTTP_URI_PATH, path);
         return result;
@@ -175,7 +175,7 @@ public class RequestInterceptorUtils {
         if (!RECORDER.isEnable()) {
             return;
         }
-        String path = String.format(Locale.ENGLISH, "/%s%s", hostAndPath.get(HttpConstants.HTTP_URI_HOST),
+        String path = String.format(Locale.ENGLISH, "/%s%s", hostAndPath.get(HttpConstants.HTTP_URI_SERVICE),
             hostAndPath.get(HttpConstants.HTTP_URI_PATH));
         LOGGER.log(Level.FINE, String.format(Locale.ENGLISH, "[%s] request [%s] has been intercepted!", source, path));
         RECORDER.beforeRequest();
@@ -284,7 +284,7 @@ public class RequestInterceptorUtils {
         if (tempPath.indexOf(HttpConstants.HTTP_URL_SINGLE_SLASH) <= 0) {
             return result;
         }
-        result.put(HttpConstants.HTTP_URI_HOST,
+        result.put(HttpConstants.HTTP_URI_SERVICE,
             tempPath.substring(0, tempPath.indexOf(HttpConstants.HTTP_URL_SINGLE_SLASH)));
         result.put(HttpConstants.HTTP_URI_PATH,
             tempPath.substring(tempPath.indexOf(HttpConstants.HTTP_URL_SINGLE_SLASH)));