diff options
Diffstat (limited to 'mcs/class/System.Web')
62 files changed, 985 insertions, 304 deletions
diff --git a/mcs/class/System.Web/System.Web.Caching/Cache.cs b/mcs/class/System.Web/System.Web.Caching/Cache.cs index b8ecda5dd90..720d86c71ca 100644 --- a/mcs/class/System.Web/System.Web.Caching/Cache.cs +++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs @@ -209,7 +209,7 @@ namespace System.Web.Caching { // If we have any kind of expiration add into the CacheExpires class if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration) { if (objEntry.HasSlidingExpiration) - objEntry.Expires = DateTime.Now.Ticks + objEntry.SlidingExpiration; + objEntry.Expires = DateTime.UtcNow.Ticks + objEntry.SlidingExpiration; _objExpires.Add (objEntry); } @@ -392,7 +392,7 @@ namespace System.Web.Caching { internal CacheEntry GetEntry (string strKey) { CacheEntry objEntry = null; - long ticksNow = DateTime.Now.Ticks; + long ticksNow = DateTime.UtcNow.Ticks; if (strKey == null) throw new ArgumentNullException ("strKey"); diff --git a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs index 0e07353dc56..10e0f7c57a0 100644 --- a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs +++ b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs @@ -100,7 +100,7 @@ namespace System.Web.Caching { // moved after each period, and the absolute expiration is the value used
// for all expiration calculations.
if (tsSpan.Ticks != Cache.NoSlidingExpiration.Ticks)
- _ticksExpires = System.DateTime.Now.AddTicks(_ticksSlidingExpiration).Ticks;
+ _ticksExpires = System.DateTime.UtcNow.AddTicks(_ticksSlidingExpiration).Ticks;
_objDependency = objDependency;
if (_objDependency != null)
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs index 673468ae209..11e2377e3c1 100644 --- a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs +++ b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs @@ -71,7 +71,7 @@ namespace System.Web.Caching { } while (bytePos < 60);
// GC Bucket controller
- _intFlush = System.DateTime.Now.Minute - 1;
+ _intFlush = System.DateTime.UtcNow.Minute - 1;
_objTimer = new System.Threading.Timer (new System.Threading.TimerCallback (GarbageCleanup), null, 10000, 60000);
}
@@ -80,7 +80,7 @@ namespace System.Web.Caching { /// </summary>
/// <param name="objEntry">Cache entry to add.</param>
internal void Add (CacheEntry objEntry) {
- long now = DateTime.Now.Ticks;
+ long now = DateTime.UtcNow.Ticks;
if (objEntry.Expires < now)
objEntry.Expires = now;
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog index 3b09664543a..1b19523286f 100644 --- a/mcs/class/System.Web/System.Web.Caching/ChangeLog +++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog @@ -1,3 +1,8 @@ +2004-10-03 Ben Maurer <bmaurer@ximian.com> + + * Cache.cs, CacheEntry.cs, CacheExpires.cs, ExpiresBuckets.cs: + use UtcNow rather than Now. + 2004-05-27 Patrik Torstensson <totte@hiddenpeaks.com> * ExpiresBucket.cs (FlushExpiredItems): fix csc and a typo bug diff --git a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs index e32194c836c..7b8c139afeb 100644 --- a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs +++ b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs @@ -231,7 +231,7 @@ namespace System.Web.Caching { int intPos;
long ticksNow;
- ticksNow = DateTime.Now.Ticks;
+ ticksNow = DateTime.UtcNow.Ticks;
intPos = 0;
// Lookup all items that needs to be removed, this is done in a two part
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs index 4a2cb6502af..d21312dd433 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs @@ -34,6 +34,7 @@ using System.IO; using System.Text; using System.Web.Caching; using System.Web.UI; +using System.Web.UI.HtmlControls; using System.Web.Util; namespace System.Web.Compilation @@ -49,7 +50,7 @@ namespace System.Web.Compilation this.Location = location; } } - + class BuilderLocationStack : Stack { public override void Push (object o) @@ -127,7 +128,46 @@ namespace System.Web.Compilation get { return current.Filename; } } } - + + class TagStack + { + Stack tags; + + public TagStack () + { + tags = new Stack (); + } + + public void Push (string tagid) + { + tags.Push (tagid); + } + + public string Pop () + { + if (tags.Count == 0) + return null; + + return (string) tags.Pop (); + } + + public bool CompareTo (string tagid) + { + if (tags.Count == 0) + return false; + + return 0 == String.Compare (tagid, (string) tags.Peek (), true); + } + + public int Count { + get { return tags.Count; } + } + + public string Current { + get { return (string) tags.Peek (); } + } + } + class AspGenerator { ParserStack pstack; @@ -138,7 +178,10 @@ namespace System.Web.Compilation bool inScript, javascript; ILocation location; bool isApplication; + StringBuilder tagInnerText = new StringBuilder (); static Hashtable emptyHash = new Hashtable (); + bool inForm; + TagStack formTags; public AspGenerator (TemplateParser tparser) { @@ -283,12 +326,22 @@ namespace System.Web.Compilation tparser.AddDirective (tagid, attributes.GetDictionary (null)); break; case TagType.Tag: - if (!ProcessTag (tagid, attributes, tagtype)) - TextParsed (location, location.PlainText); + if (ProcessTag (tagid, attributes, tagtype)) + break; + + if (inForm) { + stack.Builder.EnsureOtherTags (); + stack.Builder.OtherTags.Add (tagid); + } + + TextParsed (location, location.PlainText); break; case TagType.Close: - if (!CloseControl (tagid)) - TextParsed (location, location.PlainText); + bool notServer = (inForm && TryRemoveTag (tagid, stack.Builder.OtherTags)); + if (!notServer && CloseControl (tagid)) + break; + + TextParsed (location, location.PlainText); break; case TagType.SelfClosing: int count = stack.Count; @@ -319,8 +372,8 @@ namespace System.Web.Compilation if (isvirtual) { file = tparser.MapPath (file); - } else if (!Path.IsPathRooted (file)) { - file = UrlUtils.Combine (tparser.BaseVirtualDir, file); + } else { + file = GetIncludeFilePath (tparser.BaseDir, file); } InitParser (file); @@ -332,6 +385,28 @@ namespace System.Web.Compilation //PrintLocation (location); } + static bool TryRemoveTag (string tagid, ArrayList otags) + { + if (otags == null || otags.Count == 0) + return false; + + int idx = otags.Count - 1; + string otagid = (string) otags [idx]; + if (0 != String.Compare (tagid, otagid, true)) + return false; + + otags.RemoveAt (idx); + return true; + } + + static string GetIncludeFilePath (string basedir, string filename) + { + if (Path.DirectorySeparatorChar == '/') + filename = filename.Replace ("\\", "/"); + + return Path.GetFullPath (Path.Combine (basedir, filename)); + } + void TextParsed (ILocation location, string text) { if (text.IndexOf ("<%") != -1 && !inScript) { @@ -359,7 +434,11 @@ namespace System.Web.Compilation if (tparser.DefaultDirectiveName == "application" && t.Trim () != "") throw new ParseException (location, "Content not valid for application file."); - stack.Builder.AppendLiteralString (t); + ControlBuilder current = stack.Builder; + current.AppendLiteralString (t); + if (current.NeedsTagInnerText ()) { + tagInnerText.Append (t); + } } bool ProcessTag (string tagid, TagAttributes atts, TagType tagtype) @@ -409,6 +488,14 @@ namespace System.Web.Compilation builder.location = location; builder.ID = htable ["id"] as string; + if (typeof (HtmlForm).IsAssignableFrom (builder.ControlType)) { + if (inForm) + throw new ParseException (location, "Only one <form> allowed."); + + inForm = true; + formTags = new TagStack (); + } + if (builder.HasBody () && !(builder is ObjectTagBuilder)) { if (builder is TemplateBuilder) { // push the id list @@ -446,8 +533,10 @@ namespace System.Web.Compilation return true; } else { - Parser.VerbatimID = "script"; - javascript = true; + if (tagtype != TagType.SelfClosing) { + Parser.VerbatimID = "script"; + javascript = true; + } TextParsed (location, location.PlainText); return true; } @@ -485,6 +574,20 @@ namespace System.Web.Compilation // if (current is TemplateBuilder) // pop from the id list + if (current.NeedsTagInnerText ()) { + try { + current.SetTagInnerText (tagInnerText.ToString ()); + } catch (Exception e) { + throw new ParseException (current.location, e.Message, e); + } + + tagInnerText.Length = 0; + } + + if (typeof (HtmlForm).IsAssignableFrom (current.ControlType)) { + inForm = false; + } + current.CloseControl (); stack.Pop (); stack.Builder.AppendSubBuilder (current); diff --git a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs index 8f199c12de8..7922b830d20 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs @@ -184,12 +184,15 @@ namespace System.Web.Compilation str = str.Substring (2).Trim (); int len = str.Length; int lastQuote = str.LastIndexOf ('"'); - if (len < 10 || lastQuote != len - 1 || !str.StartsWith ("#include ")) + if (len < 10 || lastQuote != len - 1) + return false; + + if (!str.ToLower ().StartsWith ("#include ")) return false; str = str.Substring (9).Trim (); - bool isfile = (str.StartsWith ("file")); - if (!isfile && !str.StartsWith ("virtual")) + bool isfile = (str.ToLower ().StartsWith ("file")); + if (!isfile && !str.ToLower ().StartsWith ("virtual")) return false; pathType = (isfile) ? "file" : "virtual"; @@ -379,8 +382,11 @@ namespace System.Web.Compilation void GetServerTag (out TagType tagtype, out string id, out TagAttributes attributes) { string inside_tags; + bool old = tokenizer.ExpectAttrValue; + tokenizer.ExpectAttrValue = false; if (Eat ('@')){ + tokenizer.ExpectAttrValue = old; tagtype = TagType.Directive; id = ""; if (Eat (Token.DIRECTIVE)) @@ -394,6 +400,7 @@ namespace System.Web.Compilation } if (Eat (Token.DOUBLEDASH)) { + tokenizer.ExpectAttrValue = old; tokenizer.Verbatim = true; inside_tags = GetVerbatim (tokenizer.get_token (), "--%>"); tokenizer.Verbatim = false; @@ -403,6 +410,7 @@ namespace System.Web.Compilation return; } + tokenizer.ExpectAttrValue = old; bool varname; bool databinding; varname = Eat ('='); diff --git a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs index d04074fe780..231c7236a84 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs @@ -55,6 +55,7 @@ namespace System.Web.Compilation int begcol, begline; int position; bool inTag; + bool expectAttrValue; bool hasPutBack; bool verbatim; bool have_value; @@ -210,7 +211,7 @@ namespace System.Web.Compilation return c; } - if (inTag && (c == '"' || c == '\'')) + if (inTag && expectAttrValue && (c == '"' || c == '\'')) return ReadAttValue (c); if (c == '<'){ @@ -298,6 +299,12 @@ namespace System.Web.Compilation get { return inTag; } set { inTag = value; } } + + // Hack for preventing confusion with VB comments (see bug #63451) + public bool ExpectAttrValue { + get { return expectAttrValue; } + set { expectAttrValue = value; } + } public int BeginLine { get { return begline; } diff --git a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs index 5036f5db094..07578009be5 100644 --- a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs @@ -284,7 +284,7 @@ namespace System.Web.Compilation public virtual Type GetCompiledType () { - Type type = CachingCompiler.GetTypeFromCache (parser.InputFile, parser.ClassName); + Type type = CachingCompiler.GetTypeFromCache (parser.InputFile); if (type != null) return type; @@ -309,7 +309,7 @@ namespace System.Web.Compilation bool keepFiles = (Environment.GetEnvironmentVariable ("MONO_ASPNET_NODELETE") != null); TempFileCollection tempcoll = new TempFileCollection (config.TempDirectory, keepFiles); compilerParameters.TempFiles = tempcoll; - string dllfilename = tempcoll.AddExtension ("dll", true); + string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true)); if (!Directory.Exists (dynamicBase)) Directory.CreateDirectory (dynamicBase); diff --git a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs index bda584c306b..2e469984335 100644 --- a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs @@ -32,6 +32,7 @@ using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Specialized; +using System.IO; using System.Reflection; using System.Web.UI; using System.Web.Caching; @@ -43,21 +44,20 @@ namespace System.Web.Compilation { static object compilationLock = new object (); const string cachePrefix = "@@Assembly"; + const string cacheTypePrefix = "@@@Type"; - public static Type GetTypeFromCache (string filename, string typename) + public static void InsertType (Type type, string filename) { - string key = CachingCompiler.cachePrefix + filename; - CompilerResults results = (CompilerResults) HttpRuntime.Cache [key]; - if (results == null) - return null; - - Assembly a = results.CompiledAssembly; - if (a == null) - return null; + string [] cacheKeys = new string [] { cachePrefix + filename }; + CacheDependency dep = new CacheDependency (null, cacheKeys); + HttpRuntime.Cache.Insert (cacheTypePrefix + filename, type, dep); + } - return a.GetType (typename, false); + public static Type GetTypeFromCache (string filename) + { + return (Type) HttpRuntime.Cache [cacheTypePrefix + filename]; } - + public static CompilerResults Compile (BaseCompiler compiler) { Cache cache = HttpRuntime.Cache; @@ -139,12 +139,40 @@ namespace System.Web.Compilation ICodeCompiler compiler = provider.CreateCompiler (); CompilerParameters options = GetOptions (assemblies); results = compiler.CompileAssemblyFromFile (options, file); - string [] deps = (string []) assemblies.ToArray (typeof (string)); + ArrayList realdeps = new ArrayList (assemblies.Count + 1); + realdeps.Add (file); + for (int i = assemblies.Count - 1; i >= 0; i--) { + string current = (string) assemblies [i]; + if (Path.IsPathRooted (current)) + realdeps.Add (current); + } + + string [] deps = (string []) realdeps.ToArray (typeof (string)); cache.Insert (cachePrefix + key, results, new CacheDependency (deps)); } return results; } + + public static Type CompileAndGetType (string typename, string language, string key, + string file, ArrayList assemblies) + { + CompilerResults result = CachingCompiler.Compile (language, key, file, assemblies); + if (result.NativeCompilerReturnValue != 0) { + StreamReader reader = new StreamReader (file); + throw new CompilationException (file, result.Errors, reader.ReadToEnd ()); + } + + Assembly assembly = result.CompiledAssembly; + if (assembly == null) { + StreamReader reader = new StreamReader (file); + throw new CompilationException (file, result.Errors, reader.ReadToEnd ()); + } + + Type type = assembly.GetType (typename, true); + InsertType (type, file); + return type; + } } } diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog index 1bd493966e2..7dbcbfba4b2 100644 --- a/mcs/class/System.Web/System.Web.Compilation/ChangeLog +++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog @@ -1,3 +1,57 @@ +2004-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspGenerator.cs: correctly process script tags that self-closing. + Fixes bug #69657. + +2004-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * CachingCompiler.cs: when compiling a single .cs file, add the file + itself to dependencies. Fixes bug #68788. + +2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ControlBuilder.cs: don't close server tags when we get to a closing + tag that is not applied to a server control. Fixes bug #60323. + +2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebServiceCompiler.cs: fix buglet in my last commit. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * BaseCompiler.cs: + * CachingCompiler.cs: + * WebServiceCompiler.cs: correctly cache Type instead of the assembly + for ashx/asmx. Otherwise we need to open the file and check for the + class name in there. Thanks to Ben for pointing this out. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * CachingCompiler.cs: don't try to watch for changes in system + assemblies. Fixes bug #64871. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspGenerator.cs: handle builders that need to process inner text + with tags. + + * Location.cs: added setters for the properties. + +2004-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspGenerator.cs: the path for file was treated as virtual, but it's + physical. Fixes bug #61524. + +2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspParser.cs: fixed case-sensitivity issues with #include and its + attributes. Closes #61429. + +2004-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * BaseCompiler.cs: + * WebServiceCompiler.cs: really create the dlls under DynamicBase + 2004-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TemplateControlCompiler.cs: for system colors, use SystemColors class diff --git a/mcs/class/System.Web/System.Web.Compilation/Location.cs b/mcs/class/System.Web/System.Web.Compilation/Location.cs index e4a0cb775a1..4a57b8055ac 100644 --- a/mcs/class/System.Web/System.Web.Compilation/Location.cs +++ b/mcs/class/System.Web/System.Web.Compilation/Location.cs @@ -65,22 +65,27 @@ namespace System.Web.Compilation public int BeginLine { get { return beginLine; } + set { beginLine = value; } } public int EndLine { get { return endLine; } + set { endLine = value; } } public int BeginColumn { get { return beginColumn; } + set { beginColumn = value; } } public int EndColumn { get { return endColumn; } + set { endColumn = value; } } public string PlainText { get { return plainText; } + set { plainText = value; } } } } diff --git a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs index 20b87415730..4df2b6b9a94 100644 --- a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs @@ -59,12 +59,15 @@ namespace System.Web.Compilation public override Type GetCompiledType () { - Type type = CachingCompiler.GetTypeFromCache (parser.PhysicalPath, parser.ClassName); + Type type = CachingCompiler.GetTypeFromCache (parser.PhysicalPath); if (type != null) return type; - if (parser.Program.Trim () == "") - return parser.GetTypeFromBin (parser.ClassName); + if (parser.Program.Trim () == "") { + type = parser.GetTypeFromBin (parser.ClassName); + CachingCompiler.InsertType (type, parser.PhysicalPath); + return type; + } string lang = parser.Language; CompilationConfiguration config; @@ -93,7 +96,7 @@ namespace System.Web.Compilation sw.WriteLine (parser.Program); sw.Close (); - string dllfilename = tempcoll.AddExtension ("dll", true); + string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true)); if (!Directory.Exists (dynamicBase)) Directory.CreateDirectory (dynamicBase); @@ -106,7 +109,9 @@ namespace System.Web.Compilation "No assembly returned after compilation!?"); results.TempFiles.Delete (); - return results.CompiledAssembly.GetType (parser.ClassName, true); + type = results.CompiledAssembly.GetType (parser.ClassName, true); + CachingCompiler.InsertType (type, parser.PhysicalPath); + return type; } void CheckCompilerErrors (CompilerResults results) diff --git a/mcs/class/System.Web/System.Web.Configuration/ChangeLog b/mcs/class/System.Web/System.Web.Configuration/ChangeLog index 2f67b0fee83..97f76d47021 100644 --- a/mcs/class/System.Web/System.Web.Configuration/ChangeLog +++ b/mcs/class/System.Web/System.Web.Configuration/ChangeLog @@ -1,3 +1,13 @@ +2004-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebConfigurationSettings.cs: use CurrentExecutionFilePath instead of + FilePath. Fixes bug #67982. + +2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebConfigurationSettings.cs: fix bug when processing empty location + tags. Closes bug #63001. + 2004-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> * AuthorizationConfig.cs: really fix bug #60482. Thanks David! diff --git a/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs index e00c1921978..0d212d76cc1 100644 --- a/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs +++ b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs @@ -148,7 +148,7 @@ namespace System.Web.Configuration if (context == null) return null; - ConfigurationData config = GetConfigFromFileName (context.Request.FilePath, context); + ConfigurationData config = GetConfigFromFileName (context.Request.CurrentExecutionFilePath, context); if (config == null) return null; @@ -213,6 +213,9 @@ namespace System.Web.Configuration public void Init (HttpContext context) { + if (initCalled) + return; + lock (this) { if (initCalled) return; @@ -251,7 +254,7 @@ namespace System.Web.Configuration public FileWatcherCache (ConfigurationData data) { this.data = data; - cacheTable = Hashtable.Synchronized (new Hashtable ()); + cacheTable = new Hashtable (); this.path = Path.GetDirectoryName (data.FileName); this.filename = Path.GetFileName (data.FileName); if (!Directory.Exists (path)) @@ -539,7 +542,7 @@ namespace System.Web.Configuration public object GetConfig (string sectionName, HttpContext context) { if (locations != null && dirname != null) { - string reduced = UrlUtils.MakeRelative (context.Request.FilePath, dirname); + string reduced = UrlUtils.MakeRelative (context.Request.CurrentExecutionFilePath, dirname); string [] parts = reduced.Split ('/'); Location location = null; int length = parts.Length; @@ -791,16 +794,13 @@ namespace System.Web.Configuration void StoreLocation (string name, XmlTextReader reader) { - if (locations == null) { - locations = new Hashtable (); - } - string path = null; bool haveAllow = false; bool allowOverride = true; + string att = null; while (reader.MoveToNextAttribute ()) { - string att = reader.Name; + att = reader.Name; if (att == "path") { if (path != null) @@ -830,8 +830,13 @@ namespace System.Web.Configuration ThrowException ("Unrecognized attribute.", reader); } + if (att == null) + return; // empty location tag + Location loc = new Location (this, path, allowOverride); - if (locations.ContainsKey (loc.Path)) + if (locations == null) + locations = new Hashtable (); + else if (locations.ContainsKey (loc.Path)) ThrowException ("Duplicated location path: " + loc.Path, reader); reader.MoveToElement (); diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog index ebddbc1e4ba..4f3e185e220 100644 --- a/mcs/class/System.Web/System.Web.Handlers/ChangeLog +++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog @@ -1,3 +1,12 @@ +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceHandler.cs: error code is 403 and the message different when + trace is enabled but not for remote clients. + +2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceHandler.cs: check that trace is enabled or throw. + 2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TraceHandler.cs: Added protected missing members and attributes. diff --git a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs index 33385dbf5fb..23e35288f80 100644 --- a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs +++ b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs @@ -39,17 +39,37 @@ using System.Web.UI.WebControls; namespace System.Web.Handlers { +#if NET_2_0 + [Serializable] +#endif + class TraceNotAvailableException : HttpException + { + bool notLocal; + + public TraceNotAvailableException (bool notLocal) : + base (notLocal ? 403 : 500, "Trace Error") + { + this.notLocal = notLocal; + } + + internal override string Description { + get { + if (notLocal) + return "Trace is not enabled for remote clients."; + + return "Trace.axd is not enabled in the configuration file for this application."; + } + } + } + public class TraceHandler : IHttpHandler { void IHttpHandler.ProcessRequest (HttpContext context) { TraceManager manager = HttpRuntime.TraceManager; - if (manager.LocalOnly && !context.Request.IsLocal) { - // Need to figure out the error message that goes here - // but I only have cassini for testing - return; - } + if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal) + throw new TraceNotAvailableException (manager.Enabled); HtmlTextWriter output = new HtmlTextWriter (context.Response.Output); diff --git a/mcs/class/System.Web/System.Web.Mail/ChangeLog b/mcs/class/System.Web/System.Web.Mail/ChangeLog index 21478e29bdf..ffd6523aa3a 100644 --- a/mcs/class/System.Web/System.Web.Mail/ChangeLog +++ b/mcs/class/System.Web/System.Web.Mail/ChangeLog @@ -1,3 +1,20 @@ +2004-10-28 Sanjay Gupta <gsanjay@novell.com> + + * SmtpClient.cs: Backported fix for bug 68829. + +2004-08-30 Sanjay Gupta <gsanjay@novell.com> + + * MailMessage.cs: + * MailMessageWrapper.cs: + * SmtpClient.cs: Fields property of MailMessage from .Net 1.1 was not + handled completely. + +2004-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * SmtpClient.cs: multipart mails default body format is now the same as + the one used for single part mails instead of being forced to + "text/plain". + 2004-02-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> * MailMessage.cs: patch by John Luke that initialized the fields in diff --git a/mcs/class/System.Web/System.Web.Mail/MailMessage.cs b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs index 6531a6d6156..fea1d167846 100644 --- a/mcs/class/System.Web/System.Web.Mail/MailMessage.cs +++ b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs @@ -51,7 +51,6 @@ namespace System.Web.Mail private string to;
private string urlContentBase;
private string urlContentLocation; - private Hashtable fields;
// Constructor
public MailMessage ()
@@ -59,7 +58,9 @@ namespace System.Web.Mail attachments = new ArrayList (8);
headers = new ListDictionary ();
bodyEncoding = Encoding.Default; +#if NET_1_1 fields = new Hashtable ();
+#endif }
// Properties
@@ -127,6 +128,8 @@ namespace System.Web.Mail }
#if NET_1_1
+ private Hashtable fields;
+ public IDictionary Fields {
get { return (IDictionary) fields; diff --git a/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs b/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs index 17bd581675b..270892aab93 100644 --- a/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs +++ b/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs @@ -227,6 +227,19 @@ namespace System.Web.Mail { public string UrlContentLocation { get { return message.UrlContentLocation; } } + +#if NET_1_1 + public MailHeader Fields { + get { + MailHeader bodyHeaders = new MailHeader(); + // Add Fields to MailHeader Object + foreach( string key in message.Fields.Keys ) + bodyHeaders.Data[ key ] = (string)this.message.Fields[ key ]; + return bodyHeaders; + } + } +#endif + } } diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs index 25569cfc074..931274dbd68 100644 --- a/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs +++ b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs @@ -140,6 +140,7 @@ namespace System.Web.Mail { string boundary = MailUtil.GenerateBoundary(); // set the Content-Type header to multipart/mixed + string bodyContentType = msg.Header.ContentType; msg.Header.ContentType = String.Format( "multipart/mixed;\r\n boundary={0}" , boundary ); @@ -151,7 +152,23 @@ namespace System.Web.Mail { smtp.WriteBoundary( boundary ); MailHeader partHeader = new MailHeader(); - partHeader.ContentType = "text/plain"; + partHeader.ContentType = bodyContentType; + +#if NET_1_1 + // Add all the custom headers to body part as specified in + //Fields property of MailMessageWrapper + + //Remove fields specific for authenticating to SMTP server. + + if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] != null) + msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"); + if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/sendusername"] != null) + msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/sendusername"); + if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/sendpassword"] != null) + msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/sendpassword"); + + partHeader.Data.Add(msg.Fields.Data); +#endif smtp.WriteHeader( partHeader ); diff --git a/mcs/class/System.Web/System.Web.Security/ChangeLog b/mcs/class/System.Web/System.Web.Security/ChangeLog index cf7612e3ae3..17865abd5bc 100644 --- a/mcs/class/System.Web/System.Web.Security/ChangeLog +++ b/mcs/class/System.Web/System.Web.Security/ChangeLog @@ -1,3 +1,12 @@ +2004-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * FormsAuthentication.cs: patch by Jim Pease to fix the date on renewal. + +2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * FormsAuthenticationModule.cs: don't renew expired cookies. Only renew + the cookie if SlidingExpiration is set. Thanks to Jim Pease. + 2004-06-12 Pedro Martínez Juliá <yoros@wanadoo.es> * FormsAuthentication.cs: Undo last change. diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs index bee8998e76a..451cb0dc260 100644 --- a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs +++ b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs @@ -311,7 +311,7 @@ namespace System.Web.Security return tOld; FormsAuthenticationTicket tNew = tOld.Clone (); - tNew.SetDates (now, now - toExpiration + toIssue); + tNew.SetDates (now, now + (tOld.Expiration - tOld.IssueDate)); return tNew; } diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs index f46923ad5b8..ac9f3c31327 100644 --- a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs +++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs @@ -82,7 +82,12 @@ namespace System.Web.Security return; FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt (cookie.Value); - ticket = FormsAuthentication.RenewTicketIfOld (ticket); + if (ticket == null || ticket.Expired) + return; + + if (config.SlidingExpiration) + ticket = FormsAuthentication.RenewTicketIfOld (ticket); + context.User = new GenericPrincipal (new FormsIdentity (ticket), new string [0]); cookie.Value = FormsAuthentication.Encrypt (ticket); diff --git a/mcs/class/System.Web/System.Web.SessionState/ChangeLog b/mcs/class/System.Web/System.Web.SessionState/ChangeLog index 58135e9f7d0..65d40fbe0bc 100644 --- a/mcs/class/System.Web/System.Web.SessionState/ChangeLog +++ b/mcs/class/System.Web/System.Web.SessionState/ChangeLog @@ -1,3 +1,18 @@ +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * SessionStateModule.cs: use SetCurrentExePath instead of SetFilePath. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpSessionState.cs: don't share static session objects declared in + the application file across the application, but on a per-session + basis. Fixes bug #65446. + +2004-07-07 Juraj Skripsky <juraj@hotfeet.ch> + + * SessionStateModule.cs: set path in session cookie to application + path. + 2004-06-18 Gert Driesen <drieseng@users.sourceforge.net> * IStateRuntime.cs: added missing marshalling attributes diff --git a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs index 0e92660cbc1..03fcacbb118 100644 --- a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs +++ b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs @@ -59,7 +59,7 @@ public sealed class HttpSessionState : ICollection, IEnumerable { _id = id; _dict = dict; - _staticObjects = staticObjects; + _staticObjects = staticObjects.Clone (); _timeout = timeout; _newSession = newSession; _isCookieless = isCookieless; diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs index 70c4a566129..c909e2a4086 100644 --- a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs +++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs @@ -109,7 +109,7 @@ namespace System.Web.SessionState if (id == null) return; - context.Request.SetFilePath (UrlUtils.RemoveSessionId (base_path, + context.Request.SetCurrentExePath (UrlUtils.RemoveSessionId (base_path, context.Request.FilePath)); context.Request.SetHeader (HeaderName, id); } @@ -158,7 +158,7 @@ namespace System.Web.SessionState } else if (isNew) { string id = context.Session.SessionID; HttpCookie cookie = new HttpCookie (CookieName, id); - cookie.Path = UrlUtils.GetDirectory (context.Request.Path); + cookie.Path = UrlUtils.GetDirectory (context.Request.ApplicationPath); context.Response.AppendCookie (cookie); } } diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs index 0777e266fc4..de46e7d14ac 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs @@ -217,7 +217,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_AdvertisementFile")] public string AdvertisementFile { get { return ((advertisementFile != null) ? advertisementFile : ""); } @@ -232,7 +232,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_KeywordFilter")] public string KeywordFilter { get { @@ -251,7 +251,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] [TypeConverter(typeof(TargetConverter))] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_Target")] public string Target { get { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs index 86de6a314f5..83ac1c850cc 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs @@ -56,7 +56,7 @@ namespace System.Web.UI.WebControls } [DefaultValue(ValidationDataType.String)] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("RangeValidator_Type")] public ValidationDataType Type { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs index 26a081dc3e0..b003e315524 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs @@ -192,7 +192,9 @@ namespace System.Web.UI.WebControls if(!Visible || (Visible && !Enabled)) { IsValid = true; + return; } + Control ctrl = Parent; while(ctrl != null) { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog index cb282d6377a..e0e553dc284 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog @@ -1,6 +1,41 @@ +2004-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ListItemCollection.cs: fixed bug when indexing changed elements in + LoadViewState. Patch from Alois BÄ›laÅ¡ka. + +2004-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TableStyle.cs: don't render empty 'rules' attribute (again). + +2004-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * RadioButton.cs: fix GroupName when the control is inside a + NamingContainer different from Page. Closes bug #65586. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Xml.cs: fixed get_DocumentContent (it was returning "" always!) and + don't call MapPathSecure on the content itself. + + * XmlBuilder.cs: handle XML documents written inside asp:xml. The + document is checked at parse time and will be checked again at run time. + + Fixes bug #63828. + +2004-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Xml.cs: use MapPath in DocumentSource and documentContent. Fixes + bug #62726. + +2004-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * BaseValidator.cs: in Validate(), when the control is not visible or + enabled, return inmediately after setting IsValid to true. Fixes bug + #61831. + 2004-06-10 Alon Gazit <along@mainsoft.com> - * WebControl.cs: fixed LoadViewState(). - Creates new attributes state bag only when the current is null. + * WebControl.cs: fixed LoadViewState(). + Creates new attributes state bag only when the current is null. 2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs index acaa33be15b..7a9237bea09 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs @@ -272,7 +272,7 @@ namespace System.Web.UI.WebControls end = indices.Count;
for (i = 0; i < end; i++) {
if ((int) indices [i] < Count ) {
- this [i].LoadViewState (states [i]);
+ this [(int) indices [i]].LoadViewState (states [i]);
} else {
ListItem temp = new ListItem ();
temp.LoadViewState (states [i]);
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs index 27bfa2c99a3..becb19787bc 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs @@ -99,19 +99,23 @@ namespace System.Web.UI.WebControls writer.RenderBeginTag (System.Web.UI.HtmlTextWriterTag.Input);
writer.RenderEndTag ();
}
-
- private string UniqueGroupNamePrivate
- {
- get {
- string retVal = GroupName;
- int unique = UniqueID.LastIndexOf (':');
- if (unique >= 0)
- retVal += UniqueID.Substring (unique + 1);
-
- return retVal;
- }
- }
-
+ + private string UniqueGroupNamePrivate + { + get { + string retVal; + string uid = UniqueID; + int unique = uid.LastIndexOf (':'); + if (unique == -1) { + retVal = GroupName; + } else { + retVal = uid.Substring (0, unique + 1) + GroupName; + } + + return retVal; + } + } + private string ValueAttributePrivate
{
get {
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs index 413b8a0745c..a1653a11928 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs @@ -171,7 +171,7 @@ namespace System.Web.UI.WebControls {
writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), HorizontalAlign, "G"));
}
- string gd = String.Empty; + string gd = null; switch(GridLines)
{
case GridLines.None: break; @@ -182,6 +182,8 @@ namespace System.Web.UI.WebControls case GridLines.Both: gd = "all";
break;
} + + if (gd != null) writer.AddAttribute(HtmlTextWriterAttribute.Rules, gd); } diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs index 7cdb7e4fea8..e2bca533f8f 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs @@ -116,7 +116,7 @@ namespace System.Web.UI.WebControls [WebSysDescription ("The XML content that is transformed for the XML Webcontrol.")] public string DocumentContent { get { - return String.Empty; + return documentContent; } set { document = null; @@ -189,7 +189,6 @@ namespace System.Web.UI.WebControls GetType().Name)); } - [MonoTODO("security")] private void LoadXpathDoc () { if (documentContent != null && documentContent.Length > 0) { @@ -198,12 +197,11 @@ namespace System.Web.UI.WebControls } if (documentSource != null && documentSource.Length != 0) { - xpathDoc = new XPathDocument (documentSource); + xpathDoc = new XPathDocument (MapPathSecure (documentSource)); return; } } - [MonoTODO("security")] private void LoadTransform () { if (transform != null) diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs index 4aaa88a7580..445e87143d2 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs @@ -2,8 +2,10 @@ // System.Web.UI.WebControls.XmlBuilder.cs // // Author: -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Gonzalo Paniagua Javier (gonzalo@novell.com) // +// Copyright (c) 2004 Novell, Inc. (http://www.novell.com) // // @@ -29,14 +31,16 @@ using System; using System.Collections; +using System.Web.Compilation; using System.Web.UI; +using System.Xml; namespace System.Web.UI.WebControls { - internal class XmlBuilder : ControlBuilder + class XmlBuilder : ControlBuilder { public override void AppendLiteralString (string s) - { + { } public override Type GetChildControlType (string tagName, IDictionary attribs) @@ -49,10 +53,26 @@ namespace System.Web.UI.WebControls return true; } - [MonoTODO ("find out what this does and implement")] public override void SetTagInnerText (string text) { - throw new NotImplementedException (); + string trimmed = text.Trim (); + if (trimmed == "") + return; + + XmlDocument doc = new XmlDocument (); + try { + doc.LoadXml (text); + } catch (XmlException xmle) { + Location newloc = new Location (location); + if (xmle.LineNumber >= 0) + newloc.BeginLine += xmle.LineNumber - 1; + + location = newloc; + throw; + } + + base.AppendLiteralString (trimmed); } } } + diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index 07d62fd2c33..f9bfb626918 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,3 +1,49 @@ +2004-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ControlBuilder.cs: from HEAD. + +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Control.cs: even if the control has no children the naming container + may contain the control we're looking for. Fixes bug #67304. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TemplateParser.cs: ensure bin directory exists before trying to access + it. Fixes bug #65446 (not closed yet due to dependencies). + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * SimpleWebHandlerParser.cs: correctly cache Type instead of the + assembly for ashx/asmx. Otherwise we need to open the file and check + for the class name in there. Thanks to Ben for pointing this out. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TemplateParser.cs: removed creation of StringWriter. It's not used. + * Control.cs: don't create the EventHandlerList until requested. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * LiteralControl.cs: stylized. This control has EnableViewState disabled + by default and doesn't get an automatic ID. When text is null -> "". + +2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TemplateControl.cs: don't include private methods of base classes when + auto-attaching events. Fixes bug 61569. + +2004-07-08 Pablo Baena <pbaena@gmail.com> + + * Page.cs: added workaround for __doPostBack script on Netscape 4.xx + +2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Page.cs: added additional checks for saving/displaying trace data. + + * PageParser.cs: removed checks for trace enabled in configuration + files. + 2004-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> * ControlCollection.cs: when clearing the control collection, tell the diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs index 97ec7f757fc..da9aac46dc8 100644 --- a/mcs/class/System.Web/System.Web.UI/Control.cs +++ b/mcs/class/System.Web/System.Web.UI/Control.cs @@ -70,7 +70,7 @@ namespace System.Web.UI private bool _childControlsCreated; private StateBag _viewState; private bool _trackViewState; - private EventHandlerList _events = new EventHandlerList(); + private EventHandlerList _events; private RenderMethod _renderMethodDelegate; private bool autoID = true; private bool creatingControls; @@ -501,9 +501,6 @@ namespace System.Web.UI protected virtual Control FindControl (string id, int pathOffset)
{
EnsureChildControls ();
- if (_controls == null)
- return null;
-
Control namingContainer = null;
if (!_isNamingContainer) {
namingContainer = NamingContainer;
@@ -512,7 +509,10 @@ namespace System.Web.UI return namingContainer.FindControl (id, pathOffset);
}
-
+ + if (!HasControls ()) + return null; + int colon = id.IndexOf (':', pathOffset);
if (colon == -1)
return LookForControlByName (id.Substring (pathOffset));
diff --git a/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs index 77ff7d773c8..4c9abedd44d 100755 --- a/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs +++ b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs @@ -66,6 +66,7 @@ namespace System.Web.UI { internal int renderIndex; internal bool isProperty; internal ILocation location; + ArrayList otherTags; public ControlBuilder () { @@ -91,6 +92,16 @@ namespace System.Web.UI { this.fileName = sourceFileName; } + internal void EnsureOtherTags () + { + if (otherTags == null) + otherTags = new ArrayList (); + } + + internal ArrayList OtherTags { + get { return otherTags; } + } + public Type ControlType { get { return type; } } diff --git a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs index 9d469ee5f10..93002f71467 100644 --- a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs +++ b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs @@ -1,11 +1,13 @@ -//
-// System.Web.UI.LiteralControl.cs
-//
-// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
+// +// System.Web.UI.LiteralControl.cs +// +// Author: +// Bob Smith <bob@thestuff.net> +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) Bob Smith +// Copyright (c) 2002-2004 Novell, Inc. (http://www.novell.com) +// // // Permission is hereby granted, free of charge, to any person obtaining @@ -27,41 +29,43 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -
-using System;
-using System.ComponentModel;
-using System.Web;
-
-namespace System.Web.UI
-{
- [ToolboxItem(false)]
- public class LiteralControl : Control
- {
- private string _text = String.Empty;
- public LiteralControl() {}
- public LiteralControl(string text)
- {
- _text = text;
- }
- public virtual string Text
- {
- get
- {
- return _text;
- }
- set
- {
- _text = value;
- }
- }
- protected override void Render(HtmlTextWriter writer)
- {
- writer.Write(_text);
- }
-
- protected override ControlCollection CreateControlCollection ()
- {
- return new EmptyControlCollection (this);
- }
- }
-}
+ +using System; +using System.ComponentModel; +using System.Web; + +namespace System.Web.UI +{ + [ToolboxItem(false)] + public class LiteralControl : Control + { + string _text; + + public LiteralControl () : this (null) {} + + public LiteralControl (string text) + { + EnableViewState = false; + PreventAutoID (); + _text = (text == null) ? "" : text; // Text property is not called for this. + } + + public virtual string Text { + get { return _text; } + set { + _text = (value == null) ? "" : value; + } + } + + protected override void Render (HtmlTextWriter writer) + { + writer.Write (_text); + } + + protected override ControlCollection CreateControlCollection () + { + return new EmptyControlCollection (this); + } + } +} + diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index 3887c9c35e0..53b89d28854 100755 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -526,7 +526,12 @@ public class Page : TemplateControl, IHttpHandler writer.WriteLine ("<script language=\"javascript\">"); writer.WriteLine ("<!--"); writer.WriteLine ("\tfunction __doPostBack(eventTarget, eventArgument) {"); - writer.WriteLine ("\t\tvar theform = document.getElementById ('{0}');", formUniqueID); + + if (Request.Browser.Browser == ("Netscape") && Request.Browser.MajorVersion == 4) + writer.WriteLine ("\t\tvar theform = document.{0};", formUniqueID); + else + writer.WriteLine ("\t\tvar theform = document.getElementById ('{0}');", formUniqueID); + writer.WriteLine ("\t\ttheform.{0}.value = eventTarget;", postEventSourceID); writer.WriteLine ("\t\ttheform.{0}.value = eventArgument;", postEventArgumentID); writer.WriteLine ("\t\ttheform.submit();"); @@ -769,11 +774,18 @@ public class Page : TemplateControl, IHttpHandler private void RenderTrace (HtmlTextWriter output) { - if (!Trace.IsEnabled) + TraceManager traceManager = HttpRuntime.TraceManager; + + if (Trace.HaveTrace && !Trace.IsEnabled || !Trace.HaveTrace && !traceManager.Enabled) return; Trace.SaveData (); - Trace.Render (output); + + if (!Trace.HaveTrace && traceManager.Enabled && !traceManager.PageOutput) + return; + + if (!traceManager.LocalOnly || Context.Request.IsLocal) + Trace.Render (output); } internal void RaisePostBackEvents () diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs index 816d83c0bc8..571edf2997a 100644 --- a/mcs/class/System.Web/System.Web.UI/PageParser.cs +++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs @@ -199,13 +199,6 @@ namespace System.Web.UI } } - TraceConfig traceConfig = (TraceConfig) Context.GetConfig ("system.web/trace"); - if (traceConfig != null) { - trace = traceConfig.Enabled; - if (trace) - haveTrace = true; - } - string tracestr = GetString (atts, "Trace", null); if (tracestr != null) { haveTrace = true; @@ -227,13 +220,6 @@ namespace System.Web.UI "one of the following values: SortByTime, SortByCategory."); } - if (traceConfig != null) { - if (traceConfig.LocalOnly && !Context.Request.IsLocal) { - haveTrace = false; - trace = false; - } - } - errorPage = GetString (atts, "ErrorPage", null); validateRequest = GetBool (atts, "ValidateRequest", PagesConfig.ValidateRequest); clientTarget = GetString (atts, "ClientTarget", null); diff --git a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs index 4c200a93568..d075d404a5c 100644 --- a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs +++ b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs @@ -64,6 +64,10 @@ namespace System.Web.UI protected SimpleWebHandlerParser (HttpContext context, string virtualPath, string physicalPath) { + cachedType = CachingCompiler.GetTypeFromCache (physicalPath); + if (cachedType != null) + return; // We don't need anything else. + this.context = context; this.vPath = virtualPath; this.physPath = physicalPath; @@ -104,8 +108,7 @@ namespace System.Web.UI ParseDirective (trimmed); directiveFound = true; if (gotDefault) { - cachedType = CachingCompiler.GetTypeFromCache (physPath, - className); + cachedType = CachingCompiler.GetTypeFromCache (physPath); if (cachedType != null) break; } diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs index 7b1e85f94fb..1014c3792f9 100755 --- a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs +++ b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs @@ -106,6 +106,12 @@ namespace System.Web.UI { if (method == null) continue; + if (method.DeclaringType != type) { + if (!method.IsPublic && !method.IsFamilyOrAssembly && + !method.IsFamilyAndAssembly && !method.IsFamily) + continue; + } + if (method.ReturnType != typeof (void)) continue; diff --git a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs index ebceb6394fe..6402b7f84f8 100755 --- a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs +++ b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs @@ -276,6 +276,9 @@ namespace System.Web.UI return null; // Load from bin + if (!Directory.Exists (PrivateBinPath)) + return null; + string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll"); foreach (string s in binDlls) { Assembly binA = Assembly.LoadFrom (s); @@ -435,7 +438,6 @@ namespace System.Web.UI CompilerResults result = CachingCompiler.Compile (language, realPath, realPath, assemblies); if (result.NativeCompilerReturnValue != 0) { - StringWriter writer = new StringWriter(); StreamReader reader = new StreamReader (realPath); throw new CompilationException (realPath, result.Errors, reader.ReadToEnd ()); } diff --git a/mcs/class/System.Web/System.Web.Util/ChangeLog b/mcs/class/System.Web/System.Web.Util/ChangeLog index 4d57c166561..f293a48cb13 100644 --- a/mcs/class/System.Web/System.Web.Util/ChangeLog +++ b/mcs/class/System.Web/System.Web.Util/ChangeLog @@ -1,3 +1,8 @@ +2004-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * UrlUtils.cs: don't pass double slash when the path begins with a + tilde. Fixes bug #61654. + 2004-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> * UrlUtils.cs: diff --git a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs index 955c8d9a17b..a8f60ff3159 100644 --- a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs +++ b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs @@ -154,7 +154,11 @@ namespace System.Web.Util slash = "/"; } - return Reduce (HttpRuntime.AppDomainAppVirtualPath + slash + relPath); + string appvpath = HttpRuntime.AppDomainAppVirtualPath; + if (appvpath.EndsWith ("/")) + slash = ""; + + return Reduce (appvpath + slash + relPath); } return Reduce (basePath + slash + relPath); diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 93cc846bb86..9b793b3aafc 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,3 +1,125 @@ +2004-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceContext.cs: don't cast to Page is the handler it's not a page. + +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpRequest.cs: CurrentExecutionFilePath is the one that + changes when Transfer or Execute are used, not FilePath. + + * HttpServerUtility.cs: moved form saving/restoring from + Transfer to Execute, as it's needed there too. the query string is + correctly set now. Fixes bug #67388. + + * HttpContext.cs: use SetCurrentExePath instead of SetFilePath. + +2004-10-03 Ben Maurer <bmaurer@ximian.com> + + * HttpResponse.cs: use UtcNow + +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpResponse.cs: SuppressContent does not throw and clears all the + buffered output. Fixes bug #67213. + +2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpUtility.cs: UrlPathEncode is static. Fixes bug #67155. + +2004-09-29 Ben Maurer <bmaurer@ximian.com> + + * HttpContext.cs, TimeoutManager: Use DateTime.UtcNow. + +2004-09-25 Ben Maurer <bmaurer@ximian.com> + + * HttpApplication.cs: Make sure requests are removed from + the timeout manager. Fixes a major leak. #66751. + +2004-09-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplicationFactory.cs: + * HttpRuntime.cs: implemented UnloadAppDomain and be ready for domain + unloading. + +2004-09-12 Ben Maurer <bmaurer@ximian.com> + + * HttpContext.cs: use CallContext. It is a little bit faster. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpStaticObjectsCollection.cs: don't share static session objects + declared in the application file across the application, but on a + per-session basis. Fixes bug #65446. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpServerUtility.cs: in Transfer(path), don't keep form data if + the transfer is done from inside a page that received a postback. + Fixes bug #65613. + +2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpValueCollection.cs: fixed signature of ToString (). Closes bug + #65392. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplication.cs: only add/remove to/from the timeout + manager when we're in a interruptible step. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceContext.cs: when IsEnabled has not been set, return the value + from the TraceManager. Fixes bug #63469. + +2004-08-31 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpRuntime.cs: initialize the response writer when finishing a + request because it cannot be queued. Under heavy load we made new + requests be processed before the ones that might be queued. This is + no longer the case. + + * QueueManager.cs: instead of queueing/dequeuing separately, we now + have a single method that does everything needed to decide which one + will be the next request processed. + +2004-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpRuntime.cs: removed initializations to null in .cctor. Prevent + other requests from avoiding the lock if they are received before the + configuration system is inited. Ensure that the queue manager is not + null before using it (it can be null while the first request is being + processed). + +2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpServerUtility.cs: ensure we have a full virtual path for the + request being executed. + +2004-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplication.cs: the file not found might be a dependency. + +2004-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpCookie.cs: use invariant when formatting expires date. Fixes bug + #61690. + +2004-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplication.cs: don't keep the session around if we got it from + the context. Fixes bug #61232. + +2004-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpUtility.cs: fixed stupid bug in UrlDecode from bytes. Closes bug + #61181. + +2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceContext.cs: added internal HaveTrace property whose + value is true when the page has a Trace attribute. + 2004-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TraceData.cs: fixed <br> output. Closes bug #60181. diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs index 0f8aaa3759b..91dfda2ae8d 100644 --- a/mcs/class/System.Web/System.Web/HttpApplication.cs +++ b/mcs/class/System.Web/System.Web/HttpApplication.cs @@ -639,6 +639,7 @@ namespace System.Web { bool ready_sync = false; IStateHandler handler; + bool timeoutPossible = false; lock (_app) { _app.OnStateExecuteEnter (); @@ -662,14 +663,25 @@ namespace System.Web handler = _handlers [_currentStateIdx]; _countSteps++; - lasterror = ExecuteState (handler, ref ready_sync); - if (ready_sync) - _countSyncSteps++; + timeoutPossible = handler.PossibleToTimeout; + try { + if (timeoutPossible) + HttpRuntime.TimeoutManager.Add (_app.Context); + + lasterror = ExecuteState (handler, ref ready_sync); + if (ready_sync) + _countSyncSteps++; + } finally { + if (timeoutPossible) + HttpRuntime.TimeoutManager.Remove (_app.Context); + } } while (ready_sync && _currentStateIdx < _endStateIdx); if (null != lasterror) _app.HandleError (lasterror); } finally { + + _app.OnStateExecuteLeave (); } } @@ -805,7 +817,12 @@ namespace System.Web return ret; } catch (DirectoryNotFoundException) { throw new HttpException (404, "Cannot find '" + file + "'."); - } catch (FileNotFoundException) { + } catch (FileNotFoundException fnf) { + string fname = fnf.FileName; + if (fname != null && fname != "") { + file = Path.GetFileName (fname); + } + throw new HttpException (404, "Cannot find '" + file + "'."); } } @@ -888,14 +905,12 @@ namespace System.Web SaveThreadCulture (); _savedContext = HttpContext.Context; HttpContext.Context = _Context; - HttpRuntime.TimeoutManager.Add (_Context); SetPrincipal (Context.User); } internal void OnStateExecuteLeave () { RestoreThreadCulture (); - HttpRuntime.TimeoutManager.Remove (_Context); HttpContext.Context = _savedContext; RestorePrincipal (); } @@ -1145,10 +1160,8 @@ namespace System.Web if (null != _Session) return _Session; - if (null != _Context && null != _Context.Session) { - _Session = _Context.Session; - return _Session; - } + if (null != _Context && null != _Context.Session) + return _Context.Session; throw new HttpException ("Failed to get session object"); } diff --git a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs index 65ce0a9f9e1..5882982564c 100644 --- a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs +++ b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs @@ -142,43 +142,39 @@ namespace System.Web { return appTypeEventHandlers;
}
-
- static bool FireEvents (string method_name, object target, object [] args)
- {
- Hashtable possibleEvents = GetApplicationTypeEvents ((HttpApplication) target);
- MethodInfo method = possibleEvents [method_name] as MethodInfo;
- if (method == null)
- return false;
-
- if (method.GetParameters ().Length == 0)
- method.Invoke (target, null);
- else
- method.Invoke (target, args);
-
- return true;
- }
-
+ + static bool FireEvent (string method_name, object target, object [] args) + { + Hashtable possibleEvents = GetApplicationTypeEvents ((HttpApplication) target); + MethodInfo method = possibleEvents [method_name] as MethodInfo; + if (method == null) + return false; + + if (method.GetParameters ().Length == 0) + method.Invoke (target, null); + else + method.Invoke (target, args); + + return true; + } + internal static void FireOnAppStart (HttpApplication app)
- {
+ { object [] args = new object [] {app, EventArgs.Empty};
- FireEvents ("Application_Start", app, args);
- }
-
- void FireOnAppEnd ()
- {
- // FireEvents ("Application_End", this, new object [] {this, EventArgs.Empty});
- }
-
- void FireOnSessionStart (HttpSessionState state, object source, EventArgs args)
- {
- // FireEvents ("Session_Start", state, new object [] {source, EventArgs.Empty});
- }
-
- void FireOnSessionEnd (HttpSessionState state, object source, EventArgs args)
- {
- // FireEvents ("Session_End", state, new object [] {source, args});
- }
-
+ FireEvent ("Application_Start", app, args);
+ } + + void FireOnAppEnd () + { + if (_appType == null) + return; // we didn't even get an application + + HttpApplication app = (HttpApplication) HttpRuntime.CreateInternalObject (_appType); + AttachEvents (app); + FireEvent ("Application_End", app, new object [] {this, EventArgs.Empty}); + app.Dispose (); + } + private void InitializeFactory (HttpContext context)
{
_appFilename = GetAppFilename (context);
diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs index 8ffb184383e..4d28af400ad 100644 --- a/mcs/class/System.Web/System.Web/HttpContext.cs +++ b/mcs/class/System.Web/System.Web/HttpContext.cs @@ -38,6 +38,7 @@ using System.Web.Configuration; using System.Web.Util; using System.Web.SessionState; using System.Threading; +using System.Runtime.Remoting.Messaging; namespace System.Web { @@ -96,15 +97,14 @@ namespace System.Web } } - [MonoTODO("Context - Use System.Remoting.Messaging.CallContext instead of Thread storage")] internal static HttpContext Context { get { - return (HttpContext) Thread.GetData (Thread.GetNamedDataSlot ("Context")); + return (HttpContext) CallContext.GetData ("Context"); } set { - Thread.SetData (Thread.GetNamedDataSlot ("Context"), value); + CallContext.SetData ("Context", value); } } @@ -287,7 +287,7 @@ namespace System.Web internal void BeginTimeoutPossible () { timeoutPossible = 1; - timeoutBegin = DateTime.Now.Ticks; + timeoutBegin = DateTime.UtcNow.Ticks; } internal void EndTimeoutPossible () @@ -403,7 +403,7 @@ namespace System.Web throw new HttpException (404, "The virtual path '" + path + "' maps to another application."); - Request.SetFilePath (path); + Request.SetCurrentExePath (path); Request.QueryStringRaw = query; } diff --git a/mcs/class/System.Web/System.Web/HttpCookie.cs b/mcs/class/System.Web/System.Web/HttpCookie.cs index 32fdf84261b..c121772be1b 100644 --- a/mcs/class/System.Web/System.Web/HttpCookie.cs +++ b/mcs/class/System.Web/System.Web/HttpCookie.cs @@ -26,6 +26,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; +using System.Globalization; using System.Text; using System.Web; using System.Collections.Specialized; @@ -98,7 +99,9 @@ namespace System.Web if (_ExpiresSet && _Expires != DateTime.MinValue) { oSetCookie.Append ("; expires="); - oSetCookie.Append (_Expires.ToUniversalTime ().ToString ("ddd, dd-MMM-yyyy HH':'mm':'ss '+0000'")); + DateTime ut = _Expires.ToUniversalTime (); + oSetCookie.Append (ut.ToString ("ddd, dd-MMM-yyyy HH':'mm':'ss 'GMT'", + DateTimeFormatInfo.InvariantInfo)); } if (_Secure) diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs index 5b1cbef349c..48140d4c1f9 100644 --- a/mcs/class/System.Web/System.Web/HttpRequest.cs +++ b/mcs/class/System.Web/System.Web/HttpRequest.cs @@ -88,6 +88,7 @@ namespace System.Web { Stream userFilter; HttpRequestStream requestFilter; string clientTarget; + string currentExePath; #if NET_1_1 bool validateCookies; bool validateForm; @@ -503,6 +504,9 @@ namespace System.Web { public string CurrentExecutionFilePath { get { + if (currentExePath != null) + return currentExePath; + return FilePath; } } @@ -1139,9 +1143,9 @@ namespace System.Web { } #endif - internal void SetFilePath (string filePath) + internal void SetCurrentExePath (string filePath) { - _sFilePath = filePath; + currentExePath = filePath; _sRequestRootVirtualDir = null; baseVirtualDir = null; } diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs index 45128ce4415..fa8c2892af8 100644 --- a/mcs/class/System.Web/System.Web/HttpResponse.cs +++ b/mcs/class/System.Web/System.Web/HttpResponse.cs @@ -190,7 +190,7 @@ namespace System.Web CultureInfo oSavedInfo = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - string date = DateTime.Now.ToUniversalTime ().ToString ("ddd, d MMM yyyy HH:mm:ss "); + string date = DateTime.UtcNow.ToString ("ddd, d MMM yyyy HH:mm:ss "); HttpResponseHeader date_header = new HttpResponseHeader ("Date", date + "GMT"); oHeaders.Add (date_header); @@ -618,9 +618,6 @@ namespace System.Web } set { - if (_bHeadersSent) - throw new HttpException ("Headers has been sent to the client"); - _bSuppressContent = true; } } @@ -846,6 +843,9 @@ namespace System.Web if (!_bSuppressContent && Request.HttpMethod == "HEAD") _bSuppressContent = true; + if (_bSuppressContent) + _Writer.Clear (); + if (!_bSuppressContent) { _bClientDisconnected = false; if (_bChunked) { diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs index f48797c3815..da23b53407b 100644 --- a/mcs/class/System.Web/System.Web/HttpRuntime.cs +++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs @@ -61,11 +61,10 @@ namespace System.Web { private int _activeRequests; private HttpWorkerRequest.EndOfSendNotification _endOfSendCallback; private AsyncCallback _handlerCallback; - private WaitCallback _appDomainCallback; + private WaitCallback unloadDomainCallback; private bool _firstRequestStarted; private bool _firstRequestExecuted; - private DateTime _firstRequestStartTime; private Exception _initError; private TimeoutManager timeoutManager; @@ -76,12 +75,6 @@ namespace System.Web { static HttpRuntime () { - appPathDiscoveryStackWalk = null; - ctrlPrincipalStackWalk = null; - sensitiveInfoStackWalk = null; - unmgdCodeStackWalk = null; - unrestrictedStackWalk = null; - _runtime = new HttpRuntime (); _runtime.Init(); } @@ -101,9 +94,10 @@ namespace System.Web { _cache = new Cache (); timeoutManager = new TimeoutManager (); - _endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification(OnEndOfSend); - _handlerCallback = new AsyncCallback(OnHandlerReady); - _appDomainCallback = new WaitCallback(OnAppDomainUnload); + _endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification (OnEndOfSend); + _handlerCallback = new AsyncCallback (OnHandlerReady); + unloadDomainCallback = new WaitCallback (DoUnload); + AppDomain.CurrentDomain.DomainUnload += new EventHandler (OnDomainUnload); } catch (Exception error) { _initError = error; @@ -185,6 +179,8 @@ namespace System.Web { context.Response.FinalFlush (); } + /* + * This is not being used. OnFirstRequestEnd is empty. if (!_firstRequestExecuted) { lock (this) { if (!_firstRequestExecuted) { @@ -193,6 +189,7 @@ namespace System.Web { } } } + */ Interlocked.Decrement(ref _activeRequests); @@ -237,20 +234,33 @@ namespace System.Web { HttpContext context = new HttpContext (wr); HttpException exception = new HttpException (503, "Service unavailable"); Interlocked.Increment (ref _runtime._activeRequests); + context.Response.InitializeWriter (); _runtime.FinishRequest (context, exception); } - private void OnAppDomainUnload(object state) { - Dispose(); + void DoUnload (object state) + { + AppDomain.Unload (AppDomain.CurrentDomain); } internal void Dispose() { - WaitForRequests(5000); + WaitForRequests (2000); queueManager.Dispose (); // Send a 503 to all queued requests queueManager = null; _cache = null; - HttpApplicationFactory.EndApplication(); + HttpApplicationFactory.EndApplication (); + } + + void OnDomainUnload (object o, EventArgs args) + { + HttpApplicationFactory.EndApplication (); + } + + internal void ByeByeDomain () + { + HttpApplicationFactory.EndApplication (); + ThreadPool.QueueUserWorkItem (unloadDomainCallback); } internal void WaitForRequests(int ms) { @@ -279,10 +289,9 @@ namespace System.Web { if (!_firstRequestStarted) { lock (this) { if (!_firstRequestStarted) { - _firstRequestStarted = true; - _firstRequestStartTime = DateTime.Now; OnFirstRequestStart(context); - } + _firstRequestStarted = true; + } } } @@ -317,44 +326,38 @@ namespace System.Web { void TryExecuteQueuedRequests () { // Wait for pending jobs to start - if (Interlocked.CompareExchange (ref pendingCallbacks, 3, 3) == 3) { + if (Interlocked.CompareExchange (ref pendingCallbacks, 3, 3) >= 3) return; - } - - if (queueManager == null) - return; - - if (!queueManager.CanExecuteRequest (false)) { - return; - } - HttpWorkerRequest wr = queueManager.Dequeue (); - if (wr == null) { + HttpWorkerRequest wr = queueManager.GetNextRequest (null); + if (wr == null) return; - } Interlocked.Increment (ref pendingCallbacks); ThreadPool.QueueUserWorkItem (doRequestCallback, wr); TryExecuteQueuedRequests (); } - public static void ProcessRequest (HttpWorkerRequest Request) + public static void ProcessRequest (HttpWorkerRequest request) { - if (Request == null) - throw new ArgumentNullException ("Request"); - - if (!_runtime._firstRequestExecuted || _runtime.queueManager.CanExecuteRequest (false)) { - _runtime.InternalExecuteRequest (Request); - } else { - _runtime.queueManager.Queue (Request); + if (request == null) + throw new ArgumentNullException ("request"); + + QueueManager mgr = _runtime.queueManager; + if (_runtime._firstRequestStarted && mgr != null) { + request = mgr.GetNextRequest (request); + // We're busy, return immediately + if (request == null) + return; } + + _runtime.InternalExecuteRequest (request); } #if NET_1_1 - [MonoTODO] - public void UnloadAppDomain () + public static void UnloadAppDomain () { - throw new NotImplementedException (); + _runtime.ByeByeDomain (); } #endif public static Cache Cache { @@ -451,7 +454,7 @@ namespace System.Web { public static void Close () { - _runtime.Dispose(); + _runtime.Dispose (); } internal static string FormatResourceString (string key) @@ -507,7 +510,7 @@ namespace System.Web { [MonoTODO ("GetResourceStringFromResourceManager (string)")] private string GetResourceStringFromResourceManager (string key) { - return "String returned by HttpRuntime.GetResourceStringFromResourceManager"; + return key; } #region Security Internal Methods (not impl) diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs index 5fb510baf46..86c925de04b 100644 --- a/mcs/class/System.Web/System.Web/HttpServerUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs @@ -46,6 +46,8 @@ using System.Collections.Specialized; using System.IO; using System.Text; using System.Web.Hosting; +using System.Web.UI; +using System.Web.Util; namespace System.Web { @@ -190,19 +192,26 @@ namespace System.Web } else { query = ""; } - - string filePath = _Context.Request.MapPath (path); + + HttpRequest request = _Context.Request; HttpResponse response = _Context.Response; + + string oldQuery = request.QueryStringRaw; + request.QueryStringRaw = query; + + HttpValueCollection oldForm = null; + if (!preserveQuery) { + oldForm = _Context.Request.Form as HttpValueCollection; + _Context.Request.SetForm (new HttpValueCollection ()); + } + + string filePath = _Context.Request.MapPath (path); TextWriter output = writer; if (output == null) output = response.Output; - HttpRequest request = _Context.Request; string oldFilePath = request.FilePath; - request.SetFilePath (path); - string oldQuery = request.QueryStringRaw; - - if (!preserveQuery) request.QueryStringRaw = query; + request.SetCurrentExePath (UrlUtils.Combine (_Context.Request.BaseVirtualDir, path)); IHttpHandler handler = _Context.ApplicationInstance.CreateHttpHandler (_Context, request.RequestType, path, @@ -219,9 +228,11 @@ namespace System.Web asyncHandler.EndProcessRequest (ar); } } finally { - request.SetFilePath (oldFilePath); + request.SetCurrentExePath (oldFilePath); request.QueryStringRaw = oldQuery; response.SetTextWriter (previous); + if (!preserveQuery) + _Context.Request.SetForm (oldForm); } } @@ -302,7 +313,15 @@ namespace System.Web /// <param name="path">The URL path of the new page on the server to execute. </param> public void Transfer (string path) { - Transfer (path, true); + // If it's a page and a postback, don't pass form data + // See bug #65613. + bool preserveForm = true; + if (_Context.Handler is Page) { + Page page = (Page) _Context.Handler; + preserveForm = !page.IsPostBack; + } + + Transfer (path, preserveForm); } /// <summary> @@ -314,16 +333,7 @@ namespace System.Web /// they are cleared. The default is false. </param> public void Transfer (string path, bool preserveForm) { - HttpValueCollection oldForm = null; - if (!preserveForm) { - oldForm = _Context.Request.Form as HttpValueCollection; - _Context.Request.SetForm (new HttpValueCollection ()); - } - Execute (path, null, preserveForm); - if (!preserveForm) - _Context.Request.SetForm (oldForm); - _Context.Response.End (); } diff --git a/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs index 46d7c129396..873da72de7c 100644 --- a/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs +++ b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs @@ -37,6 +37,11 @@ namespace System.Web { this.type = type; } + public StaticItem (StaticItem item) + { + this.type = item.type; + } + public object Instance { get { lock (this) { @@ -101,6 +106,18 @@ namespace System.Web { get { return this; } } + internal HttpStaticObjectsCollection Clone () + { + HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection (); + coll._Objects = new Hashtable (); + foreach (string key in _Objects.Keys) { + StaticItem item = new StaticItem ((StaticItem) _Objects [key]); + coll._Objects [key] = item; + } + + return coll; + } + internal void Add (ObjectTagBuilder tag) { _Objects.Add (tag.ObjectID, new StaticItem (tag.Type)); diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs index d70b32d8f92..c7f3fecf63b 100644 --- a/mcs/class/System.Web/System.Web/HttpUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpUtility.cs @@ -444,7 +444,7 @@ namespace System.Web { int value = 0;
int end = length + offset;
for (int i = offset; i < end; i++)
- value = (value << 4) + GetInt (bytes [offset]);
+ value = (value << 4) + GetInt (bytes [i]);
return (char) value;
}
@@ -474,10 +474,10 @@ namespace System.Web { output.Append (GetChars (acc, e));
acc.SetLength (0);
}
- output.Append (GetChar (bytes, offset + 2, 4));
+ output.Append (GetChar (bytes, i + 2, 4));
i += 5;
} else {
- acc.WriteByte ((byte) GetChar (bytes, offset + 1, 2));
+ acc.WriteByte ((byte) GetChar (bytes, i + 1, 2));
i += 2;
}
continue;
@@ -829,7 +829,7 @@ namespace System.Web { }
#if NET_1_1
- public string UrlPathEncode (string s)
+ public static string UrlPathEncode (string s)
{
if (s == null)
return null;
diff --git a/mcs/class/System.Web/System.Web/HttpValueCollection.cs b/mcs/class/System.Web/System.Web/HttpValueCollection.cs index 946b8542d46..e8ba4e3a0db 100644 --- a/mcs/class/System.Web/System.Web/HttpValueCollection.cs +++ b/mcs/class/System.Web/System.Web/HttpValueCollection.cs @@ -211,7 +211,7 @@ namespace System.Web return result.ToString (); } - virtual new public string ToString () + public override string ToString () { return ToString (false); } diff --git a/mcs/class/System.Web/System.Web/QueueManager.cs b/mcs/class/System.Web/System.Web/QueueManager.cs index a3f8f621d90..29ec8a91cc4 100644 --- a/mcs/class/System.Web/System.Web/QueueManager.cs +++ b/mcs/class/System.Web/System.Web/QueueManager.cs @@ -4,7 +4,7 @@ // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) // -// (C) 2003 Novell, Inc (http://www.novell.com) +// (C) 2003,2004 Novell, Inc (http://www.novell.com) // // @@ -53,35 +53,57 @@ namespace System.Web queue = new Queue (queueLimit); } - // TODO: handle local connections - public bool CanExecuteRequest (bool local) + // TODO: handle local connections, just check for 127.0.0.1 + bool CanExecuteRequest () { if (disposing) return false; int threads, cports; ThreadPool.GetAvailableThreads (out threads, out cports); - return (threads > minFree) || (local && threads > minLocalFree); + return (threads > minFree); // || (local && threads > minLocalFree); } - - public void Queue (HttpWorkerRequest wr) + + public HttpWorkerRequest GetNextRequest (HttpWorkerRequest req) { + if (!CanExecuteRequest ()) { + if (req != null) { + lock (queue) { + Queue (req); + } + } + + return null; + } + + HttpWorkerRequest result; lock (queue) { - if (queue.Count < queueLimit) { - queue.Enqueue (wr); - return; + result = Dequeue (); + if (result != null) { + if (req != null) + Queue (req); + } else { + result = req; } } + return result; + } + + void Queue (HttpWorkerRequest wr) + { + if (queue.Count < queueLimit) { + queue.Enqueue (wr); + return; + } + HttpRuntime.FinishUnavailable (wr); } - public HttpWorkerRequest Dequeue () + HttpWorkerRequest Dequeue () { - lock (queue) { - if (queue.Count > 0) - return (HttpWorkerRequest) queue.Dequeue (); - } + if (queue.Count > 0) + return (HttpWorkerRequest) queue.Dequeue (); return null; } @@ -93,7 +115,7 @@ namespace System.Web disposing = true; HttpWorkerRequest wr; - while ((wr = Dequeue ()) != null) + while ((wr = GetNextRequest (null)) != null) HttpRuntime.FinishUnavailable (wr); queue = null; diff --git a/mcs/class/System.Web/System.Web/TimeoutManager.cs b/mcs/class/System.Web/System.Web/TimeoutManager.cs index d686568cc88..2fbdd35e3f6 100644 --- a/mcs/class/System.Web/System.Web/TimeoutManager.cs +++ b/mcs/class/System.Web/System.Web/TimeoutManager.cs @@ -106,7 +106,7 @@ namespace System.Web return; } - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; ArrayList clist = new ArrayList (); lock (this) { // The lock prevents Keys enumerator from being out of synch diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs index 6d7a7c68608..efa37b06471 100644 --- a/mcs/class/System.Web/System.Web/TraceContext.cs +++ b/mcs/class/System.Web/System.Web/TraceContext.cs @@ -42,20 +42,31 @@ namespace System.Web { private TraceMode _Mode;
private TraceData data;
private bool data_saved;
+ private bool _haveTrace; public TraceContext(HttpContext Context) {
_Context = Context;
_Enabled = false;
}
+ + + internal bool HaveTrace { + get { + return _haveTrace; + } + } public bool IsEnabled {
get {
+ if (!_haveTrace) + return HttpRuntime.TraceManager.Enabled; return _Enabled;
}
set {
if (value && data == null)
data = new TraceData ();
+ _haveTrace = true; _Enabled = value;
}
}
@@ -95,7 +106,7 @@ namespace System.Web { }
private void Write(string category, string msg, Exception error, bool Warning) {
- if (!_Enabled)
+ if (!IsEnabled)
return;
if (data == null)
data = new TraceData ();
@@ -107,7 +118,9 @@ namespace System.Web { if (data == null)
data = new TraceData ();
SetRequestDetails ();
- data.AddControlTree ((Page) _Context.Handler);
+ if (_Context.Handler is Page) + data.AddControlTree ((Page) _Context.Handler); + AddCookies ();
AddHeaders ();
AddServerVars ();
|