[FFmpeg-devel] [PATCH 3/3] Only allow posting data and/or forcing a 200 code, enabling posting isml chunks, -after- we did a possible first request to get a 403 from the server telling us which type of authentication to apply Final part fix #3036

Jakob van Bethlehem jakob at jet-stream.nl
Wed Oct 9 10:25:34 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 | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index b34683a..099808b 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -678,9 +678,14 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
     if ((err = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0)
         return err;
 
-    if (s->post_data)
-        if ((err = ffurl_write(s->hd, s->post_data, s->post_datalen)) < 0)
-            return err;
+    // Protect posting data from proceeding if still in an authorization pass
+    if (!auth_phase && post) {
+        if (s->post_data)
+            if ((err = ffurl_write(s->hd, s->post_data, s->post_datalen)) < 0)
+                return err;
+        s->http_code = 200;
+        return 0;
+    }
 
     /* init input buffer */
     s->buf_ptr = s->buffer;
@@ -692,13 +697,6 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
     s->willclose = 0;
     s->end_chunked_post = 0;
     s->end_header = 0;
-    if (post && !s->post_data) {
-        /* Pretend that it did work. We didn't read any header yet, since
-         * we've still to send the POST data, but the code calling this
-         * function will check http_code after we return. */
-        s->http_code = 200;
-        return 0;
-    }
 
     /* wait for header */
     err = http_read_header(h, new_location);
-- 
1.7.12.4 (Apple Git-37)



More information about the ffmpeg-devel mailing list