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
2572d07c
Commit
2572d07c
authored
Mar 06, 2014
by
Clément Bœsch
Committed by
Luca Barbato
Mar 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: Allow setting a Content-Type for POST requests
Signed-off-by:
Luca Barbato
<
lu_zero@gentoo.org
>
parent
fe568b3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
protocols.texi
doc/protocols.texi
+3
-0
http.c
libavformat/http.c
+6
-0
No files found.
doc/protocols.texi
View file @
2572d07c
...
...
@@ -95,6 +95,9 @@ This protocol accepts the following options:
@item chunked_post
If set to 1 use chunked Transfer-Encoding for posts, default is 1.
@item content_type
Set a specific content type for the POST messages.
@item headers
Set custom HTTP headers, can override built in default headers. The
value must be a string encoding the headers.
...
...
libavformat/http.c
View file @
2572d07c
...
...
@@ -58,6 +58,7 @@ typedef struct {
char
*
headers
;
char
*
mime_type
;
char
*
user_agent
;
char
*
content_type
;
/* Set if the server correctly handles Connection: close and will close
* the connection after feeding us the content. */
int
willclose
;
...
...
@@ -93,6 +94,7 @@ typedef struct {
static
const
AVOption
options
[]
=
{
{
"chunked_post"
,
"use chunked transfer-encoding for posts"
,
OFFSET
(
chunked_post
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
1
,
E
},
{
"headers"
,
"set custom HTTP headers, can override built in default headers"
,
OFFSET
(
headers
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
D
|
E
},
{
"content_type"
,
"set a specific content type for the POST messages"
,
OFFSET
(
content_type
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
D
|
E
},
{
"user_agent"
,
"override User-Agent header"
,
OFFSET
(
user_agent
),
AV_OPT_TYPE_STRING
,
{.
str
=
DEFAULT_USER_AGENT
},
0
,
0
,
D
},
{
"user-agent"
,
"override User-Agent header, for compatibility with ffmpeg"
,
OFFSET
(
user_agent
),
AV_OPT_TYPE_STRING
,
{.
str
=
DEFAULT_USER_AGENT
},
0
,
0
,
D
},
{
"multiple_requests"
,
"use persistent connections"
,
OFFSET
(
multiple_requests
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
D
|
E
},
...
...
@@ -605,6 +607,10 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
if
(
!
has_header
(
s
->
headers
,
"
\r\n
Content-Length: "
)
&&
s
->
post_data
)
len
+=
av_strlcatf
(
headers
+
len
,
sizeof
(
headers
)
-
len
,
"Content-Length: %d
\r\n
"
,
s
->
post_datalen
);
if
(
!
has_header
(
s
->
headers
,
"
\r\n
Content-Type: "
)
&&
s
->
content_type
)
len
+=
av_strlcatf
(
headers
+
len
,
sizeof
(
headers
)
-
len
,
"Content-Type: %s
\r\n
"
,
s
->
content_type
);
if
(
!
has_header
(
s
->
headers
,
"
\r\n
Icy-MetaData: "
)
&&
s
->
icy
)
{
len
+=
av_strlcatf
(
headers
+
len
,
sizeof
(
headers
)
-
len
,
"Icy-MetaData: %d
\r\n
"
,
1
);
...
...
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