[FFmpeg-devel] [PATCH] Add support for digest auth in the http and rtsp protocols

Martin Storsjö martin
Wed Mar 24 22:57:49 CET 2010


On Wed, 24 Mar 2010, Ronald S. Bultje wrote:

> On Wed, Mar 24, 2010 at 4:17 PM, Martin Storsj? <martin at martin.st> wrote:
> > New series attached, hopefully taking all comments into account.
> 
> Let's optimize that value-parsing a bit. Let me know if I'm going too
> far or if it's ugly.
> 
> Let's see? Can you use something like this to prevent all the dups?
> Perhaps a little ugly and buggy but you'll get the point.

Implemented something along these lines, looks better and avoids rewriting 
the parsed buffer.

> > +void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
> > +                                const char *value)
> [..]
> > +        if (av_stristart(value, "Basic ", &p)) {
> > +            char *copy;
> > +            if (state->auth_type > HTTP_AUTH_BASIC)
> > +                return;
> 
> if (av_stristart() && state->auth_type <= HTTP_AUTH_BASIC)

Done

> > +            state->auth_type = HTTP_AUTH_BASIC;
> > +            state->realm[0] = '\0';
> > +            copy = av_strdup(p);
> > +            if (!copy)
> > +                return;
> > +            parse_key_value(copy, handle_basic_params, state);
> 
> Using the above code, no copy should be necessary.

Copy removed, hooray!

> > +static void handle_basic_params(void *ctx, char *key, char *value)
> > +{
> > +    HTTPAuthState *state = ctx;
> 
> Why void?

Initially, I thought about passing either HTTPAuthState or DigestParams, 
but now I'm always passing HTTPAuthState. Simplified.


New versions of #1 and #2 attached.

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Split-out-http-authentication-handling-into-a-separa.patch
Type: text/x-diff
Size: 12478 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100324/4ae5b711/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-support-for-http-digest-authentication.patch
Type: text/x-diff
Size: 11220 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100324/4ae5b711/attachment-0001.patch>



More information about the ffmpeg-devel mailing list