You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2017/04/13 07:37:14 UTC

svn commit: r1791219 - /httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py

Author: icing
Date: Thu Apr 13 07:37:14 2017
New Revision: 1791219

URL: http://svn.apache.org/viewvc?rev=1791219&view=rev
Log:
prep adding more response header tests

Added:
    httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py

Added: httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py?rev=1791219&view=auto
==============================================================================
--- httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py (added)
+++ httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py Thu Apr 13 07:37:14 2017
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+import cgi, os
+import cgitb; cgitb.enable()
+
+status = '200 Ok'
+
+try:
+    form = cgi.FieldStorage()
+    
+    # A nested FieldStorage instance holds the file
+    name = form['name']
+    value = form['value']
+    
+    # Test if the file was uploaded
+    if name.value:
+        print "Status: 200"
+        print """%s: %s""" % (name.value, value.value,)
+        print """\
+Content-Type: text/plain\n"""
+
+    else:
+        print "Status: 400 Parameter Missing"
+        print """\
+Content-Type: text/html\n
+    <html><body>
+    <p>No name and value was specified: %s %s</p>
+    </body></html>""" % (name.value, value.value)
+
+except KeyError:
+    print "Status: 200 Ok"
+    print """\
+Content-Type: text/html\n
+    <html><body>
+    Echo <form method="POST" enctype="application/x-www-form-urlencoded">
+    <input type="text" name="name">
+    <input type="text" name="value">
+    <button type="submit">Echo</button></form>
+    </body></html>"""
+    pass
+