aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-12 04:53:14 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-12 04:53:54 +0100
commitcd25412f598404e2af9e70038cfc01f344ba043b (patch)
treeff89428dfb48b614dc61e087e92f69d106ae2666 /libavformat
parent0d487654ea8515d916f5d3b9e208fe39d9723fc5 (diff)
parent2572d07c1f0abd9e2bf3ed20dbe35c58f1dd6ac4 (diff)
downloadffmpeg-cd25412f598404e2af9e70038cfc01f344ba043b.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: http: Allow setting a Content-Type for POST requests Conflicts: libavformat/http.c See: c01d1d4ddf4d8240427341af1c077f6455243576 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/http.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index b3b8c3a62c..696afb0e96 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -51,7 +51,6 @@ typedef struct {
int http_code;
/* Used if "Transfer-Encoding: chunked" otherwise -1. */
int64_t chunksize;
- char *content_type;
int64_t off, end_off, filesize;
char *location;
HTTPAuthState auth_state;
@@ -59,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;
@@ -99,7 +99,7 @@ static const AVOption options[] = {
{"seekable", "control seekability of connection", OFFSET(seekable), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, D },
{"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", "force a content type", OFFSET(content_type), 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", 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 },
@@ -736,6 +736,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
if (!has_header(s->headers, "\r\nContent-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\nContent-Type: ") && s->content_type)
len += av_strlcatf(headers + len, sizeof(headers) - len,
"Content-Type: %s\r\n", s->content_type);