diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
index 4f79c78edc..ef82c01d36 100644
--- a/libavformat/httpauth.c
+++ b/libavformat/httpauth.c
@@ -101,6 +101,10 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
                                state);
         } else if (av_stristart(value, "Digest ", &p) &&
                    state->auth_type <= HTTP_AUTH_DIGEST) {
+
+            if (!strcmp(state->digest_params.algorithm, "MD5"))
+                return;
+
             state->auth_type = HTTP_AUTH_DIGEST;
             memset(&state->digest_params, 0, sizeof(DigestParams));
             state->realm[0] = 0;
