Merge commit '5ae178539b91d25710b7bb322d156c31aea9f8bf'
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 30 Jul 2015 14:23:09 +0000 (16:23 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 30 Jul 2015 14:24:03 +0000 (16:24 +0200)
* commit '5ae178539b91d25710b7bb322d156c31aea9f8bf':
  http: Add the trailing endlines if they are missing

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
1  2 
libavformat/http.c

@@@ -368,14 -287,18 +368,21 @@@ static int http_open(URLContext *h, con
  
      if (s->headers) {
          int len = strlen(s->headers);
-         if (len < 2 || strcmp("\r\n", s->headers + len - 2))
+         if (len < 2 || strcmp("\r\n", s->headers + len - 2)) {
              av_log(h, AV_LOG_WARNING,
                     "No trailing CRLF found in HTTP header.\n");
+             ret = av_reallocp(&s->headers, len + 3);
+             if (ret < 0)
+                 return ret;
+             s->headers[len]     = '\r';
+             s->headers[len + 1] = '\n';
+             s->headers[len + 2] = '\0';
+         }
      }
  
 +    if (s->listen) {
 +        return http_listen(h, uri, flags, options);
 +    }
      ret = http_open_cnx(h, options);
      if (ret < 0)
          av_dict_free(&s->chained_options);