[FFmpeg-devel] libavformat/http: add support for content_type option in listen mode

Submitted by Moritz Barsnick on Aug. 10, 2016, 7:18 p.m.

Details

Message ID 1470856680-4536-1-git-send-email-barsnick@gmx.net
State Accepted
Commit d14993478cd9d6274f439f3200ea11c63ff8e0fa
Headers show

Commit Message

Moritz Barsnick Aug. 10, 2016, 7:18 p.m.
Instead of silently ignoring the content_type option in listen mode,
apply its value to the provided "Content-Type:" header.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
---
 doc/protocols.texi | 2 +-
 libavformat/http.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Moritz Barsnick Aug. 13, 2016, 12:37 p.m.
On Wed, Aug 10, 2016 at 21:18:00 +0200, Moritz Barsnick wrote:
> Instead of silently ignoring the content_type option in listen mode,
> apply its value to the provided "Content-Type:" header.
> 
> Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
> ---
>  doc/protocols.texi | 2 +-
>  libavformat/http.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Ping.
Nicolas George Aug. 13, 2016, 12:42 p.m.
Le quartidi 24 thermidor, an CCXXIV, Moritz Barsnick a écrit :
> Instead of silently ignoring the content_type option in listen mode,
> apply its value to the provided "Content-Type:" header.
> 
> Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
> ---
>  doc/protocols.texi | 2 +-
>  libavformat/http.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Looks ok, but I do not maintain that file.

Regards,
Michael Niedermayer Aug. 14, 2016, 8:45 a.m.
On Sat, Aug 13, 2016 at 02:42:43PM +0200, Nicolas George wrote:
> Le quartidi 24 thermidor, an CCXXIV, Moritz Barsnick a écrit :
> > Instead of silently ignoring the content_type option in listen mode,
> > apply its value to the provided "Content-Type:" header.
> > 
> > Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
> > ---
> >  doc/protocols.texi | 2 +-
> >  libavformat/http.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> Looks ok, but I do not maintain that file.

the maintainer is on vacation till end of august IIUC
thus applied

thx

[...]

Patch hide | download patch | download mbox

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 5767e23..470c99c 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -276,7 +276,7 @@  value is -1.
 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.
+Set a specific content type for the POST messages or for listen mode.
 
 @item http_proxy
 set HTTP proxy to tunnel through e.g. http://example.com:1234
diff --git a/libavformat/http.c b/libavformat/http.c
index 51275d9..cbeaebf 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -355,7 +355,7 @@  static int http_write_reply(URLContext* h, int status_code)
     case 200:
         reply_code = 200;
         reply_text = "OK";
-        content_type = "application/octet-stream";
+        content_type = s->content_type ? s->content_type : "application/octet-stream";
         break;
     case AVERROR_HTTP_SERVER_ERROR:
     case 500: