#!/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 "
Received cookies:
" print ""
print cgi.escape(os.environ.get("HTTP_COOKIE", ""))
print ""
if cookie.has_key("foo"):
print "Your browser supports cookies!"
form = cgi.FieldStorage()
print "Received parameters:
" print ""
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 ""