mpjpeg: Use proper CR/LF in multipart headers

Message ID 20170510205915.87897-1-martin@martin.st
State Committed
Commit 6ccf76aec73b2cd598bb1e65d126d8a12540c411
Headers show

Commit Message

Martin Storsjö May 10, 2017, 8:59 p.m.
This is more correct.
---
 libavformat/mpjpeg.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Luca Barbato May 10, 2017, 11:21 p.m. | #1
On 5/10/17 10:59 PM, Martin Storsjö wrote:
> This is more correct.
> ---
>  libavformat/mpjpeg.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
> index 1a78c32274..3b78cab225 100644
> --- a/libavformat/mpjpeg.c
> +++ b/libavformat/mpjpeg.c
> @@ -26,7 +26,7 @@
>  
>  static int mpjpeg_write_header(AVFormatContext *s)
>  {
> -    avio_printf(s->pb, "--%s\n", BOUNDARY_TAG);
> +    avio_printf(s->pb, "--%s\r\n", BOUNDARY_TAG);
>      avio_flush(s->pb);
>      return 0;
>  }
> @@ -34,12 +34,12 @@ static int mpjpeg_write_header(AVFormatContext *s)
>  static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
>  {
>      avio_printf(s->pb,
> -                "Content-length: %i\n"
> -                "Content-type: image/jpeg\n\n",
> +                "Content-length: %i\r\n"
> +                "Content-type: image/jpeg\r\n\r\n",
>                  pkt->size);
>      avio_write(s->pb, pkt->data, pkt->size);
>  
> -    avio_printf(s->pb, "\n--%s\n", BOUNDARY_TAG);
> +    avio_printf(s->pb, "\r\n--%s\r\n", BOUNDARY_TAG);
>      return 0;
>  }
>  
> 

Sure!

Patch

diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
index 1a78c32274..3b78cab225 100644
--- a/libavformat/mpjpeg.c
+++ b/libavformat/mpjpeg.c
@@ -26,7 +26,7 @@ 
 
 static int mpjpeg_write_header(AVFormatContext *s)
 {
-    avio_printf(s->pb, "--%s\n", BOUNDARY_TAG);
+    avio_printf(s->pb, "--%s\r\n", BOUNDARY_TAG);
     avio_flush(s->pb);
     return 0;
 }
@@ -34,12 +34,12 @@  static int mpjpeg_write_header(AVFormatContext *s)
 static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     avio_printf(s->pb,
-                "Content-length: %i\n"
-                "Content-type: image/jpeg\n\n",
+                "Content-length: %i\r\n"
+                "Content-type: image/jpeg\r\n\r\n",
                 pkt->size);
     avio_write(s->pb, pkt->data, pkt->size);
 
-    avio_printf(s->pb, "\n--%s\n", BOUNDARY_TAG);
+    avio_printf(s->pb, "\r\n--%s\r\n", BOUNDARY_TAG);
     return 0;
 }