diff --git a/libavformat/http.c b/libavformat/http.c
index 2009621c1e12f4393a22fd0fcab6529019acd41f..cf4ccab7e0b935a5ba313eb317da5a49d84bb87e 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -901,6 +901,9 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
 
     if (whence == AVSEEK_SIZE)
         return s->filesize;
+    else if ((whence == SEEK_CUR && off == 0) ||
+             (whence == SEEK_SET && off == s->off))
+        return s->off;
     else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
         return AVERROR(ENOSYS);