summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorGao Weitao <victor.gao@huawei.com>2018-04-09 08:20:02 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-09 08:20:02 +0000
commitcf6ac5d460265f3d382474e1987ce116f2590114 (patch)
treed30226524442b55812c1298b6b041d5e83edb572 /service
parent0630017de6056f6f022c46d59eb251788e7e02e6 (diff)
parent0aeca01251f83ebf7d69eeff26059da9fa39c4bf (diff)
Merge "Fix vulnerable issue in vim proxy"
Diffstat (limited to 'service')
-rw-r--r--service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java9
-rw-r--r--service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java8
2 files changed, 13 insertions, 4 deletions
diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java
index 89a5dd6..100f799 100644
--- a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java
+++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java
@@ -19,6 +19,7 @@ package org.onap.vfc.nfvo.multivimproxy.common.util.restclient;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.net.Inet4Address;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -37,7 +38,7 @@ import org.slf4j.LoggerFactory;
* <br/>
* <p>
* </p>
- *
+ *
* @author
* @version Aug 9, 2016
*/
@@ -49,7 +50,7 @@ public abstract class HttpBaseRest implements Restful {
protected HttpClient client = null;
- private static final String LOCAL_HOST = "127.0.0.1";
+ private static final String LOCAL_HOST = Inet4Address.getLoopbackAddress().getHostAddress();
static final String HTTP_PATCH = "PATCH";
@@ -65,7 +66,7 @@ public abstract class HttpBaseRest implements Restful {
* Constructor<br/>
* <p>
* </p>
- *
+ *
* @since
*/
public HttpBaseRest() {
@@ -135,7 +136,7 @@ public abstract class HttpBaseRest implements Restful {
/**
* <br/>
- *
+ *
* @param method
* @param servicePath
* @param restParametes
diff --git a/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java b/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java
index 2f9c00d..15b908b 100644
--- a/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java
+++ b/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java
@@ -19,6 +19,8 @@ package org.onap.vfc.nfvo.multivimproxy.common.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.net.Inet4Address;
+
import org.junit.Test;
import org.onap.vfc.nfvo.multivimproxy.common.util.restclient.RestfulOptions;
import org.onap.vfc.nfvo.multivimproxy.common.util.restclient.RestfulParametes;
@@ -52,6 +54,12 @@ public class RestfulUtilTest {
};
}
+
+ @Test
+ public void findLocalAddress() {
+ assertEquals("127.0.0.1", Inet4Address.getLoopbackAddress().getHostAddress());
+ }
+
private void mockGetResponseContentReturnNull() {
new MockUp<RestfulUtil>() {