W3C home > Mailing lists > Public > www-validator-cvs@w3.org > January 2014

CVS 2002/css-validator/org/w3c/css/servlet

From: CVS User ylafon <cvsmail@w3.org>
Date: Mon, 27 Jan 2014 15:04:41 +0000
Message-Id: <E1W7njt-0003Ci-Em@roscoe.w3.org>
To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/servlet
In directory roscoe:/tmp/cvs-serv12316/servlet

Modified Files:
	CssValidator.java 
Log Message:
Added support to stop recursive checking (might do it better later)

--- /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java	2013/02/11 15:01:51	1.54
+++ /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java	2014/01/27 15:04:41	1.55
@@ -1,5 +1,5 @@
 //
-// $Id: CssValidator.java,v 1.54 2013/02/11 15:01:51 ylafon Exp $
+// $Id: CssValidator.java,v 1.55 2014/01/27 15:04:41 ylafon Exp $
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
 //
 // (c) COPYRIGHT MIT and INRIA, 1997.
@@ -7,7 +7,13 @@
 
 package org.w3c.css.servlet;
 
-import org.w3c.css.css.*;
+import org.w3c.css.css.CssParser;
+import org.w3c.css.css.DocumentParser;
+import org.w3c.css.css.StyleReport;
+import org.w3c.css.css.StyleReportFactory;
+import org.w3c.css.css.StyleSheet;
+import org.w3c.css.css.StyleSheetParser;
+import org.w3c.css.css.TagSoupStyleSheetHandler;
 import org.w3c.css.error.ErrorReport;
 import org.w3c.css.error.ErrorReportFactory;
 import org.w3c.css.index.IndexGenerator;
@@ -40,7 +46,7 @@
 /**
  * This class is a servlet to use the validator.
  *
- * @version $Revision: 1.54 $
+ * @version $Revision: 1.55 $
  */
 public final class CssValidator extends HttpServlet {
 
@@ -242,7 +248,7 @@
 
 		String uri = null;
 		try {
-			uri = req.getParameter("uri"); // null if the parameter does not
+			uri = req.getParameter("uri"); // null if the parameter does not exist
 			// exist
 		} catch (Exception ex) {
 			// pb in URI decoding (bad escaping, most probably)
@@ -360,10 +366,15 @@
 				// that it is a valid
 				// url
 				uri = uri.replaceAll(" ", "%20");
-				DocumentParser URLparser = new DocumentParser(ac, uri);
-
-				handleRequest(ac, res, uri, URLparser.getStyleSheet(), output,
-						warningLevel, errorReport);
+				if (Util.checkURI(uri)) {
+					DocumentParser URLparser = new DocumentParser(ac, uri);
+					handleRequest(ac, res, uri, URLparser.getStyleSheet(), output,
+							warningLevel, errorReport);
+				} else {
+					res.setHeader("Rejected", "Requested URI Forbidden by Rule");
+					handleError(res, ac, output, "Forbidden", new IOException(
+							"URI Forbidden by rule"), false);
+				}
 			} catch (ProtocolException pex) {
 				if (Util.onDebug) {
 					pex.printStackTrace();
Received on Monday, 27 January 2014 15:04:46 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:56 UTC