From 382ede1d1ba0b7a52bd31723f1d092b8b47cf7f5 Mon Sep 17 00:00:00 2001 From: "gagan%netscape.com" Date: Fri, 7 Apr 2000 23:14:52 +0000 Subject: [PATCH] Some test changes to allow echoing requests at arbitrary locations in urlmap. You can now use ECHO [HTTPHeader] to display all headers (if HTTPHeader is not specified) or that header value as it came in the request. See /echo for an example. Not in build (a=leaf) --- netwerk/testserver/Makefile.in | 2 +- netwerk/testserver/ScriptFile.java | 22 ++++++++++++++++++++++ netwerk/testserver/docs/urlmap | 22 +++++++++++++++++++++- tools/testserver/Makefile.in | 2 +- tools/testserver/ScriptFile.java | 22 ++++++++++++++++++++++ tools/testserver/docs/urlmap | 22 +++++++++++++++++++++- 6 files changed, 88 insertions(+), 4 deletions(-) diff --git a/netwerk/testserver/Makefile.in b/netwerk/testserver/Makefile.in index 03302e1c613..f5cc5fc75ba 100644 --- a/netwerk/testserver/Makefile.in +++ b/netwerk/testserver/Makefile.in @@ -37,5 +37,5 @@ include $(topsrcdir)/config/rules.mk # Hack rule, this probably needs to be changed # to something official. Works on Solaris for me. -mcafee install:: - javac $(JSRCS) + javac -deprecation $(JSRCS) diff --git a/netwerk/testserver/ScriptFile.java b/netwerk/testserver/ScriptFile.java index 72df665d7c7..8637053bcc9 100644 --- a/netwerk/testserver/ScriptFile.java +++ b/netwerk/testserver/ScriptFile.java @@ -123,6 +123,28 @@ class ScriptFile { } } } + else if (s.startsWith("ECHO")) { + outDirty = true; + boolean parameter = false; + try { + String header = new String(s.substring(5)); + String req= new String(con.request); + int t = req.indexOf(header); + if (t != -1) { + out.println(req.substring( + t, req.indexOf("\n", t))); + parameter = true; + } + else { + out.println("Error: " + header + + " not specified in request!"); + } + + } + catch (StringIndexOutOfBoundsException e) {} + if (!parameter) + out.println(con.request); + } else if (s.startsWith("INCLUDE")) { outDirty = true; WriteOutFile("docs/" + s.substring(8)); diff --git a/netwerk/testserver/docs/urlmap b/netwerk/testserver/docs/urlmap index 44251bb1985..60295e5f541 100644 --- a/netwerk/testserver/docs/urlmap +++ b/netwerk/testserver/docs/urlmap @@ -120,7 +120,7 @@ CRLF END # -# +# Post example... # START /post INCLUDE generic.res @@ -129,3 +129,23 @@ CRLF INCLUDE post.html END +# +# Do other stuff with echoing the request as well... +# +START /echo +INCLUDE generic.res +Content-Type: text/html +CRLF + +

Echo request example

+
+This should echo all the request headers-
+
+ECHO
+
+
+This should echo only the user-agent header- (this is case sensitive!)
+
+ECHO User-Agent
+
+END diff --git a/tools/testserver/Makefile.in b/tools/testserver/Makefile.in index 03302e1c613..f5cc5fc75ba 100644 --- a/tools/testserver/Makefile.in +++ b/tools/testserver/Makefile.in @@ -37,5 +37,5 @@ include $(topsrcdir)/config/rules.mk # Hack rule, this probably needs to be changed # to something official. Works on Solaris for me. -mcafee install:: - javac $(JSRCS) + javac -deprecation $(JSRCS) diff --git a/tools/testserver/ScriptFile.java b/tools/testserver/ScriptFile.java index 72df665d7c7..8637053bcc9 100644 --- a/tools/testserver/ScriptFile.java +++ b/tools/testserver/ScriptFile.java @@ -123,6 +123,28 @@ class ScriptFile { } } } + else if (s.startsWith("ECHO")) { + outDirty = true; + boolean parameter = false; + try { + String header = new String(s.substring(5)); + String req= new String(con.request); + int t = req.indexOf(header); + if (t != -1) { + out.println(req.substring( + t, req.indexOf("\n", t))); + parameter = true; + } + else { + out.println("Error: " + header + + " not specified in request!"); + } + + } + catch (StringIndexOutOfBoundsException e) {} + if (!parameter) + out.println(con.request); + } else if (s.startsWith("INCLUDE")) { outDirty = true; WriteOutFile("docs/" + s.substring(8)); diff --git a/tools/testserver/docs/urlmap b/tools/testserver/docs/urlmap index 44251bb1985..60295e5f541 100644 --- a/tools/testserver/docs/urlmap +++ b/tools/testserver/docs/urlmap @@ -120,7 +120,7 @@ CRLF END # -# +# Post example... # START /post INCLUDE generic.res @@ -129,3 +129,23 @@ CRLF INCLUDE post.html END +# +# Do other stuff with echoing the request as well... +# +START /echo +INCLUDE generic.res +Content-Type: text/html +CRLF + +

Echo request example

+
+This should echo all the request headers-
+
+ECHO
+
+
+This should echo only the user-agent header- (this is case sensitive!)
+
+ECHO User-Agent
+
+END