Fix TTS-1980 by removing python dependency
authorwanmingx.lin <wanmingx.lin@intel.com>
Thu, 26 Sep 2013 10:26:18 +0000 (18:26 +0800)
committerLi, HaoX <haox.li@intel.com>
Tue, 8 Oct 2013 03:41:37 +0000 (11:41 +0800)
Signed-off-by: wanmingx.lin <wanmingx.lin@intel.com>
17 files changed:
tct-cors-w3c-tests/cors/support/cgi/cors_echo.php
tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-3.php [changed mode: 0644->0755]
tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-5.php [changed mode: 0644->0755]
tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-3.php [changed mode: 0644->0755]
tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-5.php [changed mode: 0644->0755]
tct-sse-w3c-tests/sse/w3c/resources/cgi/cors.php [deleted file]
tct-sse-w3c-tests/sse/w3c/resources/cgi/message.php
tct-sse-w3c-tests/sse/w3c/resources/cgi/reconnect-fail.php
tct-sse-w3c-tests/sse/w3c/resources/cgi/redirect.php
tct-sse-w3c-tests/sse/w3c/resources/cgi/status-error.php
tct-sse-w3c-tests/sse/w3c/resources/cgi/status-reconnect.php
tct-sse-w3c-tests/sse/w3c/resources/cors.php [deleted file]
tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/conditional.php [changed mode: 0755->0644]
tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/delay.php [changed mode: 0755->0644]
tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/inspect-headers.php [changed mode: 0755->0644]
tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/redirect.php [changed mode: 0755->0644]
tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/status.php [changed mode: 0755->0644]

index 378191e823047288195b8f622e8676a25db250fb..65fbe36e7e99965c0c68dadf6c6547dcb56fd5a0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
 
-import cgi
-import sys
-from os import environ
-
-fields = cgi.FieldStorage()
-msg = ""
-
-if fields.getvalue('message'):
-    msg = str(fields.getvalue('message'))
-
-print "Access-Control-Allow-Origin: %s" % environ.get("HTTP_ORIGIN", "")
-print "Cache-Control: no-cache"
-print "Content-Type: text/plain"
-print
-sys.stdout.write(msg)
+MSG=""
+if [ "$REQUEST_METHOD" = "GET" ]; then
+        val=`echo -n "$QUERY_STRING" | cgi-getfield message`
+elif [ "$REQUEST_METHOD" = "POST" ]; then
+        val=`cgi-getfield message $CONTENT_LENGTH`
+fi
+[ $? -eq 0 ] && MSG="$val"
+echo "Access-Control-Allow-Origin: $HTTP_ORIGIN"
+echo "Cache-Control: no-cache"
+echo "Content-Type: text/plain"
+echo
+echo -n $MSG
old mode 100644 (file)
new mode 100755 (executable)
index d87ac6a..b4ffe5c
@@ -1,12 +1,9 @@
-#!/usr/bin/python
-
-import cgi
-import os
-referer = os.getenv("HTTP_REFERER")
-pyrefer = referer.encode()
-print "Content-type: text/html"
-form = '''
-<!doctype html>
+#!/bin/sh
+#
+referer="$HTTP_REFERER"
+echo "Content-type: text/html"
+echo
+form='<!doctype html>
 <html>
        <head>
                <title>history.pushState/replaceState and referer headers</title>
@@ -16,25 +13,23 @@ form = '''
                <noscript><p>Enable JavaScript and reload</p></noscript>
                <div id="log"></div>
                <script type="text/javascript">
-var pyreferer = "'''
-print form + pyrefer + '";'
-print '''
-var httpReferer = unescape(pyreferer);
-var lastUrl = location.href.replace(/\/[^\/]*$/,'\/009-2.html?1234');
+var pyreferer = "'
+echo "$form$referer\";"
+echo 'var httpReferer = unescape(pyreferer);
+var lastUrl = location.href.replace(/\/[^\/]*$/,"\/009-2.html?1234");
 parent.test(function () {
        parent.assert_equals( httpReferer, lastUrl );
-}, 'HTTP Referer should use the pushed state');
+}, "HTTP Referer should use the pushed state");
 parent.test(function () {
        parent.assert_equals( document.referrer, lastUrl );
-}, 'document.referrer should use the pushed state');
+}, "document.referrer should use the pushed state");
 window.onload = function () {
        setTimeout(function () {
-               try { history.pushState('','','009-4.html?2345'); } catch(e) {}
-               location.href = '009-5.php';
+               try { history.pushState("","","009-4.html?2345"); } catch(e) {}
+               location.href = "009-5.php";
        },10);
 };
                </script>
 
        </body>
-</html>
-'''
+</html>'
old mode 100644 (file)
new mode 100755 (executable)
index 978881a..ba80e95
@@ -1,12 +1,9 @@
-#!/usr/bin/python
-
-import cgi
-import os
-referer = os.getenv("HTTP_REFERER")
-pyrefer = referer.encode()
-print "Content-type: text/html"
-form = '''
-<!doctype html>
+#!/bin/sh
+#
+referer="$HTTP_REFERER"
+echo "Content-type: text/html"
+echo
+form='<!doctype html>
 <html>
        <head>
                <title>history.pushState/replaceState and referer headers</title>
@@ -16,20 +13,18 @@ form = '''
                <noscript><p>Enable JavaScript and reload</p></noscript>
                <div id="log"></div>
                <script type="text/javascript">
-var pyreferer = "'''
-print form + pyrefer + '";'
-print '''
-var httpReferer = unescape(pyreferer);
-var lastUrl = location.href.replace(/\/[^\/]*$/,'\/009-4.html?2345');
+var pyreferer = "'
+echo "$form$referer\";"
+echo 'var httpReferer = unescape(pyreferer);
+var lastUrl = location.href.replace(/\/[^\/]*$/,"\/009-4.html?2345");
 parent.test(function () {
        parent.assert_equals( httpReferer, lastUrl );
-}, 'HTTP Referer should use the replaced state');
+}, "HTTP Referer should use the replaced state");
 parent.test(function () {
        parent.assert_equals( document.referrer, lastUrl );
-}, 'document.referrer should use the replaced state');
+}, "document.referrer should use the replaced state");
 parent.done();
                </script>
 
        </body>
-</html>
-'''
+</html>'
old mode 100644 (file)
new mode 100755 (executable)
index c6f94de..affbb29
@@ -1,12 +1,9 @@
-#!/usr/bin/python
-
-import cgi
-import os
-referer = os.getenv("HTTP_REFERER")
-pyrefer = referer.encode()
-print "Content-type: text/html"
-form = '''
-<!doctype html>
+#!/bin/sh
+#
+referer="$HTTP_REFERER"
+echo "Content-type: text/html"
+echo
+form='<!doctype html>
 <html>
        <head>
                <title>history.pushState/replaceState and referer headers (before onload)</title>
@@ -15,21 +12,19 @@ form = '''
                <noscript><p>Enable JavaScript and reload</p></noscript>
                <div id="log"></div>
                <script type="text/javascript">
-var pyreferer = "'''
-print form + pyrefer + '";'
-print '''
-var httpReferer = unescape(pyreferer);
-var lastUrl = location.href.replace(/\/[^\/]*$/,'\/010-2.html?1234');
+var pyreferer = "'
+echo "$form$referer\";"
+echo 'var httpReferer = unescape(pyreferer);
+var lastUrl = location.href.replace(/\/[^\/]*$/,"\/010-2.html?1234");
 parent.test(function () {
        parent.assert_equals( httpReferer, lastUrl );
-}, 'HTTP Referer should use the pushed state (before onload)');
+}, "HTTP Referer should use the pushed state (before onload)");
 parent.test(function () {
        parent.assert_equals( document.referrer, lastUrl );
-}, 'document.referrer should use the pushed state (before onload)');
-try { history.pushState('','','010-4.html?2345'); } catch(e) {}
-location.href = '010-5.php';
+}, "document.referrer should use the pushed state (before onload)");
+try { history.pushState("","","010-4.html?2345"); } catch(e) {}
+location.href = "010-5.php";
                </script>
 
        </body>
-</html>
-'''
+</html>'
old mode 100644 (file)
new mode 100755 (executable)
index ae64d4c..bd8c1ef
@@ -1,12 +1,9 @@
-#!/usr/bin/python
-
-import cgi
-import os
-referer = os.getenv("HTTP_REFERER")
-pyrefer = referer.encode()
-print "Content-type: text/html"
-form = '''
-<!doctype html>
+#!/bin/sh
+#
+referer="$HTTP_REFERER"
+echo "Content-type: text/html"
+echo
+form='<!doctype html>
 <html>
        <head>
                <title>history.pushState/replaceState and referer headers (before onload)</title>
@@ -15,20 +12,18 @@ form = '''
                <noscript><p>Enable JavaScript and reload</p></noscript>
                <div id="log"></div>
                <script type="text/javascript">
-var pyreferer = "'''
-print form + pyrefer + '";'
-print '''
-var httpReferer = unescape(pyreferer);
-var lastUrl = location.href.replace(/\/[^\/]*$/,'\/010-4.html?2345');
+var pyreferer = "'
+echo "$form$referer\";"
+echo 'var httpReferer = unescape(pyreferer);
+var lastUrl = location.href.replace(/\/[^\/]*$/,"\/010-4.html?2345");
 parent.test(function () {
        parent.assert_equals( httpReferer, lastUrl );
-}, 'HTTP Referer should use the replaced state (before onload)');
+}, "HTTP Referer should use the replaced state (before onload)");
 parent.test(function () {
        parent.assert_equals( document.referrer, lastUrl );
-}, 'document.referrer should use the replaced state (before onload)');
+}, "document.referrer should use the replaced state (before onload)");
 parent.done();
                </script>
 
        </body>
-</html>
-'''
+</html>'
diff --git a/tct-sse-w3c-tests/sse/w3c/resources/cgi/cors.php b/tct-sse-w3c-tests/sse/w3c/resources/cgi/cors.php
deleted file mode 100644 (file)
index 2b72795..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-#
-#Copyright (c) 2013 Intel Corporation.
-#
-#Redistribution and use in source and binary forms, with or without modification,
-#are permitted provided that the following conditions are met:
-#
-#* Redistributions of works must retain the original copyright notice, this list
-#  of conditions and the following disclaimer.
-#* Redistributions in binary form must reproduce the original copyright notice,
-#  this list of conditions and the following disclaimer in the documentation
-#  and/or other materials provided with the distribution.
-#* Neither the name of Intel Corporation nor the names of its contributors
-#  may be used to endorse or promote products derived from this work without
-#  specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-#OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-#NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-#EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#Authors:
-#        Lin, Wanming <wanmingx.lin@intel.com>
-
-import cgi
-import sys
-import os
-from os import environ
-
-def isset(variable):
-    return variable in locals() or variable in globals()
-
-def include(filename):
-    if os.path.exists(filename):
-        execfile(filename)
-
-fields = cgi.FieldStorage()
-origin = "http://" + os.getenv("HTTP_HOST")
-credentials = "true"
-
-if isset(fields.getvalue('origin')):
-    origin = fields.getvalue('origin')
-if isset(fields.getvalue('credentials')):
-    credentials = fields.getvalue('credentials')
-
-print "Access-Control-Allow-Origin:" + origin
-
-if credentials != "none":
-    print "Access-Control-Allow-Credentials:" + credentials
-
-run = fields.getvalue('run')
-
-if run in ["status-reconnect.php", "message.php", "redirect.php", "cache-control.php"]:
-   include(run)
index 591a072d634033ac18fe636dc26f085a39772650..8040020a332b607a6741c25444ed28f0ed4d7906 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
+MIME="text/event-stream"
+MESSAGE="data: data"
 
-import cgi
-import sys
-from os import environ
+val=`echo -n "$QUERY_STRING" | cgi-getfield mime`
+[ $? -eq 0 ] && MIME="$val"
 
-fields = cgi.FieldStorage()
-mime = "text/event-stream"
-message = "data: data"
-newline = "\n\n"
-
-if fields.getvalue('mime'):
-    mime = str(fields.getvalue('mime'))
-
-if fields.getvalue('message'):
-    message = str(fields.getvalue('message'))
-if fields.getvalue('newline'):
-    if fields.getvalue('newline') == 'none':
-        newline = ""
-    else:
-        newline = fields.getvalue('newline')
-
-print "Content-Type: %s" % mime
-print 
-sys.stdout.write("%s%s" % (message, newline))
+echo "Content-Type: $MIME"
+echo
+val=`echo -n "$QUERY_STRING" | cgi-getfield message`
+if [ $? -eq 0 ]; then
+        echo -n "$QUERY_STRING" | cgi-getfield message
+        echo
+else
+        echo "data: data"
+fi
+val=`echo -n "$QUERY_STRING" | cgi-getfield newline`
+if [ $? -eq 0 -a  "$val" = "none" ]; then
+        exit
+fi
+echo
+echo
index 0345aacab5ed4039f5d9eafd022885318a286236..b047dc63bb4f218407893c7b944e4f0286643543 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
-
-import cgi
-import sys
-from os import environ
-
-fields = cgi.FieldStorage()
-id = "recon_fail_"
-if fields.getvalue('id'):
-    id += str(fields.getvalue('id'))
-
-cookies = {}
-if environ.has_key('HTTP_COOKIE'):
-    cookie_str = environ['HTTP_COOKIE']
-    for cookie in cookie_str.split(';'):
-        key, val = cookie.split('=')
-        cookies[key.strip()] = val.strip()
-
-if not cookies.has_key(id):
-    print "Status: 200 OPEN"
-    print "Content-Type: text/event-stream"
-    print "Set-Cookie: %s=opened" % id
-    print
-    print "retry: 500"
-    print "data: opened\n"
-elif cookies[id] == "opened":
-    print "Status: 200 RECONNECT"
-    print "Content-Type: text/event-stream"
-    print "Set-Cookie: %s=reconnected" % id
-    print
-    print "data: reconnected\n"
-elif cookies[id] == "reconnected":
-    print "Status: 204 NO CONTENT (CLOSE)"
-    print "Content-Type: text/event-stream"
-    print "Set-Cookie: %s= " % id
-    print
-    print "data: closed\n"
-else:
-    print "Status: 200 OPEN"
-    print "Content-Type: text/event-stream"
-    print "Set-Cookie: %s=opened" % id
-    print
-    print "retry: 500"
-    print "data: opened\n"
+ID="recon_fail_"
+val=`echo -n "$QUERY_STRING"|cgi-getfield id`
+[ $? -eq 0 ] && ID="$ID$val"
+val=`echo -n "$HTTP_COOKIE" | cgi-getcookie $ID`
+if [ $? -ne 0 ]; then
+        echo "Status: 200 OPEN"
+        echo "Content-Type: text/event-stream"
+        echo "Set-Cookie: $ID=opened"
+        echo
+        echo "retry: 500"
+        echo "data: opened"
+        echo
+elif [ "$val" = "opened" ]; then
+        echo "Status: 200 RECONNECT"
+        echo "Content-Type: text/event-stream"
+        echo "Set-Cookie: $ID=reconnected"
+        echo
+        echo "data: reconnected"
+        echo
+elif [ "$val" = "reconnected" ]; then
+        echo "Status: 204 NO CONTENT (CLOSE)"
+        echo "Content-Type: text/event-stream"
+        echo "Set-Cookie: $ID= "
+        echo
+        echo "data: closed"
+        echo
+else
+        echo "Status: 200 OPEN"
+        echo "Content-Type: text/event-stream"
+        echo "Set-Cookie: $ID=opened"
+        echo
+        echo "retry: 500"
+        echo "data: opened"
+        echo
+fi
index 4b128beade6980fe73bd0a5ab686f8143de340e5..0398a2cfb6f7d7cd9c80fccd78afaed339b6bfaa 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
-
-import cgi
-from os import environ
-
-fields = cgi.FieldStorage()
-status = "302"
-
-if fields.getvalue('status'):
-    status = str(fields.getvalue('status'))
-
-print "Status: %s" % status
-print "Location: message.php"
-print "Content-Type: text/html"
-print
+STATUS="302"
+val=`echo -n "$QUERY_STRING" | cgi-getfield status`
+[ $? -eq 0 ] && STATUS="$val"
+echo "Status: $STATUS"
+echo "Location: message.php"
+echo "Content-Type: text/html"
+echo
index 6a4db8791ca7925d59f0b5954382acec74fe71cb..5f6dd06b505f5352e6a7abb633ac3f72a065fcdd 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 
 #Authors:
 #        Wang, Jing J<jing.j.wang@intel.com>
-
-import cgi
-
-fields = cgi.FieldStorage()
-status = "404"
-if fields.getvalue('status'):
-    status = str(fields.getvalue('status'))
-
-print "Status: %s HAHAHAHA" % status
-print "Content-Type: text/event-stream"
-print
-print "data: data"
-print
+STATUS="404"
+val=`echo -n "$QUERY_STRING" | cgi-getfield status`
+[ $? -eq 0 ] && STATUS=$val
+echo "Status: $STATUS HAHAHAHA"
+echo "Content-Type: text/event-stream"
+echo
+echo "data: data"
+echo
index e8155e44eb7d2ba6d84590353b80456e2da804dd..0175cb46423ed933ae937d46d3ab86252076041b 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 #Authors:
 #        Wang, Jing J<jing.j.wang@intel.com>
 
-import cgi
-import sys
-from os import environ
+STATUS="204"
+val=`echo -n "$QUERY_STRING" | cgi-getfield status`
+[ $? -eq 0 ] && STATUS="$val"
 
-fields = cgi.FieldStorage()
-status = "204"
-id = ""
-
-if fields.getvalue('status'):
-    status = str(fields.getvalue('status'))
-
-if fields.getvalue('id'):
-    id = str(fields.getvalue('id'))
-else:
-    id = status
-
-cookies = {}
-if environ.has_key('HTTP_COOKIE'):
-    cookie_str = environ['HTTP_COOKIE']
-    for cookie in cookie_str.split(';'):
-        key, val = cookie.split('=')
-        cookies[key.strip()] = val.strip()
-
-query_str = environ.get('QUERY_STRING')
-req_id = "request%s" % id
-others = (not cookies.has_key(req_id)) | (not cookies.get(req_id) == status)
-if others:
-    print "Status: %s TEST" % status
-    print "Content-Type: text/event-stream"
-    print "Set-Cookie: %s=%s" % (req_id, status)
-    print
-    print "retry: 200\n"
-    if query_str and query_str.find("ok_first") >=0:
-        print "data: ok\n"
-else:
-    print "Content-Type: text/event-stream"
-    print "Set-Cookie: %s=" % req_id
-    print
-    print "data: data\n"
+val=`echo -n "$QUERY_STRING" | cgi-getfield id`
+if [ $? -eq 0 ]; then
+        ID="$val"
+else
+        ID="$STATUS"
+fi
+REQID="request$ID"
+val=`echo -n "$HTTP_COOKIE" | cgi-getcookie $REQID`
+if [ $? -ne 0 -o ! "$val" = "$STATUS" ]; then
+        echo "Status: $STATUS TEST"
+        echo "Content-Type: text/event-stream"
+        echo "Set-Cookie: $REQID=$STATUS"
+        echo
+        echo "retry: 200"
+        echo
+        val=`echo -n "$QUERY_STRING" | cgi-getfield ok_first`
+        if [ $? -eq 0 ]; then
+                echo "data: ok"
+                echo
+        fi
+else
+        echo "Content-Type: text/event-stream"
+        echo "Set-Cookie: $REQID="
+        echo
+        echo "data: data"
+        echo
+fi
diff --git a/tct-sse-w3c-tests/sse/w3c/resources/cors.php b/tct-sse-w3c-tests/sse/w3c/resources/cors.php
deleted file mode 100644 (file)
index 6257230..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-  $origin = isset($_GET['origin']) ? $_GET['origin'] : $_SERVER['HTTP_ORIGIN'];
-  header("Access-Control-Allow-Origin: $origin");
-
-  $credentials = isset($_GET['credentials']) ? $_GET['credentials'] : "true";
-  if ($credentials != "none")
-    header("Access-Control-Allow-Credentials: $credentials");
-
-  switch($_GET['run']) {
-    case "status-reconnect.php":
-    case "message.php":
-    case "redirect.php":
-    case "cache-control.php":
-      include($_GET['run']);
-      break;
-  }
-?>
old mode 100755 (executable)
new mode 100644 (file)
index 7092227..037ca0a
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
 
-import cgi
-import sys
-from os import environ
+TAG=
+DATE=
 
-fields = cgi.FieldStorage()
+val=`echo -n "$QUERY_STRING" | cgi-getfield tag`
+[ $? -eq 0 ] && TAG="$val"
 
-ttag = ""
-ddate = ""
+val=`echo -n "$QUERY_STRING" | cgi-getfield date`
+[ $? -eq 0 ] && DATE="$val"
 
-if fields.getvalue('tag'):
-    ttag = str(fields.getvalue('tag'))
+if [ -n "$TAG" -a "$HTTP_IF_NONE_MATCH" = "$TAG" ]; then
+        echo "Status: 304 SUPERCOOL"
+elif [ -n "$DATE" -a "$HTTP_IF_MODIFIED_SINCE" = "$DATE" ]; then
+        echo "Status: 304 SUPERCOOL"
+fi
 
-if fields.getvalue('date'):
-    ddate = str(fields.getvalue('date'))
-
-if ttag and environ.get("HTTP_IF_NONE_MATCH", "") == ttag:
-    print "Status: 304 SUPERCOOL"
-elif ddate and environ.get("HTTP_IF_MODIFIED_SINCE", "") == ddate:
-    print "Status: 304 SUPERCOOL"
-
-if ddate:
-    print "Last-Modified: %s" % ddate
-if ttag:
-    print "ETag: %s" % ttag
-print "Content-Type: text/plain"
-print
-sys.stdout.write("MAYBE NOT")
+[ -n "$DATE" ] && echo "Last-Modified: $DATE"
+[ -n "$TAG" ] && echo "ETag: $TAG"
+echo "Content-Type: text/plain"
+echo
+echo -n "MAYBE NOT"
old mode 100755 (executable)
new mode 100644 (file)
index 0088988..3c3b897
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
-
-import cgi
-import sys
-import time
-
-fields = cgi.FieldStorage()
-
-delay = "500"
-if fields.getvalue('ms'):
-    delay = str(fields.getvalue('ms'))
-time.sleep(int(delay)/1000)
-print "Content-Type: text/plain"
-print
-sys.stdout.write("TEST_DELAY")
+DELAY=500
+val=`echo -n "$QUERY_STRING" | cgi-getfield ms`
+[ $? -eq 0 ] && DELAY="$val"
+sleep `expr $DELAY / 1000`
+echo "Content-Type: text/plain"
+echo
+echo -n "TEST_DELAY"
old mode 100755 (executable)
new mode 100644 (file)
index d061566..86c53bf
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
-
-import cgi
-import sys
-from os import environ
-
-def trans(v_str):
-    if v_str in b_headers:
-        return v_str.replace('-', '_')
-    return "HTTP_" + v_str.replace('-', '_')
-
-fields = cgi.FieldStorage()
-
-filter_value = ""
-result = ""
-try:
-    if fields.getvalue('filter_value'):
-        filter_value = str(fields.getvalue('filter_value'))
-except:
-    filter_value = "t1, t2"
-
-b_headers = ["CONTENT-TYPE"]
-headers = ["AUTHORIZATION", "PRAGMA", "CONTENT-TYPE", "OVERWRITE", "IF", "STATUS-URI", "X-TEST", "X-PINK-UNICORN"]
-
-for item in headers:
-    if filter_value and (environ.get(trans(item), "") == filter_value):
-        result = item.lower() + ","
-        break
-
-print "Content-Type: text/plain"
-print
-sys.stdout.write(result)
+FILTER="t1, t2"
+RESULT=
+val=`echo -n "$QUERY_STRING" | cgi-getfield filter_value`
+[ $? -eq 0 ] && FILTER="$val"
+
+WLIST="CONTENT-TYPE"
+HEADERS="AUTHORIZATION PRAGMA CONTENT-TYPE OVERWRITE IF STATUS-URI X-TEST X-PINK-UNICORN"
+
+for item in $HEADERS; do
+        match=0
+        for i in $WLIST; do
+                if [ "$i" = "$item" ]; then
+                        match=1
+                        break
+                fi
+        done
+        key=${item//-/_}
+        [ $match -eq 0 ] && key="HTTP_$key"
+        val=`printenv $key`
+        if [ -n "$FILTER" -a "$val" = "$FILTER" ]; then
+                v=`echo "$item" | tr '[A-Z]' '[a-z]'`
+                RESULT="$v,"
+                break
+        fi
+done
+echo "Content-Type: text/plain"
+echo
+echo -n "$RESULT"
old mode 100755 (executable)
new mode 100644 (file)
index 9e2159e..6004bf0
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
 
-import cgi
-import sys
-from os import environ
+CODE=
+LOCATION=
+val=`echo "$QUERY_STRING" | cgi-getfield code`
+[ $? -eq 0 ] && CODE="$val"
 
-fields = cgi.FieldStorage()
+val=`echo "$QUERY_STRING" | cgi-getfield location`
+[ $? -eq 0 ] && LOCATION="$val"
 
-code = ""
-location = ""
+[ -n "$LOCATION" ] && LOCATION="$SCRIPT_NAME?followed"
 
-if fields.getvalue('code'):
-    code = str(fields.getvalue('code'))
-
-if fields.getvalue('location'):
-    location = str(fields.getvalue('location'))
-
-if not location:
-    location = environ.get("SCRIPT_NAME", "") + "?followed"
-
-print "Status: %s WEBSRT MARKETING" % code
-print "Location: %s" % location
-print "Content-Type: text/plain"
-print
-print "TEST"
+echo "Status: $CODE WEBSRT MARKETING"
+echo "Location: $LOCATION"
+echo "Content-Type: text/plain"
+echo
+echo "TEST"
old mode 100755 (executable)
new mode 100644 (file)
index dcdd625..d4995fb
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/sh
 #
 #Copyright (c) 2013 Intel Corporation.
 #
 #Authors:
 #        Wang, Jing J <jing.j.wang@intel.com>
 
-import cgi
-import sys
-from os import environ
+CODE="200"
+TEXT="OMG"
 
-fields = cgi.FieldStorage()
+val=`echo -n "$QUERY_STRING" | cgi-getfield code`
+[ $? -eq 0 ] && CODE="$val"
 
-code = "200"
-text = "OMG"
-content = ""
-ctype = ""
+val=`echo -n "$QUERY_STRING" | cgi-getfield text`
+[ $? -eq 0 ] && TEXT="$val"
 
-if fields.getvalue('code'):
-    code = str(fields.getvalue('code'))
-
-if fields.getvalue('text'):
-    text = str(fields.getvalue('text'))
-
-if fields.getvalue('content'):
-    content = str(fields.getvalue('content'))
-
-if fields.getvalue('type'):
-    ctype = str(fields.getvalue('type'))
-
-print "Status: %s %s" % (code, text)
-print "Content-Type: %s" % ctype
-print
-sys.stdout.write(content)
+echo "Status: $CODE $TEXT"
+echo "Content-Type: `echo -n "$QUERY_STRING" | cgi-getfield type`"
+echo
+echo -n "$QUERY_STRING" | cgi-getfield content