Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
TESTS = t1.aspx t2.aspx t3.aspx t4.aspx t5.aspx t6.aspx t7.aspx
TESTS2 = c1.aspx c2.aspx c3.aspx
#SERVER=quack
SERVER=lalo-office.boston.ximian.com
all: rtest.exe ctest.exe test
rtest.exe: rtest.cs
mcs rtest.cs
ctest.exe: ctest.cs
mcs ctest.cs
copy:
for i in $(TESTS) $(TESTS2); do cp $$i /q/web; done
test: local compare
compare:
@for i in $(TESTS) $(TESTS2); do \
if cmp $$i.expected $$i.result; then echo OK; else echo FAILED; exit 1; fi; \
if test -f $$i.oexpected; then \
if cmp $$i.oexpected $$i.oresult; then echo OK; else echo FAILED; exit 1; fi; fi \
done
local:
@for i in $(TESTS); do \
echo running test $$i; \
mono rtest.exe localhost 8080 /$$i > $$i.result; \
mono ctest.exe localhost 8080 /$$i > $$i.oresult; \
done
@for i in $(TESTS2); do \
echo running test $$i; \
mono rtest.exe -header Cache-Control: localhost 8080 /$$i > $$i.result; \
done
tw:
@for i in $(TESTS); do \
echo running test $$i; \
mono rtest.exe $(SERVER) 80 /test/$$i > $$i.expected; \
mono ctest.exe $(SERVER) 80 /test/$$i > $$i.oexpected; \
done
@for i in $(TESTS2); do \
echo running test $$i; \
mono rtest.exe -header Cache-Control: $(SERVER) 80 /test/$$i > $$i.expected; \
done

View File

@@ -0,0 +1,18 @@
File names:
tNNN.aspx contain the individual tests.
tNNN.expected contain the raw HTTP traffic that is expected
tNNN.oexpected contain the HTTP response.
Running the tests:
You must run an instance of xsp in this directory on a separate
terminal.
Then run `make'

View File

@@ -0,0 +1,8 @@
<% @Page Language="C#" %>
<%
// Response.Cache.SetNoServerCaching ();
// Response.Cache.SetCacheability (HttpCacheability.Server);
// Response.Write (Response.CacheControl);
Response.Cache.SetCacheability (HttpCacheability.NoCache);
%>

View File

@@ -0,0 +1 @@
Cache-Control: no-cache

View File

@@ -0,0 +1,4 @@
<% @Page Language="C#" %>
<%
Response.Cache.SetCacheability (HttpCacheability.Private);
%>

View File

@@ -0,0 +1 @@
Cache-Control: private

View File

@@ -0,0 +1,4 @@
<% @Page Language="C#" %>
<%
Response.Cache.SetCacheability (HttpCacheability.Public);
%>

View File

@@ -0,0 +1 @@
Cache-Control: public

View File

@@ -0,0 +1,25 @@
//
// This test program uses the Http client to fetch the contents
// of a request. As opposed to the rtest program, this one is
// used merely to compare the contents, not look at the traffic
// produced.
//
using System;
using System.IO;
using System.Net;
using System.Web;
class X {
static void Main (string [] args)
{
string url = String.Format ("http://{0}:{1}/{2}", args [0], args [1], args [2]);
HttpWebRequest web = (HttpWebRequest) WebRequest.Create (url);
Stream s = web.GetResponse ().GetResponseStream ();
StreamReader sr = new StreamReader (s);
Console.WriteLine (sr.ReadToEnd ());
}
}

View File

@@ -0,0 +1,92 @@
//
// Usage:
// rtest host port url
//
// This program dumps the results of the HTTP request without any HTTP
// headers
//
using System;
using System.Net;
using System.IO;
using System.Net.Sockets;
class X {
static NetworkStream ns;
static StreamWriter sw;
static StreamReader sr;
static TcpClient c;
static bool debug;
static bool headers;
static string header;
static void send (string s)
{
if (debug)
Console.WriteLine (s);
sw.Write (s);
sw.Flush ();
}
static void Main (string [] args)
{
int i = 0;
while (args [i].StartsWith ("-")){
if (args [i] == "-debug")
debug = true;
if (args [i] == "-headers")
headers = true;
if (args [i] == "-header")
header = args [++i];
i++;
}
c = new TcpClient (args [i], Int32.Parse (args [i+1]));
c.ReceiveTimeout = 1000;
ns = c.GetStream ();
sw = new StreamWriter (ns);
sr = new StreamReader (ns);
string host = args [i];
if (args [i+1] != "80")
host += ":" + args [i+1];
send (String.Format ("GET {0} HTTP/1.1\r\nHost: {1}\r\n\r\n", args [i+2], host));
MemoryStream ms = new MemoryStream ();
try {
byte [] buf = new byte [1024];
int n;
while ((n = ns.Read (buf, 0, 1024)) != 0){
ms.Write (buf, 0, n);
}
} catch {}
ms.Position = 0;
sr = new StreamReader (ms);
string s;
while ((s = sr.ReadLine ()) != null){
if (s == ""){
if (headers)
return;
string x = sr.ReadToEnd ();
Console.Write (x);
break;
} else {
if (debug || headers)
Console.WriteLine (s);
if (header != null && s.StartsWith (header)){
Console.WriteLine (s);
return;
}
}
}
}
}

View File

@@ -0,0 +1,14 @@
<% @Page Language="C#" %>
<%
//
// This test sets buffering to false and writes
// which should trigger a chunked response.
//
// This shuts down the connection at the end.
//
Response.Buffer = false;
Response.Output.Write ("hello");
Response.Close ();
%>

View File

@@ -0,0 +1,2 @@
5
hello

View File

@@ -0,0 +1 @@
hello

View File

@@ -0,0 +1,10 @@
<% @Page Language="C#" %>
<%
//
// This test sets buffering to false and writes
// which should trigger a chunked response
//
Response.Buffer = false;
Response.Output.Write ("hello");
%>

View File

@@ -0,0 +1,4 @@
5
hello
0

View File

@@ -0,0 +1 @@
hello

View File

@@ -0,0 +1,13 @@
<% @Page Language="C#" %>
<%
//
// This test forces chunked mode by calling flush
// Then writes 9 bytes in two separate calls, which
// should be sent as a single chunk
//
Response.Output.Write ("hello");
Response.Flush ();
Response.Output.Write ("world");
Response.Output.Write ("oops");
Response.Flush ();
%>

View File

@@ -0,0 +1,6 @@
5
hello
9
worldoops
0

View File

@@ -0,0 +1 @@
helloworldoops

View File

@@ -0,0 +1,10 @@
<% @Page Language="C#" %>
<%
Response.Output.Write ("hello");
Response.Flush ();
Response.Buffer = false;
Response.Output.Write ("world");
Response.Buffer = true;
Response.Output.Write ("oops");
Response.Flush ();
%>

Some files were not shown because too many files have changed in this diff Show More