[wwwsearch-commits] r21973 - wwwsearch/ClientCookie/trunk
jjlee at codespeak.net
jjlee at codespeak.net
Wed Jan 11 20:44:22 CET 2006
Author: jjlee
Date: Wed Jan 11 20:44:21 2006
New Revision: 21973
Added:
wwwsearch/ClientCookie/trunk/cookietest.cgi (contents, props changed)
Log:
Add cookietest.cgi -- the script that's used on wwwsearch.sf.net by one of the functional tests
Added: wwwsearch/ClientCookie/trunk/cookietest.cgi
==============================================================================
--- (empty file)
+++ wwwsearch/ClientCookie/trunk/cookietest.cgi Wed Jan 11 20:44:21 2006
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+# -*-python-*-
+
+# The copy of this script that lives at wwwsearch.sf.net is used by the
+# ClientCookie functional tests.
+
+print "Content-Type: text/html"
+print "Set-Cookie: foo=bar\n"
+import sys, os, string, cgi, Cookie
+
+from types import ListType
+
+print "<html><head><title>Cookies and form submission parameters</title>"
+cookie = Cookie.SimpleCookie()
+cookieHdr = os.environ.get("HTTP_COOKIE", "")
+cookie.load(cookieHdr)
+if not cookie.has_key("foo"):
+ print '<meta http-equiv="refresh" content="5">'
+print "</head>"
+print "<p>Received cookies:</p>"
+print "<pre>"
+print cgi.escape(os.environ.get("HTTP_COOKIE", ""))
+print "</pre>"
+if cookie.has_key("foo"):
+ print "Your browser supports cookies!"
+form = cgi.FieldStorage()
+print "<p>Received parameters:</p>"
+print "<pre>"
+for k in form.keys():
+ v = form[k]
+ if isinstance(v, ListType):
+ vs = []
+ for item in v:
+ vs.append(item.value)
+ text = string.join(vs, ", ")
+ else:
+ text = v.value
+ print "%s: %s" % (cgi.escape(k), cgi.escape(text))
+print "</pre></html>"
More information about the wwwsearch-commits
mailing list