2013-04-15 3 views
1

죄송합니다, 저는 영어로 조금 이야기합니다. 나는 JS 코드BaseHTTPServer Python 및 xmlhttprequest 인증

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(); 

그리고 파이썬 BaseHTTPServer 내가 파이썬에서 사용자 이름과 암호를 확인할 수있는 방법

def do_POST(self): 
    if self.path == '/auth': 

가 있나요?

답변

1

XMLHttpRequestAuthentication 헤더를 설정하고, 해당 헤더를 구문 분석해야 할 것 :

auth = self.headers['Authentication'] 

참조 RFC 2617 : 사용자 에이전트가를 통해 서버와 상호 작용하는 방법에 대한 자세한 내용은 (HTTP 인증 기본 및 다이제스트 액세스 인증) 머리글.

+0

감사합니다. 맞습니다. –