Code review: Updated report-uri-single-violated in behavior tool
authoryunfeix.hao <yunfeix.hao@intel.com>
Thu, 15 Aug 2013 05:16:28 +0000 (13:16 +0800)
committerFeng Gang <gangx.feng@intel.com>
Thu, 15 Aug 2013 07:00:07 +0000 (00:00 -0700)
Change-Id: I934b41c98ca137e78740d247edbe21688ca94a05
Signed-off-by: yunfeix.hao <yunfeix.hao@intel.com>
res/js/reportcspviolation.cgi [new file with mode: 0644]
tests/CSP/res/report-uri-single-violated.wgt [changed mode: 0755->0644]

diff --git a/res/js/reportcspviolation.cgi b/res/js/reportcspviolation.cgi
new file mode 100644 (file)
index 0000000..15d8cf4
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+import time
+import os
+print 'Content-Type: text/html\n\n'
+while True:
+    i = raw_input()
+    if i is None:
+        break
+    if str(i).strip()=='':
+        break
+    n = 1
+    if os.path.isfile('/tmp/csp-report.log'):
+        file_object_num = open('/tmp/csp-report.log','r')
+        for line in file_object_num:
+            if str(line).find("Time:") >= 0:
+                n = n+1
+        file_object_num.close( )
+    file_object = open('/tmp/csp-report.log', 'a')
+    file_object.write('\n %d   Time:' %n)
+    file_object.write( time.strftime(' %Y-%m-%d %H:%M:%S',time.localtime(time.time())))
+    file_object.write('\n')
+    file_object.write('     Data:')
+    file_object.write(i)
+    file_object.write('\n')
+    file_object.close( )
+    print i
old mode 100755 (executable)
new mode 100644 (file)
index f681830..76b9b0a
Binary files a/tests/CSP/res/report-uri-single-violated.wgt and b/tests/CSP/res/report-uri-single-violated.wgt differ