Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mcs/class/System.Web/ChangeLog4
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ChangeLog5
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs120
-rwxr-xr-xmcs/class/System.Web/System.Web.dll.sources1
-rw-r--r--mcs/class/System.Web/System.Web/ChangeLog4
-rw-r--r--mcs/class/System.Web/System.Web/HttpUtility.cs27
6 files changed, 161 insertions, 0 deletions
diff --git a/mcs/class/System.Web/ChangeLog b/mcs/class/System.Web/ChangeLog
index 999dd4d247e..9fc09ee9642 100644
--- a/mcs/class/System.Web/ChangeLog
+++ b/mcs/class/System.Web/ChangeLog
@@ -1,3 +1,7 @@
+2003-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added WebControlsSectionHandler.cs
+
2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* System.Web.dll.sources: added Locale.cs
diff --git a/mcs/class/System.Web/System.Web.Configuration/ChangeLog b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
index 0e70d1c28ad..d9eadcce1ef 100644
--- a/mcs/class/System.Web/System.Web.Configuration/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
@@ -1,3 +1,8 @@
+2003-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControlsSectionHandler.cs: new file to handle <webControls>
+ configuration.
+
2003-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* HandlerItem.cs: make it work for file names without wildcards.
diff --git a/mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs b/mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs
new file mode 100644
index 00000000000..4bd8f45b5f3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs
@@ -0,0 +1,120 @@
+//
+// System.Web.Configuration.WebControlsSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Configuration;
+using System.IO;
+using System.Web;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class WebControlsConfig
+ {
+ static WebControlsConfig instance;
+ string scriptsVDir;
+ string configFilePath;
+
+ public WebControlsConfig (WebControlsConfig parent, object context)
+ {
+ configFilePath = context as string;
+ if (parent == null)
+ return;
+
+ scriptsVDir = parent.scriptsVDir;
+ if (scriptsVDir != null)
+ configFilePath = parent.configFilePath;
+ }
+
+ public void SetClientScriptsLocation (string location, out string error)
+ {
+ error = null;
+ if (location == null || location.Length == 0) {
+ error = "empty or null value for clientScriptsLocation";
+ return;
+ }
+
+ if (location [0] != '/')
+ location = "/" + location;
+
+ string [] splitted = location.Split ('/');
+ int end = splitted.Length;
+ for (int i = 0; i < end; i++)
+ splitted [i] = HttpUtility.UrlEncode (splitted [i]);
+
+ scriptsVDir = String.Join ("/", splitted);
+ }
+
+ public string ScriptsPhysicalDirectory {
+ get { return Path.Combine (Path.GetDirectoryName (configFilePath), "web_scripts"); }
+ }
+
+ public string ScriptsVirtualDirectory {
+ get { return scriptsVDir; }
+ set { scriptsVDir = value; }
+ }
+
+ static public WebControlsConfig Instance {
+ get {
+ //TODO: use HttpContext to get the configuration
+ if (instance != null)
+ return instance;
+
+ lock (typeof (WebControlsConfig)) {
+ if (instance != null)
+ return instance;
+
+ instance = (WebControlsConfig) ConfigurationSettings.GetConfig ("system.web/webControls");
+ }
+
+ return instance;
+ }
+ }
+ }
+
+ class WebControlsSectionHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ WebControlsConfig config = new WebControlsConfig (parent as WebControlsConfig, context);
+
+ if (section.Attributes == null && section.Attributes.Count == 0)
+ ThrowException ("Lack of clientScriptsLocation attribute", section);
+
+ string clientLocation = AttValue ("clientScriptsLocation", section, false);
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", section);
+
+ string error;
+ config.SetClientScriptsLocation (clientLocation, out error);
+ if (error != null)
+ HandlersUtil.ThrowException (error, section);
+
+ return config;
+ }
+
+ // To save some typing...
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional);
+ }
+
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.dll.sources b/mcs/class/System.Web/System.Web.dll.sources
index 7b36122aa45..00528b1cb1c 100755
--- a/mcs/class/System.Web/System.Web.dll.sources
+++ b/mcs/class/System.Web/System.Web.dll.sources
@@ -106,6 +106,7 @@ System.Web.Configuration/AuthenticationConfigHandler.cs
System.Web.Configuration/MachineKeyConfig.cs
System.Web.Configuration/AuthorizationConfig.cs
System.Web.Configuration/GlobalizationConfigurationHandler.cs
+System.Web.Configuration/WebControlsSectionHandler.cs
System.Web.Handlers/TraceHandler.cs
System.Web.Hosting/AppDomainFactory.cs
System.Web.Hosting/ApplicationHost.cs
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog
index 269c5645eaa..080593159b0 100644
--- a/mcs/class/System.Web/System.Web/ChangeLog
+++ b/mcs/class/System.Web/System.Web/ChangeLog
@@ -1,3 +1,7 @@
+2003-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: error checking.
+
2003-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* HttpUtility.cs: small memory usage reduction.
diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs
index ed43a63984f..75b00d198ea 100644
--- a/mcs/class/System.Web/System.Web/HttpUtility.cs
+++ b/mcs/class/System.Web/System.Web/HttpUtility.cs
@@ -527,6 +527,9 @@ namespace System.Web {
if (s == null)
return null;
+ if (s == "")
+ return "";
+
byte [] bytes = Enc.GetBytes (s);
return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
}
@@ -536,6 +539,9 @@ namespace System.Web {
if (bytes == null)
return null;
+ if (bytes.Length == 0)
+ return "";
+
return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
}
@@ -544,6 +550,9 @@ namespace System.Web {
if (bytes == null)
return null;
+ if (bytes.Length == 0)
+ return "";
+
return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, offset, count));
}
@@ -557,6 +566,9 @@ namespace System.Web {
if (str == null)
return null;
+ if (str == "")
+ return new byte [0];
+
byte [] bytes = e.GetBytes (str);
return UrlEncodeToBytes (bytes, 0, bytes.Length);
}
@@ -566,6 +578,9 @@ namespace System.Web {
if (bytes == null)
return null;
+ if (bytes.Length == 0)
+ return new byte [0];
+
return UrlEncodeToBytes (bytes, 0, bytes.Length);
}
@@ -577,6 +592,9 @@ namespace System.Web {
return null;
int len = bytes.Length;
+ if (len == 0)
+ return new byte [0];
+
if (offset < 0 || offset >= len)
throw new ArgumentOutOfRangeException("offset");
@@ -657,6 +675,9 @@ namespace System.Web {
if (str == null)
return null;
+ if (str == "")
+ return new byte [0];
+
return Encoding.ASCII.GetBytes (UrlEncodeUnicode (str));
}
@@ -667,6 +688,9 @@ namespace System.Web {
/// <returns>The decoded text.</returns>
public static string HtmlDecode (string s)
{
+ if (s == null)
+ throw new ArgumentNullException ("s");
+
bool insideEntity = false; // used to indicate that we are in a potential entity
string entity = String.Empty;
StringBuilder output = new StringBuilder ();
@@ -724,6 +748,9 @@ namespace System.Web {
/// <returns>The HTML-encoded text.</returns>
public static string HtmlEncode (string s)
{
+ if (s == null)
+ throw new ArgumentNullException ("s");
+
StringBuilder output = new StringBuilder ();
foreach (char c in s)