Author: gert
Date: 2007-10-31 02:57:03 -0500 (Wed, 31 Oct 2007)
New Revision: 88538

Added:
   trunk/gert/standalone/bug337997/
   trunk/gert/standalone/bug337997/default.build
   trunk/gert/standalone/bug337997/test.cs
   trunk/gert/standalone/bug337997/web/
   trunk/gert/standalone/bug337997/web/App_Code/
   trunk/gert/standalone/bug337997/web/App_Code/ViewSourceHandler.cs
   trunk/gert/standalone/bug337997/web/GetPages.ashx
   trunk/gert/standalone/bug337997/web/GetPages.ashx.cs
   trunk/gert/standalone/bug337997/web/ViewSource.ashx
Modified:
   trunk/gert/standalone/known-issues
Log:
Added test for bug #337997.


Added: trunk/gert/standalone/bug337997/default.build
===================================================================
--- trunk/gert/standalone/bug337997/default.build       2007-10-31 07:39:02 UTC 
(rev 88537)
+++ trunk/gert/standalone/bug337997/default.build       2007-10-31 07:57:03 UTC 
(rev 88538)
@@ -0,0 +1,85 @@
+<project name="bug337997" default="rebuild">
+       <target name="mono-1.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+               <property name="xsp.package" value="xsp" />
+       </target>
+
+       <target name="mono-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0,MONO" />
+               <property name="xsp.package" value="xsp-2" />
+       </target>
+
+       <target name="net-1.1">
+               <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+               <property name="xsp.package" value="xsp" />
+       </target>
+
+       <target name="net-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" />
+               <property name="xsp.package" value="xsp-2" />
+       </target>
+
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="web/bin/**" />
+                               <include name="out" />
+                               <include name="test.exe" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="build">
+               <property name="original.targetframework" 
value="${nant.settings.currentframework}" />
+
+               <foreach property="framework" item="String" in="${frameworks}" 
delim=",">
+                       <if test="${framework::exists(framework)}">
+                               <property name="nant.settings.currentframework" 
value="${framework}" />
+                               <call 
target="${nant.settings.currentframework}" />
+                               <call target="run" />
+                               <call target="clean" />
+                       </if>
+               </foreach>
+
+               <property name="nant.settings.currentframework" 
value="${original.targetframework}" />
+       </target>
+
+       <target name="compile">
+               <mkdir dir="web/bin" />
+               <csc target="library" define="${csc.defines}" 
output="web/bin/Mono.Web.dll" warnaserror="true" warninglevel="4">
+                       <sources basedir="web">
+                               <include name="GetPages.ashx.cs" />
+                               <include name="ViewSource.ashx.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Web.dll" />
+                       </references>
+               </csc>
+               <csc target="exe" define="${csc.defines}" output="test.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="test.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Web.dll" />
+                       </references>
+               </csc>
+       </target>
+
+       <target name="run" depends="compile">
+               <exec 
program="${pkg-config::get-variable(xsp.package,'Executable')}" managed="true" 
spawn="true" pidproperty="server.pid">
+                       <arg value="--root" />
+                       <arg dir="web" />
+                       <arg value="--port" />
+                       <arg value="8081" />
+               </exec>
+               <sleep milliseconds="1000" />
+               <exec program="test.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}" />
+               <kill pid="${server.pid}" />
+               <sleep milliseconds="1000" />
+       </target>
+
+       <target name="rebuild" depends="clean, build" />
+</project>


Property changes on: trunk/gert/standalone/bug337997/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug337997/test.cs
===================================================================
--- trunk/gert/standalone/bug337997/test.cs     2007-10-31 07:39:02 UTC (rev 
88537)
+++ trunk/gert/standalone/bug337997/test.cs     2007-10-31 07:57:03 UTC (rev 
88538)
@@ -0,0 +1,56 @@
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Web.UI;
+
+class Program
+{
+       static int Main ()
+       {
+               HttpWebRequest request = (HttpWebRequest) WebRequest.Create 
("http://localhost:8081/GetPages.ashx";);
+               request.Method = "GET";
+
+               try {
+                       HttpWebResponse response = (HttpWebResponse) 
request.GetResponse ();
+                       using (StreamReader sr = new StreamReader 
(response.GetResponseStream (), Encoding.UTF8, true)) {
+                               string result = sr.ReadToEnd ();
+                               if (result != "Test") {
+                                       Console.WriteLine (result);
+                                       return 1;
+                               }
+                       }
+                       response.Close ();
+               } catch (WebException ex) {
+                       if (ex.Response != null) {
+                               StreamReader sr = new StreamReader 
(ex.Response.GetResponseStream ());
+                               Console.WriteLine (sr.ReadToEnd ());
+                       }
+                       return 2;
+               }
+
+#if NET_2_0
+               request = (HttpWebRequest) WebRequest.Create 
("http://localhost:8081/ViewSource.ashx";);
+
+               try {
+                       HttpWebResponse response = (HttpWebResponse) 
request.GetResponse ();
+                       using (StreamReader sr = new StreamReader 
(response.GetResponseStream (), Encoding.UTF8, true)) {
+                               string result = sr.ReadToEnd ();
+                               if (result != "Source") {
+                                       Console.WriteLine (result);
+                                       return 3;
+                               }
+                       }
+                       response.Close ();
+               } catch (WebException ex) {
+                       if (ex.Response != null) {
+                               StreamReader sr = new StreamReader 
(ex.Response.GetResponseStream ());
+                               Console.WriteLine (sr.ReadToEnd ());
+                       }
+                       return 4;
+               }
+#endif
+
+               return 0;
+       }
+}


Property changes on: trunk/gert/standalone/bug337997/test.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug337997/web/App_Code/ViewSourceHandler.cs
===================================================================
--- trunk/gert/standalone/bug337997/web/App_Code/ViewSourceHandler.cs   
2007-10-31 07:39:02 UTC (rev 88537)
+++ trunk/gert/standalone/bug337997/web/App_Code/ViewSourceHandler.cs   
2007-10-31 07:57:03 UTC (rev 88538)
@@ -0,0 +1,19 @@
+using System;
+using System.Web;
+
+namespace OfflinePages
+{
+       public class ViewSource : IHttpHandler
+       {
+               public virtual void ProcessRequest (HttpContext context)
+               {
+                       context.Response.Clear ();
+                       context.Response.Write ("Source");
+                       context.Response.End ();
+               }
+
+               public bool IsReusable {
+                       get { return false; }
+               }
+       }
+}


Property changes on: 
trunk/gert/standalone/bug337997/web/App_Code/ViewSourceHandler.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug337997/web/GetPages.ashx
===================================================================
--- trunk/gert/standalone/bug337997/web/GetPages.ashx   2007-10-31 07:39:02 UTC 
(rev 88537)
+++ trunk/gert/standalone/bug337997/web/GetPages.ashx   2007-10-31 07:57:03 UTC 
(rev 88538)
@@ -0,0 +1 @@
+<<%@ WebHandler Language="C#" Class="OfflinePages.GetPages" %>

Added: trunk/gert/standalone/bug337997/web/GetPages.ashx.cs
===================================================================
--- trunk/gert/standalone/bug337997/web/GetPages.ashx.cs        2007-10-31 
07:39:02 UTC (rev 88537)
+++ trunk/gert/standalone/bug337997/web/GetPages.ashx.cs        2007-10-31 
07:57:03 UTC (rev 88538)
@@ -0,0 +1,19 @@
+using System;
+using System.Web;
+
+namespace OfflinePages
+{
+       public class GetPages : IHttpHandler
+       {
+               public virtual void ProcessRequest (HttpContext context)
+               {
+                       context.Response.Clear ();
+                       context.Response.Write ("Test");
+                       context.Response.End ();
+               }
+
+               public bool IsReusable {
+                       get { return false; }
+               }
+       }
+}


Property changes on: trunk/gert/standalone/bug337997/web/GetPages.ashx.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug337997/web/ViewSource.ashx
===================================================================
--- trunk/gert/standalone/bug337997/web/ViewSource.ashx 2007-10-31 07:39:02 UTC 
(rev 88537)
+++ trunk/gert/standalone/bug337997/web/ViewSource.ashx 2007-10-31 07:57:03 UTC 
(rev 88538)
@@ -0,0 +1 @@
+<<%@ WebHandler Language="C#" CodeBehind="ViewSource.ashx.cs" 
Class="OfflinePages.ViewSource" %>

Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues  2007-10-31 07:39:02 UTC (rev 88537)
+++ trunk/gert/standalone/known-issues  2007-10-31 07:57:03 UTC (rev 88538)
@@ -103,3 +103,4 @@
 bug335011/**
 bug335329/**
 bug335488/**
+bug337997/**

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to