From: wanmingx.lin Date: Thu, 26 Sep 2013 10:26:18 +0000 (+0800) Subject: Fix TTS-1980 by removing python dependency X-Git-Tag: 2.2.1_release~107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=599f9e1e2b620b99422005c1f7559522fa36fdcc;p=test%2Ftct%2Fweb%2Fapi.git Fix TTS-1980 by removing python dependency Signed-off-by: wanmingx.lin --- diff --git a/tct-cors-w3c-tests/cors/support/cgi/cors_echo.php b/tct-cors-w3c-tests/cors/support/cgi/cors_echo.php index 378191e82..65fbe36e7 100755 --- a/tct-cors-w3c-tests/cors/support/cgi/cors_echo.php +++ b/tct-cors-w3c-tests/cors/support/cgi/cors_echo.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -28,18 +28,15 @@ #Authors: # Wang, Jing J -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 diff --git a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-3.php b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-3.php old mode 100644 new mode 100755 index d87ac6ab6..b4ffe5c33 --- a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-3.php +++ b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-3.php @@ -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 = ''' - +#!/bin/sh +# +referer="$HTTP_REFERER" +echo "Content-type: text/html" +echo +form=' history.pushState/replaceState and referer headers @@ -16,25 +13,23 @@ form = '''
- -''' +' diff --git a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-5.php b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-5.php old mode 100644 new mode 100755 index 978881af4..ba80e9576 --- a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-5.php +++ b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/009-5.php @@ -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 = ''' - +#!/bin/sh +# +referer="$HTTP_REFERER" +echo "Content-type: text/html" +echo +form=' history.pushState/replaceState and referer headers @@ -16,20 +13,18 @@ form = '''
- -''' +' diff --git a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-3.php b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-3.php old mode 100644 new mode 100755 index c6f94ded2..affbb29fb --- a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-3.php +++ b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-3.php @@ -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 = ''' - +#!/bin/sh +# +referer="$HTTP_REFERER" +echo "Content-type: text/html" +echo +form=' history.pushState/replaceState and referer headers (before onload) @@ -15,21 +12,19 @@ form = '''
- -''' +' diff --git a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-5.php b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-5.php old mode 100644 new mode 100755 index ae64d4ca2..bd8c1ef06 --- a/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-5.php +++ b/tct-sessionhistory-html5-tests/sessionhistory/w3c/cgi/010-5.php @@ -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 = ''' - +#!/bin/sh +# +referer="$HTTP_REFERER" +echo "Content-type: text/html" +echo +form=' history.pushState/replaceState and referer headers (before onload) @@ -15,20 +12,18 @@ form = '''
- -''' +' 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 index 2b72795ea..000000000 --- a/tct-sse-w3c-tests/sse/w3c/resources/cgi/cors.php +++ /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 - -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) diff --git a/tct-sse-w3c-tests/sse/w3c/resources/cgi/message.php b/tct-sse-w3c-tests/sse/w3c/resources/cgi/message.php index 591a072d6..8040020a3 100644 --- a/tct-sse-w3c-tests/sse/w3c/resources/cgi/message.php +++ b/tct-sse-w3c-tests/sse/w3c/resources/cgi/message.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -27,27 +27,24 @@ #Authors: # Wang, Jing J +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 diff --git a/tct-sse-w3c-tests/sse/w3c/resources/cgi/reconnect-fail.php b/tct-sse-w3c-tests/sse/w3c/resources/cgi/reconnect-fail.php index 0345aacab..b047dc63b 100644 --- a/tct-sse-w3c-tests/sse/w3c/resources/cgi/reconnect-fail.php +++ b/tct-sse-w3c-tests/sse/w3c/resources/cgi/reconnect-fail.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -27,46 +27,38 @@ #Authors: # Wang, Jing J - -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 diff --git a/tct-sse-w3c-tests/sse/w3c/resources/cgi/redirect.php b/tct-sse-w3c-tests/sse/w3c/resources/cgi/redirect.php index 4b128bead..0398a2cfb 100644 --- a/tct-sse-w3c-tests/sse/w3c/resources/cgi/redirect.php +++ b/tct-sse-w3c-tests/sse/w3c/resources/cgi/redirect.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -27,17 +27,10 @@ #Authors: # Wang, Jing J - -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 diff --git a/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-error.php b/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-error.php index 6a4db8791..5f6dd06b5 100644 --- a/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-error.php +++ b/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-error.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -27,16 +27,11 @@ #Authors: # Wang, Jing J - -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 diff --git a/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-reconnect.php b/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-reconnect.php index e8155e44e..0175cb464 100644 --- a/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-reconnect.php +++ b/tct-sse-w3c-tests/sse/w3c/resources/cgi/status-reconnect.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -28,42 +28,34 @@ #Authors: # Wang, Jing J -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 index 62572307b..000000000 --- a/tct-sse-w3c-tests/sse/w3c/resources/cors.php +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/conditional.php b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/conditional.php old mode 100755 new mode 100644 index 7092227a0..037ca0ab1 --- a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/conditional.php +++ b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/conditional.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -28,30 +28,23 @@ #Authors: # Wang, Jing J -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" diff --git a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/delay.php b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/delay.php old mode 100755 new mode 100644 index 008898802..3c3b897ef --- a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/delay.php +++ b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/delay.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -27,17 +27,10 @@ #Authors: # Wang, Jing J - -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" diff --git a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/inspect-headers.php b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/inspect-headers.php old mode 100755 new mode 100644 index d061566fe..86c53bf2b --- a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/inspect-headers.php +++ b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/inspect-headers.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -27,34 +27,31 @@ #Authors: # Wang, Jing J - -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" diff --git a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/redirect.php b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/redirect.php old mode 100755 new mode 100644 index 9e2159e93..6004bf0aa --- a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/redirect.php +++ b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/redirect.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -28,26 +28,18 @@ #Authors: # Wang, Jing J -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" diff --git a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/status.php b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/status.php old mode 100755 new mode 100644 index dcdd62585..d4995fb96 --- a/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/status.php +++ b/tct-xmlhttprequest-w3c-tests/xmlhttprequest/w3c/resources/cgi/status.php @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/sh # #Copyright (c) 2013 Intel Corporation. # @@ -28,30 +28,16 @@ #Authors: # Wang, Jing J -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