[Mono-bugs] [Bug 71587][Maj] Changed - Cannot access HttpWorkerRequest from HttpModule

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 21 Jan 2005 19:18:56 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gonzalo@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=71587

--- shadow/71587	2005-01-21 18:22:22.000000000 -0500
+++ shadow/71587.tmp.11277	2005-01-21 19:18:56.000000000 -0500
@@ -1,13 +1,13 @@
 Bug#: 71587
 Product: Mono: Class Libraries
 Version: unspecified
 OS: other
 OS Details: Gentoo Linux on Kernel 2.6.9
-Status: ASSIGNED   
-Resolution: 
+Status: RESOLVED   
+Resolution: NOTABUG
 Severity: Unknown
 Priority: Major
 Component: Sys.Web
 AssignedTo: gonzalo@ximian.com                            
 ReportedBy: wweems@gmail.com               
 QAContact: mono-bugs@ximian.com
@@ -49,6 +49,56 @@
 ------- Additional Comments From vargaz@gmail.com  2005-01-21 17:28 -------
 -> System.Web
 
 ------- Additional Comments From gonzalo@ximian.com  2005-01-21 18:22 -------
 The first problem in order to make this work seems to be in xsp, as it
 fails with xsp on MS runtime.
+
+------- Additional Comments From gonzalo@ximian.com  2005-01-21 19:18 -------
+Nope, the problem is in SlickUpload code. They are using a
+non-portable way of getting the maximum request length (which, btw,
+should be checked by HttpRequest, so they don't need to bother).
+
+The offending lines are in HttpUploadModule.cs. I'm pasting here:
+----
+int GetMaxRequestLength(HttpContext context)
+		{
+			//get
+			//{
+				object httpRuntimeConfig =
+context.GetConfig("system.web/httpRuntime");
+
+				Type configType = httpRuntimeConfig.GetType();
+
+				if (configType != null)
+				{
+					PropertyInfo propInfo =
+configType.GetProperty("MaxRequestLength", BindingFlags.Instance |
+BindingFlags.NonPublic);
+
+					if (propInfo != null)
+					{
+						return (int)propInfo.GetValue(httpRuntimeConfig, null);
+					}
+				}
+				/*try
+				{
+					string maxRequestLength =
+ConfigurationSettings.AppSettings["maxRequestLength"];
+
+					return int.Parse(maxRequestLength);
+				}
+				catch
+				{*/
+					// Not found for some reason
+					return -1;
+				//}
+			//}
+		}
+
+----
+
+As you can see they're blindly looking for a property in an object
+whose type is undocumented. It's their fault.
+
+When they cannot get that and return a -1, the connection is closed.
+