[FFmpeg-devel] [PATCH 1/3] Introduce auth_phase flag, which will be true if authorization needs to be sent, but the type of authorization is not known yet Partial fix #3036
Jakob van Bethlehem
jakob at jet-stream.nl
Wed Oct 9 10:25:32 CEST 2013
From: "J. van Bethlehem" <jakob at jet-stream.nl>
Signed-off-by: J. van Bethlehem <jakob at jet-stream.nl>
---
libavformat/http.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libavformat/http.c b/libavformat/http.c
index 1b21e47..5f016a7 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -574,7 +574,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
const char *proxyauth, int *new_location)
{
HTTPContext *s = h->priv_data;
- int post, err;
+ int post, err, auth_phase;
char headers[4096] = "";
char *authstr = NULL, *proxyauthstr = NULL;
int64_t off = s->off;
@@ -593,6 +593,13 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
}
method = post ? "POST" : "GET";
+
+ /* If auth is non-NULL, yet auth_state.auth_type is HTTP_AUTH_NONE,
+ * we have not yet sent any HTTP requests. In particular any
+ * POST requests need to be postponed until auth_type has
+ * been set to the right value
+ */
+ auth_phase = auth && s->auth_state.auth_type == HTTP_AUTH_NONE && s->http_code != 401;
authstr = ff_http_auth_create_response(&s->auth_state, auth, local_path,
method);
proxyauthstr = ff_http_auth_create_response(&s->proxy_auth_state, proxyauth,
--
1.7.12.4 (Apple Git-37)
More information about the ffmpeg-devel
mailing list