Commit cbb93100 authored by mstorsjo's avatar mstorsjo

Fix bugs in the http custom header handling

Initialize the buffer av_strlcatf writes into.
Add the dash at the end of the Range header.

10l to me for not spotting it earlier


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23528 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 57efe671
...@@ -270,7 +270,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr, ...@@ -270,7 +270,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
HTTPContext *s = h->priv_data; HTTPContext *s = h->priv_data;
int post, err; int post, err;
char line[1024]; char line[1024];
char headers[1024]; char headers[1024] = "";
char *authstr = NULL; char *authstr = NULL;
int64_t off = s->off; int64_t off = s->off;
int len = 0; int len = 0;
...@@ -290,7 +290,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr, ...@@ -290,7 +290,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
sizeof(headers) - len); sizeof(headers) - len);
if (!has_header(s->headers, "\r\nRange: ")) if (!has_header(s->headers, "\r\nRange: "))
len += av_strlcatf(headers + len, sizeof(headers) - len, len += av_strlcatf(headers + len, sizeof(headers) - len,
"Range: bytes=%"PRId64"\r\n", s->off); "Range: bytes=%"PRId64"-\r\n", s->off);
if (!has_header(s->headers, "\r\nConnection: ")) if (!has_header(s->headers, "\r\nConnection: "))
len += av_strlcpy(headers + len, "Connection: close\r\n", len += av_strlcpy(headers + len, "Connection: close\r\n",
sizeof(headers)-len); sizeof(headers)-len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment