History

http: Fix decetion of range support in HTTP servers

currently libavformat only allows seeking if a request with "Range: 0-" results in a 206 reply from the HTTP server which includes a Content-Range header. But according to RFC 2616, the server may also reply with a normal 200 reply (which is more efficient for a request for the whole file). In fact Apache HTTPD 2.2.20 has changed the behaviour in this way and it looks like this change will be kept in future versions. The fix for libavformat is easy: Also look at the Accept-Ranges header.

Stefan Fritsch committed 15 years ago

Commit 31dfc491 parent 23a287e1 file · +2 −0Browse files

Unified · Split

libavformat/http.c+2−0
@@ -265,6 +265,8 @@ static int process_line(URLContext *h, char *line, int line_count, · 264 unmodified lines
265265 s->filesize = atoll(slash+1);
266266 }
267267 h->is_streamed = 0; /* we _can_ in fact seek */
268+ } else if (!strcasecmp (tag, "Accept-Ranges") && !strncmp (p, "bytes", 5)) {
269+ h->is_streamed = 0;
268270 } else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
269271 s->filesize = -1;
270272 s->chunksize = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t