0
我的目標是我的SSI(shtml)將解析POST數據參數並返回一個長加密字符串,它將基於這些參數。 我使用IIS作爲服務器。服務器端在IIS服務器上包含(ssi),讀POST請求數據失敗
我的約束:
- 我無法改變的URL - /document.shtml
- 的SHTML需要只返回基地64字符串結果。
我的嘗試:
- 在SHTML使用 「EXEC CGI」,這樣一來:
document.shtml:
<!--#exec cgi="/pythonApp/test.py?sdfsdf=sdfsdf" -->
test.py(簡化版,沒有加密背後的邏輯):
import cgitb
cgitb.enable()
import base64,urllib,json,os,sys
import cgi
print "Content-Type: text/plain;charset=utf-8"
print
cl, _ = cgi.parse_header(os.environ['CONTENT_LENGTH'])
if (int(cl)>0):
\t data = sys.stdin.read(int(cl))
\t input_j = json.loads(data)
\t print "AB : ",input_j["AB"]
else:
\t print "Failed to read POST request"
這裏的問題是,如果我發送POST請求.../test.py,然後將其作品, 但如果我發送請求到document.shtml,內容長度仍然是積極的,如環境變量所述,但stdin會得到一個錯誤。
- 我的其它的想法是從SHTML本身讀出的POST數據,以某種方式和其傳遞到CGI,這種方式:
<!--#exec cgi="/pythonApp/test.py?sdfsdf=sdfsdf" -->
問題是,我看了網,並沒有找到一種方法來從shtml做到這一點。
有什麼建議嗎?我錯過了一些簡單的東西?