diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-03-16 04:06:49 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-16 04:06:49 +0100 |
commit | 9ae2aaea501d6fe743b24e732dffd80134c36698 (patch) | |
tree | f89f61d63052aa912b83a9c621f453e8d3bfb606 | |
parent | 251331491299ae89732203edc16d9b6a06f2bd79 (diff) | |
parent | cd874cf8e69f1b31986fd978577994b45efa3d5c (diff) | |
download | ffmpeg-9ae2aaea501d6fe743b24e732dffd80134c36698.tar.gz |
Merge commit 'cd874cf8e69f1b31986fd978577994b45efa3d5c' into release/2.2
* commit 'cd874cf8e69f1b31986fd978577994b45efa3d5c':
http: Allow setting a Content-Type for POST requests
Conflicts:
libavformat/http.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/protocols.texi | 6 | ||||
-rw-r--r-- | libavformat/http.c | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/doc/protocols.texi b/doc/protocols.texi index 5577f753d9..01c1a4998d 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -225,6 +225,9 @@ value is -1. @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. @@ -235,9 +238,6 @@ Use persistent connections if set to 1, default is 0. @item post_data Set custom HTTP post data. -@item content_type -Force a content type. - @item user-agent @item user_agent Override the User-Agent header. If not specified the protocol will use a diff --git a/libavformat/http.c b/libavformat/http.c index 51824e9b20..767c66d437 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); |