Han*_*son 1 macos cocoa core-foundation nsurlconnection
我已经设置了一个简单的NSURLConnection来查询http服务器.
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
Run Code Online (Sandbox Code Playgroud)
服务器使用代码401和WWW-Authenticate标头集进行响应
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:
Run Code Online (Sandbox Code Playgroud)
我想这会向我的委托的连接发送一条消息:didReceiveAuthenticationChallenge:方法,但事实并非如此.
我也实施了
- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection {
return FALSE;
}
Run Code Online (Sandbox Code Playgroud)
只是为了确保它不会尝试从我的钥匙串发送缓存的凭据,而不是.
WWW-Authenticate标头看起来格式不正确,请尝试:
WWW-Authenticate: Basic realm="My Realm"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1739 次 |
| 最近记录: |