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

Submitted by Moritz Barsnick on Aug. 11, 2016, 9:29 a.m.

Details

Message ID 1470907747-5945-2-git-send-email-barsnick@gmx.net
State Accepted
Commit e8b355a0288ce8f575cc12cce7e7b7b0dae62525
Headers show

Commit Message

Moritz Barsnick Aug. 11, 2016, 9:29 a.m.
Instead of silently ignoring the headers option in listen mode, use
the provided headers.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
---
 libavformat/http.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Aug. 11, 2016, 10:02 p.m.
On Thu, Aug 11, 2016 at 11:29:07AM +0200, Moritz Barsnick wrote:
> Instead of silently ignoring the headers option in listen mode, use
> the provided headers.
> 
> Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
> ---
>  libavformat/http.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

applied

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/http.c b/libavformat/http.c
index cbeaebf..adb3d92 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -371,12 +371,14 @@  static int http_write_reply(URLContext* h, int status_code)
                  "HTTP/1.1 %03d %s\r\n"
                  "Content-Type: %s\r\n"
                  "Content-Length: %"SIZE_SPECIFIER"\r\n"
+                 "%s"
                  "\r\n"
                  "%03d %s\r\n",
                  reply_code,
                  reply_text,
                  content_type,
                  strlen(reply_text) + 6, // 3 digit status code + space + \r\n
+                 s->headers ? s->headers : "",
                  reply_code,
                  reply_text);
     } else {
@@ -385,10 +387,12 @@  static int http_write_reply(URLContext* h, int status_code)
                  "HTTP/1.1 %03d %s\r\n"
                  "Content-Type: %s\r\n"
                  "Transfer-Encoding: chunked\r\n"
+                 "%s"
                  "\r\n",
                  reply_code,
                  reply_text,
-                 content_type);
+                 content_type,
+                 s->headers ? s->headers : "");
     }
     av_log(h, AV_LOG_TRACE, "HTTP reply header: \n%s----\n", message);
     if ((ret = ffurl_write(s->hd, message, message_len)) < 0)