1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

http: Clear the old URLContext pointer when closed

This fixes issues with opening http urls that have authentication
or redirects, introduced in commit e999b641.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö
2012-06-01 16:24:47 +03:00
parent b7c3772be8
commit 3cbcfa2dec

View File

@@ -161,6 +161,7 @@ static int http_open_cnx(URLContext *h)
if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) && if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) &&
s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {
ffurl_close(hd); ffurl_close(hd);
s->hd = hd = NULL;
goto redo; goto redo;
} else } else
goto fail; goto fail;
@@ -169,6 +170,7 @@ static int http_open_cnx(URLContext *h)
if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&
s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {
ffurl_close(hd); ffurl_close(hd);
s->hd = hd = NULL;
goto redo; goto redo;
} else } else
goto fail; goto fail;
@@ -177,6 +179,7 @@ static int http_open_cnx(URLContext *h)
&& location_changed == 1) { && location_changed == 1) {
/* url moved, get next */ /* url moved, get next */
ffurl_close(hd); ffurl_close(hd);
s->hd = hd = NULL;
if (redirects++ >= MAX_REDIRECTS) if (redirects++ >= MAX_REDIRECTS)
return AVERROR(EIO); return AVERROR(EIO);
/* Restart the authentication process with the new target, which /* Restart the authentication process with the new target, which