diff --git a/libavformat/http.c b/libavformat/http.c
index 56f8021025fcfb08bc678a4e4788e6d7d034aea4..4e2152f5eff4ec22b4d40a213bdfb0c5641f897c 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -291,6 +291,10 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
     if (post) {
         /* always use chunked encoding for upload data */
         s->chunksize = 0;
+        /* 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;
     }