X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fhttp.c;h=adb3d92e2125d278cd7cee90d5797a4bab9f487f;hb=92916e8542e425ca20daddb490261a5818643206;hp=51275d9960530643cf380e0f41b41d859570ee87;hpb=3c058f570128dcfa3a68f0860e2be7f098e8d6e1;p=ffmpeg diff --git a/libavformat/http.c b/libavformat/http.c index 51275d99605..adb3d92e212 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: @@ -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)