Re: Does CFHTTPMessageAddAuthentication support digest auth?
Re: Does CFHTTPMessageAddAuthentication support digest auth?
- Subject: Re: Does CFHTTPMessageAddAuthentication support digest auth?
- From: Jens Alfke <email@hidden>
- Date: Mon, 13 Jul 2015 15:20:33 -0700
> On Jul 13, 2015, at 1:31 AM, Quinn The Eskimo! <email@hidden> wrote:
>
>
> On 1 Jul 2015, at 06:03, Jens Alfke <email@hidden> wrote:
>
>> I’ve run into a problem with CFHTTPMessageAddAuthentication: it works fine with HTTP Basic auth challenges, but when I try to use it with a Digest auth challenge it fails (returns false.)
>
> Where did you get the CFHTTPMessage from?
It’s from the PocketSocket library (a WebSocket implementation), which is creating it itself, not getting it from a CFHTTPStream.
Conceivably I could refactor PSWebSocket to use CFHTTPStream instead of doing its own HTTP response parsing, but the way the code is written makes that difficult, since they put the networking code and the parsing code in two different classes for abstraction purposes.
Actually I’m not even certain if CFHTTPStream can be used to open a WebSocket, since the protocol stops being HTTP as soon as the server sends the response headers. Does CFHTTPStream just go into passthru mode at that point?
> The following post, and its associated thread, has more details.
> <http://lists.apple.com/archives/macnetworkprog/2013/Dec/msg00004.html>
Hm, this is a mess isn’t it. It’s another case of an Apple network-related class that looks like it should be generically useable, but turns out not to be fully instantiable using public APIs. (NSHTTPURLResponse used to be that way before 10.7.2, which was a PITA for anyone implementing an HTTP-like NSURLProtocol.)
It’s pretty common in the wild to write code that parses HTTP responses from a socket; I’ve seen a lot of open-source code that does it using CFHTTPMessage, and I’ve done it myself many times.
Sadly I can’t use the private API workaround because my code has to run on iOS.
BTW, in that thread you responded:
>> Currently, I’m working on an application which needs to act as server and client role in the same time [...]
>
> Wow, that's really messed up.
I hope you were being tongue-in-cheek — what the OP is describing is simply what any P2P app does.
—Jens
_______________________________________________
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