From a5b5f89612cf6e6e294fba6f047cd01550a777d7 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 30 Oct 2016 23:53:00 +0100 Subject: [PATCH] http_streamer: don't access headers before HeadersReceived. UpdateSize uses HttpResult::Length, which relies on the contetn-length header to be already received from the server. Doing it in ConnectionOpened will not work. Doing it from HeadersReceived, which is called a bit later, will work. This allows using the http_streamer in webkit for youtube video playing, and should fix all uses with a fixed size resource (rather than an endless stream). --- src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp b/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp index bc9df16997..7166c8b22e 100644 --- a/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp +++ b/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp @@ -43,12 +43,15 @@ public: void ConnectionOpened(BUrlRequest* request) { - fAdapterIO->UpdateSize(); - fRequest = request; fRunning = true; } + void HeadersReceived(BUrlRequest* request) + { + fAdapterIO->UpdateSize(); + } + void DataReceived(BUrlRequest* request, const char* data, off_t position, ssize_t size) {