diff --git a/shell/browser/net/electron_url_loader_factory.cc b/shell/browser/net/electron_url_loader_factory.cc index bac50a86bb46..64c2a25d6727 100644 --- a/shell/browser/net/electron_url_loader_factory.cc +++ b/shell/browser/net/electron_url_loader_factory.cc @@ -9,6 +9,7 @@ #include #include "base/guid.h" +#include "base/strings/string_number_conversions.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" #include "mojo/public/cpp/bindings/binding.h" @@ -123,11 +124,16 @@ network::mojom::URLResponseHeadPtr ToResponseHead( } else { continue; } - // Some apps are passing content-type via headers, which is not accepted - // in NetworkService. - if (base::ToLowerASCII(iter.first) == "content-type") { + auto header_name_lowercase = base::ToLowerASCII(iter.first); + + if (header_name_lowercase == "content-type") { + // Some apps are passing content-type via headers, which is not accepted + // in NetworkService. head->headers->GetMimeTypeAndCharset(&head->mime_type, &head->charset); has_content_type = true; + } else if (header_name_lowercase == "content-length" && + iter.second.is_string()) { + base::StringToInt64(iter.second.GetString(), &head->content_length); } } } diff --git a/spec-main/api-protocol-spec.ts b/spec-main/api-protocol-spec.ts index 1202d3d2742e..4d391b3c7588 100644 --- a/spec-main/api-protocol-spec.ts +++ b/spec-main/api-protocol-spec.ts @@ -919,11 +919,11 @@ describe('protocol module', () => { await protocol.unregisterProtocol('stream'); }); - it('does not successfully play videos with stream: false on streaming protocols', async () => { - await streamsResponses(standardScheme, 'error'); + it('successfully plays videos when content is buffered (stream: false)', async () => { + await streamsResponses(standardScheme, 'play'); }); - it('successfully plays videos with stream: true on streaming protocols', async () => { + it('successfully plays videos when streaming content (stream: true)', async () => { await streamsResponses('stream', 'play'); });