diff --git a/libavformat/http.c b/libavformat/http.c
index 2e43dd627d6a0b0d7045099a907c0ae4037e24d6..344507ef8dd70d1e3dd59adc35d9d62ced722bca 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -461,7 +461,8 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
          * send Expect: 100-continue to get the 401 response including the
          * WWW-Authenticate header, or an 100 continue if no auth actually
          * is needed. */
-        if (auth && s->auth_state.auth_type == HTTP_AUTH_NONE &&
+        if (auth && *auth &&
+            s->auth_state.auth_type == HTTP_AUTH_NONE &&
             s->http_code != 401)
             send_expect_100 = 1;
     }