Message ID | 1470856706-4579-1-git-send-email-barsnick@gmx.net |
---|---|
State | Superseded |
Headers | show |
On Wed, Aug 10, 2016 at 09:18:26PM +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(-) > > diff --git a/libavformat/http.c b/libavformat/http.c > index cbeaebf..70d64af 100644 > --- a/libavformat/http.c > +++ b/libavformat/http.c > @@ -371,11 +371,13 @@ 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, > + s->headers ? s->headers : "", > strlen(reply_text) + 6, // 3 digit status code + space + \r\n > reply_code, > reply_text); these look wrogly ordered libavformat/http.c: In function ‘http_write_reply’: libavformat/http.c:383:18: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 7 has type ‘const char *’ [-Wformat] libavformat/http.c:383:18: warning: format ‘%s’ expects argument of type ‘char *’, but argument 8 has type ‘size_t’ [-Wformat] libavformat/http.c:383:18: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 7 has type ‘const char *’ [-Wformat] libavformat/http.c:383:18: warning: format ‘%s’ expects argument of type ‘char *’, but argument 8 has type ‘size_t’ [-Wformat] [...]
Sorry, I shouldn't have refactored and remerged without testing. Big mistake. Fixed (and tested) patch attached. Moritz
diff --git a/libavformat/http.c b/libavformat/http.c index cbeaebf..70d64af 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -371,11 +371,13 @@ 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, + s->headers ? s->headers : "", strlen(reply_text) + 6, // 3 digit status code + space + \r\n reply_code, reply_text); @@ -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)
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(-)