commit: added ACCEPT_LOCAL_ADDRESSES property to set whether Unicorn accepts validation for privates ips or not

changeset:   1238:178fe2b10c9c
user:        Thomas Gambet <tgambet@w3.org>
date:        Mon Jun 14 11:13:23 2010 -0400
files:       WebContent/WEB-INF/conf/unicorn.properties.default src/org/w3c/unicorn/input/URIInputParameter.java
description:
added ACCEPT_LOCAL_ADDRESSES property to set whether Unicorn accepts validation for privates ips or not


diff -r bf4e13ea3f44 -r 178fe2b10c9c WebContent/WEB-INF/conf/unicorn.properties.default
--- a/WebContent/WEB-INF/conf/unicorn.properties.default	Mon Jun 14 10:54:29 2010 -0400
+++ b/WebContent/WEB-INF/conf/unicorn.properties.default	Mon Jun 14 11:13:23 2010 -0400
@@ -10,6 +10,7 @@
 SHOW_LANGUAGE_UNAVAILABLE_MESSAGE = true
 
 USE_HTML_COMPACTOR = false
+VALIDATE_LOCAL_ADDRESSES = false
 
 DOCUMENT_CONNECT_TIMEOUT = 5000
 OBSERVER_CONNECT_TIMEOUT = 5000
diff -r bf4e13ea3f44 -r 178fe2b10c9c src/org/w3c/unicorn/input/URIInputParameter.java
--- a/src/org/w3c/unicorn/input/URIInputParameter.java	Mon Jun 14 10:54:29 2010 -0400
+++ b/src/org/w3c/unicorn/input/URIInputParameter.java	Mon Jun 14 11:13:23 2010 -0400
@@ -83,9 +83,11 @@
 			if (!docUrl.getProtocol().equals("http") && !docUrl.getProtocol().equals("https"))
 				throw new UnicornException(Message.ERROR, "$message_unsupported_protocol", null, docUrl.getProtocol());
 			
-			InetAddress add = InetAddress.getByName(docUrl.getHost());
-			if (add.isSiteLocalAddress() || add.isLoopbackAddress())
-				throw new UnicornException(Message.ERROR, "$message_local_address_provided");
+			if (!Property.get("ACCEPT_LOCAL_ADDRESSES").equals("true")) {
+				InetAddress add = InetAddress.getByName(docUrl.getHost());
+				if (add.isSiteLocalAddress() || add.isLoopbackAddress())
+					throw new UnicornException(Message.ERROR, "$message_local_address_provided");
+			}
 			
 			HttpURLConnection con = (HttpURLConnection) docUrl.openConnection();
 			con.setConnectTimeout(connectTimeOut);

Received on Monday, 14 June 2010 15:18:04 UTC