char location[URL_SIZE];
HTTPAuthState auth_state;
unsigned char headers[BUFFER_SIZE];
+ int willclose; /**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */
} HTTPContext;
#define OFFSET(x) offsetof(HTTPContext, x)
ff_http_auth_handle_header(&s->auth_state, tag, p);
} else if (!strcmp (tag, "Authentication-Info")) {
ff_http_auth_handle_header(&s->auth_state, tag, p);
+ } else if (!strcmp (tag, "Connection")) {
+ if (!strcmp(p, "close"))
+ s->willclose = 1;
}
}
return 1;
s->line_count = 0;
s->off = 0;
s->filesize = -1;
+ s->willclose = 0;
if (post) {
/* Pretend that it did work. We didn't read any header yet, since
* we've still to send the POST data, but the code calling this
memcpy(buf, s->buf_ptr, len);
s->buf_ptr += len;
} else {
+ if (!s->willclose && s->filesize >= 0 && s->off >= s->filesize)
+ return AVERROR_EOF;
len = url_read(s->hd, buf, size);
}
if (len > 0) {