这是我在Heroku上的Python Web应用程序上出现的错误。
它提供带有表单的index.html
页面。用户编译它然后应用程序必须给他一个HTML响应。
但在提供响应页面时,我收到以下错误。这是什么意思?
2015-09-06T16:23:36.333232+00:00 heroku[router]: at=error code=H25 desc="HTTP restriction: oversized status line" method=POST
路径=" /response.html"主机= stantool.herokuapp.com request_id = b9902c0f-d2d1-4cd7-a039-ce1920031d51 fwd =" 95.232.75.72" dyno = web.1 connect = 2ms service = 15445ms status = 502 bytes = 9640
我认为我理解错误,但我不知道如何解决它......
我认为问题在于我的index.html中有这段代码
<form method=POST name="sentMessage" id="annucioForm" action="response.html" novalidate>
文件index.html
由Python脚本提供
if self.path == '/':
self.path = 'tool/public/index.html'
logging.warning(self.headers)
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
比我以这种方式创建响应:
header=""
in_file = open(utily.get_full_path("public/header.html"),"r")
header = in_file.read()
in_file.close()
footer=""
in_file = open(utily.get_full_path("public/footer.html"),"r")
footer = in_file.read()
in_file.close()
html_to_serve=""
in_file = open(utily.get_full_path("public/response_"+tipologia_prodotto+".html"),"r")
html_to_serve = in_file.read()
in_file.close()
我以这种方式服务:
logging.warning("======= POST STARTED =======")
#logging.warning(self.headers)
form = cgi.FieldStorage(
fp=self.rfile,
headers=self.headers,
environ={'REQUEST_METHOD':'POST',
'CONTENT_TYPE':self.headers['Content-Type'],
})
logging.warning("======= POST VALUES =======")
self.wfile.write((header+html_to_serve+footer).encode('utf-8'))
但是index.html中的表单页面会重定向到名为response.html的页面,而该页面并不存在。
我该如何解决?我认为问题是index.html
页面