FFmpeg
Loading...
Searching...
No Matches
http.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Romain Beauxis
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <stdio.h>
22
23#include "libavformat/http.h"
24
25static void test(const char *line)
26{
28 int ret;
29
30 printf("\"%s\"\n", line);
31
33 if (ret < 0) {
34 printf(" rejected\n");
35 return;
36 }
37
38 printf(" version=\"%s\" code=%d willclose=%d reason=\"%s\"\n",
39 st.version, st.code, st.willclose, st.reason);
40}
41
42int main(int argc, char **argv)
43{
44 if (argc < 2) {
45 fprintf(stderr, "usage: %s <status line>...\n", argv[0]);
46 return 1;
47 }
48
49 for (int i = 1; i < argc; i++)
50 test(argv[i]);
51
52 return 0;
53}
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define NULL
Definition coverity.c:32
__device__ int printf(const char *,...)
int main
Definition dovi_rpuenc.c:38
int ff_http_parse_status_line(void *logctx, const char *line, HTTPStatusLine *st)
Parse the status line of an HTTP response.
Definition http.c:893
Parsed form of a response status line.
Definition http.h:33
int code
response status code
Definition http.h:35
const char * reason
reason phrase, points into the parsed line
Definition http.h:36
int willclose
the version implies the connection will close
Definition http.h:37
char version[4]
protocol version, e.g.
Definition http.h:34
static void test(const char *line)
Definition http.c:25