V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
gotounix
V2EX  ›  问与答

我在用 SimpleHTTPServer.SimpleHTTPRequestHandler 来处理 POST 提交的时候, redirect 一直失败是什么原因?

  •  
  •   gotounix · Aug 29, 2016 · 1731 views
    This topic created in 3540 days ago, the information mentioned may be changed or developed.
    我把链接先发到本地服务器,再由本地服务器 redirect 到真是地址:
    http://localhost/REAL_ADDRESS

    class CredRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
    ....def do_POST(self):
    ........self.send_response(301)
    ........self.send_header('Location', urllib.unquote(self.path[1:]))
    ........self.end_headers()
    3 replies    2016-08-29 18:10:45 +08:00
    9hills
        1
    9hills  
       Aug 29, 2016
    失败的提示是什么?这个是 debug 关键信息
    gotounix
        2
    gotounix  
    OP
       Aug 29, 2016
    @9hills 不好意思,没表述清楚。我这里说的失败是指重定向失败了,但是代码是显示成功的,并没有报错信息。本来应该 post 成功的,但是却没有成功。
    gotounix
        3
    gotounix  
    OP
       Aug 29, 2016
    @9hills 貌似 https 不能这样弄吧?!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3093 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 03:36 · PVG 11:36 · LAX 20:36 · JFK 23:36
    ♥ Do have faith in what you're doing.