- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 14 Sep 2009 10:19:05 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv18631/src/org/w3c/unicorn/action
Modified Files:
ObserveAction.java
Log Message:
do not add http:// if protocol already specified.
+ url syntax verification authorizes local addresses like http://localhost:80
+ new error message if unsupported protocol (supported protocols being specified in the url verification regex)
Index: ObserveAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/ObserveAction.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- ObserveAction.java 10 Sep 2009 15:54:42 -0000 1.26
+++ ObserveAction.java 14 Sep 2009 10:19:03 -0000 1.27
@@ -163,11 +163,17 @@
createError(req, resp, reqParams, mess, mapOfSpecificParameter, mapOfOutputParameter);
return;
}
- Pattern urlPattern = Pattern.compile("^(https?|ftp|rmtp|mms)://(([A-Z0-9][A-Z0-9_-]*)(\\.[A-Z0-9][A-Z0-9_-]*)+)(:(\\d+))?([/#]\\p{ASCII}*)?", Pattern.CASE_INSENSITIVE);
+ Pattern urlPattern = Pattern.compile("^(https?|ftp|rmtp|mms)://([A-Z0-9][A-Z0-9_-]*)(:(\\d+))?([/#]\\p{ASCII}*)?", Pattern.CASE_INSENSITIVE);
if (!urlPattern.matcher(uri).matches()) {
if (uri.equals(""))
continue;
- uri = "http://" + uri;
+ if (!uri.contains("://")) {
+ uri = "http://" + uri;
+ } else {
+ Message mess = new Message(Message.Level.ERROR, "Unicorn does not support " + uri.split("://")[0] + " protocol.", null);
+ createError(req, resp, reqParams, mess, mapOfSpecificParameter, mapOfOutputParameter);
+ return;
+ }
reqParams.put(key, uri);
if (!urlPattern.matcher(uri).matches()) {
Message mess = new Message(Message.Level.ERROR, "$message_invalid_url_syntax " + uri, null);
Received on Monday, 14 September 2009 10:23:58 UTC