This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 72dc02e52ff544c18d09f4da1cccb96883143ae2
Author:     Romain Beauxis <[email protected]>
AuthorDate: Fri Aug 21 08:27:25 2026 -0500
Commit:     Romain Beauxis <[email protected]>
CommitDate: Thu Aug 27 13:43:01 2026 +0000

    tests/http: test response status line parsing
    
    Covers well formed status lines, a missing or non numeric status code, lines
    that do not start with an HTTP version, and status lines whose version or 
code
    does not respect the grammar of RFC 9112.
    
    The reference output records the current behavior: every one of those 
malformed
    lines is accepted, most of them as a 2xx success.
---
 libavformat/Makefile                              |  1 +
 libavformat/tests/.gitignore                      |  1 +
 libavutil/tests/md5.c => libavformat/tests/http.c | 50 +++++++++++------------
 tests/fate/libavformat.mak                        | 28 +++++++++++++
 tests/ref/fate/http-status-line                   | 44 ++++++++++++++++++++
 5 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 466f5d1894..038e0afd41 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -790,6 +790,7 @@ TESTPROGS = id3v2                                           
            \
 FIFO-MUXER-TESTPROGS-$(CONFIG_NETWORK)   += fifo_muxer
 TESTPROGS-$(CONFIG_FIFO_MUXER)           += $(FIFO-MUXER-TESTPROGS-yes)
 TESTPROGS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh
+TESTPROGS-$(CONFIG_HTTP_PROTOCOL)        += http
 TESTPROGS-$(CONFIG_NETWORK)              += noproxy
 TESTPROGS-$(CONFIG_SRTP)                 += srtp
 TESTPROGS-$(CONFIG_IMF_DEMUXER)          += imf
diff --git a/libavformat/tests/.gitignore b/libavformat/tests/.gitignore
index 1807488603..2be3cc8fac 100644
--- a/libavformat/tests/.gitignore
+++ b/libavformat/tests/.gitignore
@@ -9,3 +9,4 @@
 /srtp
 /url
 /seek_utils
+/http
diff --git a/libavutil/tests/md5.c b/libavformat/tests/http.c
similarity index 56%
copy from libavutil/tests/md5.c
copy to libavformat/tests/http.c
index 0ac8f2834e..c6afa378ad 100644
--- a/libavutil/tests/md5.c
+++ b/libavformat/tests/http.c
@@ -1,4 +1,6 @@
 /*
+ * Copyright (c) 2026 Romain Beauxis
+ *
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
@@ -16,40 +18,36 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <stdint.h>
 #include <stdio.h>
 
-#include "libavutil/md5.h"
+#include "libavformat/http.h"
 
-static void print_md5(uint8_t *md5)
+static void test(const char *line)
 {
-    int i;
-    for (i = 0; i < 16; i++)
-        printf("%02x", md5[i]);
-    printf("\n");
+    HTTPStatusLine st;
+    int ret;
+
+    printf("\"%s\"\n", line);
+
+    ret = ff_http_parse_status_line(NULL, line, &st);
+    if (ret < 0) {
+        printf("  rejected\n");
+        return;
+    }
+
+    printf("  version=\"%s\" code=%d willclose=%d reason=\"%s\"\n",
+           st.version, st.code, st.willclose, st.reason);
 }
 
-int main(void)
+int main(int argc, char **argv)
 {
-    uint8_t md5val[16];
-    int i;
-
-    uint8_t in[1000];
+    if (argc < 2) {
+        fprintf(stderr, "usage: %s <status line>...\n", argv[0]);
+        return 1;
+    }
 
-    for (i = 0; i < 1000; i++)
-        in[i] = i * i;
-    av_md5_sum(md5val, in, 1000);
-    print_md5(md5val);
-    av_md5_sum(md5val, in, 63);
-    print_md5(md5val);
-    av_md5_sum(md5val, in, 64);
-    print_md5(md5val);
-    av_md5_sum(md5val, in, 65);
-    print_md5(md5val);
-    for (i = 0; i < 1000; i++)
-        in[i] = i % 127;
-    av_md5_sum(md5val, in, 999);
-    print_md5(md5val);
+    for (int i = 1; i < argc; i++)
+        test(argv[i]);
 
     return 0;
 }
diff --git a/tests/fate/libavformat.mak b/tests/fate/libavformat.mak
index 09649fed11..f306e19245 100644
--- a/tests/fate/libavformat.mak
+++ b/tests/fate/libavformat.mak
@@ -12,6 +12,34 @@ fate-rename: libavformat/tests/rename$(EXESUF)
 fate-rename: CMD = run libavformat/tests/rename$(EXESUF)
 fate-rename: CMP = null
 
+FATE_HTTP_STATUS_LINES = \
+    "HTTP/1.1 200 OK"                    \
+    "HTTP/1.0 200 OK"                    \
+    "HTTP/1.1 404 Not Found"             \
+    "HTTP/1.1 500 Internal Server Error" \
+    "HTTP/1.1 204 No Content"            \
+    "HTTP/1.1 200"                       \
+    "HTTP/1.1"                           \
+    "HTTP/1.1 OK"                        \
+    "HTTP"                               \
+    "200 OK"                             \
+    "NOT A STATUS LINE"                  \
+    ""                                   \
+    "ICY 200 OK"                         \
+    "ICY 404 Not Found"                  \
+    "HTTP/1.1 200OK"                     \
+    "HTTP/1.1 +200 Plus"                 \
+    "HTTP/1.1 20 Short"                  \
+    "HTTP/1.1 2000 Four"                 \
+    "HTTP/x 200 Bad version"             \
+    "http/1.1 200 lowercase"             \
+    "HTTP/1.1 099 Too low"               \
+    "HTTP/1.1 600 Too high"
+
+FATE_LIBAVFORMAT-$(CONFIG_HTTP_PROTOCOL) += fate-http-status-line
+fate-http-status-line: libavformat/tests/http$(EXESUF)
+fate-http-status-line: CMD = run libavformat/tests/http$(EXESUF) 
$(FATE_HTTP_STATUS_LINES)
+
 FATE_LIBAVFORMAT-$(CONFIG_NETWORK) += fate-noproxy
 fate-noproxy: libavformat/tests/noproxy$(EXESUF)
 fate-noproxy: CMD = run libavformat/tests/noproxy$(EXESUF)
diff --git a/tests/ref/fate/http-status-line b/tests/ref/fate/http-status-line
new file mode 100644
index 0000000000..503ed9a59a
--- /dev/null
+++ b/tests/ref/fate/http-status-line
@@ -0,0 +1,44 @@
+"HTTP/1.1 200 OK"
+  version="1.1" code=200 willclose=0 reason=" OK"
+"HTTP/1.0 200 OK"
+  version="1.0" code=200 willclose=1 reason=" OK"
+"HTTP/1.1 404 Not Found"
+  version="1.1" code=404 willclose=0 reason=" Not Found"
+"HTTP/1.1 500 Internal Server Error"
+  version="1.1" code=500 willclose=0 reason=" Internal Server Error"
+"HTTP/1.1 204 No Content"
+  version="1.1" code=204 willclose=0 reason=" No Content"
+"HTTP/1.1 200"
+  version="1.1" code=200 willclose=0 reason=""
+"HTTP/1.1"
+  version="1.1" code=0 willclose=0 reason=""
+"HTTP/1.1 OK"
+  version="1.1" code=0 willclose=0 reason="OK"
+"HTTP"
+  version="" code=0 willclose=0 reason=""
+"200 OK"
+  version="" code=0 willclose=0 reason=""
+"NOT A STATUS LINE"
+  version="" code=0 willclose=0 reason=""
+""
+  version="" code=0 willclose=0 reason=""
+"ICY 200 OK"
+  version="" code=0 willclose=0 reason=""
+"ICY 404 Not Found"
+  version="" code=0 willclose=0 reason=""
+"HTTP/1.1 200OK"
+  version="1.1" code=200 willclose=0 reason="OK"
+"HTTP/1.1 +200 Plus"
+  version="1.1" code=200 willclose=0 reason=" Plus"
+"HTTP/1.1 20 Short"
+  version="1.1" code=20 willclose=0 reason=" Short"
+"HTTP/1.1 2000 Four"
+  version="1.1" code=2000 willclose=0 reason=" Four"
+"HTTP/x 200 Bad version"
+  version="x 2" code=200 willclose=0 reason=" Bad version"
+"http/1.1 200 lowercase"
+  version="1.1" code=200 willclose=0 reason=" lowercase"
+"HTTP/1.1 099 Too low"
+  version="1.1" code=99 willclose=0 reason=" Too low"
+"HTTP/1.1 600 Too high"
+  version="1.1" code=600 willclose=0 reason=" Too high"

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to