• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CFHTTPMessageAddAuthentication problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFHTTPMessageAddAuthentication problem


  • Subject: CFHTTPMessageAddAuthentication problem
  • From: Kevin Yu <email@hidden>
  • Date: Fri, 29 Nov 2013 12:33:52 +0800

Hi there,

This is for iOS platform, both iOS6 and iOS7 got the same issue.
I’ve a HTTP request and Response looks like the following:

request:
GET /cwm/CRN.html HTTP/1.1
Host: 10.5.5.1:8069
User-Agent: MyAgent
Connection: keep-alive

response:
HTTP/1.1 401 Authentication Failed
Www-Authenticate: Digest realm=“MyDomain", nonce="MDAwNDcwOTY6RHJheXRlaw==", algorithm="MD5", qop="auth"
Content-Length: 21
Connection: close

So I try to use CFHTTPMessageAddAuthentication to create authentication:

int scode = CFHTTPMessageGetResponseStatusCode(response);
int result = CFHTTPMessageAddAuthentication(request, response, (__bridge CFStringRef)user, (__bridge CFStringRef)pass, kCFHTTPAuthenticationSchemeDigest, (scode==407));

The result will always return 0, that means fail; but if I change the authenticationScheme to kCFHTTPAuthenticationSchemeBasic, the result will be good and it do append authentication info in request message but that is not what I want; 

Do I miss something and cause the fail?


---
regards,
KC

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: CFHTTPMessageAddAuthentication problem
      • From: joby abraham <email@hidden>
  • Prev by Date: Re: A NSOutputStream vs. native socket question
  • Next by Date: Re: CFHTTPMessageAddAuthentication problem
  • Previous by thread: Re: Multipeer Connectivity Questions
  • Next by thread: Re: CFHTTPMessageAddAuthentication problem
  • Index(es):
    • Date
    • Thread