Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1585403004: Pass the content size in the content-length header for file:// streams. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: int64 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <algorithm> 10 #include <algorithm>
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 scoped_ptr<StreamInfo> stream_info(new StreamInfo); 818 scoped_ptr<StreamInfo> stream_info(new StreamInfo);
819 stream_info->handle = handler->stream()->CreateHandle(); 819 stream_info->handle = handler->stream()->CreateHandle();
820 stream_info->original_url = request->url(); 820 stream_info->original_url = request->url();
821 stream_info->mime_type = mime_type; 821 stream_info->mime_type = mime_type;
822 // Make a copy of the response headers so it is safe to pass across threads; 822 // Make a copy of the response headers so it is safe to pass across threads;
823 // the old handler (AsyncResourceHandler) may modify it in parallel via the 823 // the old handler (AsyncResourceHandler) may modify it in parallel via the
824 // ResourceDispatcherHostDelegate. 824 // ResourceDispatcherHostDelegate.
825 if (response->head.headers.get()) { 825 if (response->head.headers.get()) {
826 stream_info->response_headers = 826 stream_info->response_headers =
827 new net::HttpResponseHeaders(response->head.headers->raw_headers()); 827 new net::HttpResponseHeaders(response->head.headers->raw_headers());
828 } else if (stream_info->original_url.SchemeIsFile()) {
829 stream_info->response_headers = new net::HttpResponseHeaders(std::string());
830 stream_info->response_headers->AddHeader(
831 "content-length: " +
832 base::Int64ToString(response->head.content_length));
mmenke 2016/01/15 22:20:59 The PDF viewer uses the content-length header to m
mmenke 2016/01/15 22:29:14 If we go the bogus header route, wonder if we shou
Lei Zhang 2016/01/15 23:13:29 Sorry, I don't know anything about file URLS and "
Lei Zhang 2016/01/15 23:13:29 I can't speak for other places. The StreamInfo is
mmenke 2016/05/11 19:31:16 My preference, from a correctness standpoint, woul
828 } 833 }
829 delegate_->OnStreamCreated(request, std::move(stream_info)); 834 delegate_->OnStreamCreated(request, std::move(stream_info));
830 return std::move(handler); 835 return std::move(handler);
831 } 836 }
832 837
833 ResourceDispatcherHostLoginDelegate* 838 ResourceDispatcherHostLoginDelegate*
834 ResourceDispatcherHostImpl::CreateLoginDelegate( 839 ResourceDispatcherHostImpl::CreateLoginDelegate(
835 ResourceLoader* loader, 840 ResourceLoader* loader,
836 net::AuthChallengeInfo* auth_info) { 841 net::AuthChallengeInfo* auth_info) {
837 if (!delegate_) 842 if (!delegate_)
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 load_flags |= net::LOAD_PREFETCH; 2554 load_flags |= net::LOAD_PREFETCH;
2550 } 2555 }
2551 2556
2552 if (is_sync_load) 2557 if (is_sync_load)
2553 load_flags |= net::LOAD_IGNORE_LIMITS; 2558 load_flags |= net::LOAD_IGNORE_LIMITS;
2554 2559
2555 return load_flags; 2560 return load_flags;
2556 } 2561 }
2557 2562
2558 } // namespace content 2563 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698