s->hd = hd;
if (http_connect(h, path, hoststr, auth, &location_changed) < 0)
goto fail;
- if (s->http_code == 303 && location_changed == 1) {
+ if ((s->http_code == 302 || s->http_code == 303) && location_changed == 1) {
/* url moved, get next */
url_close(hd);
if (redirects++ >= MAX_REDIRECTS)
s = av_malloc(sizeof(HTTPContext));
if (!s) {
- return -ENOMEM;
+ return AVERROR(ENOMEM);
}
h->priv_data = s;
s->filesize = -1;
"Range: bytes=%"PRId64"-\r\n"
"Host: %s\r\n"
"Authorization: Basic %s\r\n"
+ "Connection: close\r\n"
"\r\n",
post ? "POST" : "GET",
path,