summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-07-23 21:14:09 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-07-30 11:21:26 +0200
commit5ae178539b91d25710b7bb322d156c31aea9f8bf (patch)
tree94e966520b963372582eeba2febb938e18de05f5 /libavformat/http.c
parentbf0cef5c3a114df452e5476167634dd8f51eb448 (diff)
http: Add the trailing endlines if they are missing
Makes slightly easier the life of those want to use the option from the command line
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index 3b9aa2d4a1..b3e9771757 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -287,9 +287,16 @@ static int http_open(URLContext *h, const char *uri, int flags,
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';
+ }
}
ret = http_open_cnx(h, options);