Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
2bb1c713
Commit
2bb1c713
authored
Sep 28, 2011
by
Clément Bœsch
Committed by
Michael Niedermayer
Nov 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: add user_agent option.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
78317881
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
http.c
libavformat/http.c
+6
-2
No files found.
libavformat/http.c
View file @
2bb1c713
...
...
@@ -44,6 +44,7 @@ typedef struct {
int
line_count
;
int
http_code
;
int64_t
chunksize
;
/**< Used if "Transfer-Encoding: chunked" otherwise -1. */
char
*
user_agent
;
int64_t
off
,
filesize
;
char
location
[
MAX_URL_SIZE
];
HTTPAuthState
auth_state
;
...
...
@@ -56,9 +57,11 @@ typedef struct {
#define OFFSET(x) offsetof(HTTPContext, x)
#define D AV_OPT_FLAG_DECODING_PARAM
#define E AV_OPT_FLAG_ENCODING_PARAM
#define DEC AV_OPT_FLAG_DECODING_PARAM
static
const
AVOption
options
[]
=
{
{
"chunked_post"
,
"use chunked transfer-encoding for posts"
,
OFFSET
(
chunked_post
),
AV_OPT_TYPE_INT
,
{.
dbl
=
1
},
0
,
1
,
E
},
{
"headers"
,
"custom HTTP headers, can override built in default headers"
,
OFFSET
(
headers
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
D
|
E
},
{
"user-agent"
,
"override User-Agent header"
,
OFFSET
(
user_agent
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
NULL
}
};
#define HTTP_CLASS(flavor)\
...
...
@@ -342,8 +345,9 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
/* set default headers if needed */
if
(
!
has_header
(
s
->
headers
,
"
\r\n
User-Agent: "
))
len
+=
av_strlcatf
(
headers
+
len
,
sizeof
(
headers
)
-
len
,
"User-Agent: %s
\r\n
"
,
LIBAVFORMAT_IDENT
);
len
+=
av_strlcatf
(
headers
+
len
,
sizeof
(
headers
)
-
len
,
"User-Agent: %s
\r\n
"
,
s
->
user_agent
?
s
->
user_agent
:
LIBAVFORMAT_IDENT
);
if
(
!
has_header
(
s
->
headers
,
"
\r\n
Accept: "
))
len
+=
av_strlcpy
(
headers
+
len
,
"Accept: */*
\r\n
"
,
sizeof
(
headers
)
-
len
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment