抱歉,我会说一点英语。 我有一个js代码
url = '/auth'
var http_request = window.XDomainRequest || window.XMLHttpRequest;
http_request = new http_request;
http_request.open( "post", url, true, 'jack', 'pass_jack' );
http_request.send();
和 python BaseHTTPServer
def do_POST(self):
if self.path == '/auth':
如何在 python 中检查用户名和密码?
最佳答案
XMLHttpRequest
设置 Authentication
header ,您需要解析该 header :
auth = self.headers['Authentication']
参见RFC 2617 (HTTP 身份验证:基本和摘要访问身份验证)有关用户代理如何通过该 header 与服务器交互的详细信息。
关于python - BaseHTTPServer Python 和 xmlhttprequest 授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16012804/