summaryrefslogtreecommitdiff
path: root/libavformat/httpauth.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-14 02:04:18 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-14 02:10:11 +0100
commit6968a7d1938cc009bad7a971f26d85ed271747ef (patch)
treeeb106dfbdfe9a7bc9d7fe53ead7b56c725d406fe /libavformat/httpauth.c
parentc2e3b564b32d596f5a66d47409f9e07a067a3084 (diff)
parent972880f597d74673a04d3ea8540864ae715ce9a6 (diff)
downloadffmpeg-6968a7d1938cc009bad7a971f26d85ed271747ef.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: doc/general: update supported devices table. doc/general: add missing @tab to codecs table. h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction. avconv: reindent avconv: link '-passlogfile' option to libx264 'stats' AVOption. libx264: add 'stats' private option for setting 2pass stats filename. libx264: fix help text for slice-max-size option. http: Clear the auth state on redirects http: Retry auth if it failed due to being stale rtsp: Resend new keepalive commands if they used stale auth rtsp: Retry authentication if failed due to being stale httpauth: Parse the stale field in digest auth dxva2_vc1: pass the overlap flag to the decoder dxva2_vc1: fix decoding of BI frames FATE: add shorthand to wavpack test dfa: convert to bytestream2 API anm decoder: move buffer allocation from decode_init() to decode_frame() h264: improve parsing of broken AVC SPS Conflicts: ffmpeg.c libavcodec/anm.c libavcodec/dfa.c libavcodec/h264.c libavcodec/h264_direct.c libavcodec/h264_ps.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/httpauth.c')
-rw-r--r--libavformat/httpauth.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
index ba31c1a9aa..86cdac7f07 100644
--- a/libavformat/httpauth.c
+++ b/libavformat/httpauth.c
@@ -57,6 +57,9 @@ static void handle_digest_params(HTTPAuthState *state, const char *key,
} else if (!strncmp(key, "qop=", key_len)) {
*dest = digest->qop;
*dest_len = sizeof(digest->qop);
+ } else if (!strncmp(key, "stale=", key_len)) {
+ *dest = digest->stale;
+ *dest_len = sizeof(digest->stale);
}
}
@@ -93,6 +96,7 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
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) &&
@@ -100,10 +104,13 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
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,
@@ -237,6 +244,9 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
{
char *authstr = NULL;
+ /* Clear the stale flag, we assume the auth is ok now. It is reset
+ * by the server headers if there's a new issue. */
+ state->stale = 0;
if (!auth || !strchr(auth, ':'))
return NULL;