void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,

                                const char *value)

{

    if (!strcmp(key, "WWW-Authenticate") || !strcmp(key, "Proxy-Authenticate")) {

        const char *p;

        if (av_stristart(value, "Basic ", &p) &&

            state->auth_type <= HTTP_AUTH_BASIC) {

            state->auth_type = HTTP_AUTH_BASIC;

            state->realm[0] = 0;

            state->stale = 0;

            ff_parse_key_value(p, (ff_parse_key_val_cb) handle_basic_params,

                               state);

        } else if (av_stristart(value, "Digest ", &p) &&

                   state->auth_type <= HTTP_AUTH_DIGEST) {

            state->auth_type = HTTP_AUTH_DIGEST;

            memset(&state->digest_params, 0, sizeof(DigestParams));

            state->realm[0] = 0;

            state->stale = 0;

            ff_parse_key_value(p, (ff_parse_key_val_cb) handle_digest_params,

                               state);

            choose_qop(state->digest_params.qop,

                       sizeof(state->digest_params.qop));

            if (!av_strcasecmp(state->digest_params.stale, "true"))

                state->stale = 1;

        }

    } else if (!strcmp(key, "Authentication-Info")) {

        ff_parse_key_value(value, (ff_parse_key_val_cb) handle_digest_update,

                           state);

    }

}

void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,

                                const char *value)

{

    if (!strcmp(key, "WWW-Authenticate") || !strcmp(key, "Proxy-Authenticate")) {

        const char *p;

        if (av_stristart(value, "Basic ", &p) &&

            state->auth_type <= HTTP_AUTH_BASIC) {

            state->auth_type = HTTP_AUTH_BASIC;

            state->realm[0] = 0;

            state->stale = 0;

            ff_parse_key_value(p, (ff_parse_key_val_cb) handle_basic_params,

                               state);

        } else if (av_stristart(value, "Digest ", &p) &&

                   state->auth_type <= HTTP_AUTH_DIGEST) {

            state->auth_type = HTTP_AUTH_DIGEST;

            memset(&state->digest_params, 0, sizeof(DigestParams));

            state->realm[0] = 0;

            state->stale = 0;

            ff_parse_key_value(p, (ff_parse_key_val_cb) handle_digest_params,

                               state);

            choose_qop(state->digest_params.qop,

                       sizeof(state->digest_params.qop));

            if (!av_strcasecmp(state->digest_params.stale, "true"))

                state->stale = 1;

        }

    } else if (!strcmp(key, "Authentication-Info")) {

        ff_parse_key_value(value, (ff_parse_key_val_cb) handle_digest_update,

                           state);

    }

}

void FUNC_0(HTTPAuthState *VAR_0, const char *VAR_1,

                                const char *VAR_2)

{

    if (!strcmp(VAR_1, "WWW-Authenticate") || !strcmp(VAR_1, "Proxy-Authenticate")) {

        const char *VAR_3;

        if (av_stristart(VAR_2, "Basic ", &VAR_3) &&

            VAR_0->auth_type <= HTTP_AUTH_BASIC) {

            VAR_0->auth_type = HTTP_AUTH_BASIC;

            VAR_0->realm[0] = 0;

            VAR_0->stale = 0;

            ff_parse_key_value(VAR_3, (ff_parse_key_val_cb) handle_basic_params,

                               VAR_0);

        } else if (av_stristart(VAR_2, "Digest ", &VAR_3) &&

                   VAR_0->auth_type <= HTTP_AUTH_DIGEST) {

            VAR_0->auth_type = HTTP_AUTH_DIGEST;

            memset(&VAR_0->digest_params, 0, sizeof(DigestParams));

            VAR_0->realm[0] = 0;

            VAR_0->stale = 0;

            ff_parse_key_value(VAR_3, (ff_parse_key_val_cb) handle_digest_params,

                               VAR_0);

            choose_qop(VAR_0->digest_params.qop,

                       sizeof(VAR_0->digest_params.qop));

            if (!av_strcasecmp(VAR_0->digest_params.stale, "true"))

                VAR_0->stale = 1;

        }

    } else if (!strcmp(VAR_1, "Authentication-Info")) {

        ff_parse_key_value(VAR_2, (ff_parse_key_val_cb) handle_digest_update,

                           VAR_0);

    }

}

void FUNC_0(HTTPAuthState *VAR_0, const char *VAR_1,
const char *VAR_2)
{ if (!strcmp(VAR_1, "WWW-Authenticate") || !strcmp(VAR_1, "Proxy-Authenticate")) { const char *VAR_3; if (av_stristart(VAR_2, "Basic ", &VAR_3) &&
VAR_0->auth_type <= HTTP_AUTH_BASIC) { VAR_0->auth_type = HTTP_AUTH_BASIC; VAR_0->realm[0] = 0; VAR_0->stale = 0; ff_parse_key_value(VAR_3, (ff_parse_key_val_cb) handle_basic_params,
VAR_0); } else if (av_stristart(VAR_2, "Digest ", &VAR_3) && VAR_0->auth_type <= HTTP_AUTH_DIGEST) { VAR_0->auth_type = HTTP_AUTH_DIGEST; memset(&VAR_0->digest_params, 0, sizeof(DigestParams)); VAR_0->realm[0] = 0; VAR_0->stale = 0; ff_parse_key_value(VAR_3, (ff_parse_key_val_cb) handle_digest_params,
VAR_0); choose_qop(VAR_0->digest_params.qop,
sizeof(VAR_0->digest_params.qop)); if (!av_strcasecmp(VAR_0->digest_params.stale, "true"))
VAR_0->stale = 1; } } else if (!strcmp(VAR_1, "Authentication-Info")) { ff_parse_key_value(VAR_2, (ff_parse_key_val_cb) handle_digest_update,
VAR_0); } }