2009-04-07 3 views
1

http-server를 쿼리하기 위해 간단한 NSURLConnection을 설정했습니다.NSURLConnection 대리자가 서버 상태 401에서 didReceiveAuthenticationChallenge 메서드를 가져 오지 않았습니다.

GET /path HTTP/1.1 
Host: 192.168.1.161:8282 
User-Agent: NetTest1.0 CFNetwork/441.0.2 Darwin/9.6.0 
Accept: */* 
Accept-Language: en-us 
Accept-Encoding: gzip, deflate 
Pragma: no-cache 
Connection: keep-alive 

서버는 코드 401로 응답하고, WWW 인증 헤더는

HTTP/1.1 401 
Connection: close 
Pragma: no-cache 
Expires: Thu, 01 Dec 1994 16:00:00 GMT 
Cache-control: no-cache 
Cache-last-checked: Thu, 01 Dec 1994 16:00:00 GMT 
Last-modified: Tue, 07 Apr 02009 22:55:48 CEST 
Content-type: text/html; charset=iso-8859-1 
WWW-Authenticate: Basic realm: 

내가이 내 대리인의 연결에 메시지를 보낼 것이라고 상상 설정 : didReceiveAuthenticationChallenge : 방법,하지만하지 않습니다.

또한 그냥 그것을하지 않는 내 키 체인에서 캐시 된 자격 증명 함께 보내려고하지 않도록하기 위해

- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection { 
    return FALSE; 
} 

을 구현했습니다.

답변

5

헤더가 잘못 보이는 WWW 인증은 시도 :

WWW-Authenticate: Basic realm="My Realm"