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

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

Issue 185663002: Pass http response headers to the streamsPrivate API callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 } 603 }
604 } 604 }
605 return handler.Pass(); 605 return handler.Pass();
606 } 606 }
607 607
608 scoped_ptr<ResourceHandler> 608 scoped_ptr<ResourceHandler>
609 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, 609 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request,
610 ResourceResponse* response) { 610 ResourceResponse* response) {
611 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); 611 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
612 const std::string& mime_type = response->head.mime_type; 612 const std::string& mime_type = response->head.mime_type;
613 std::string response_headers;
614 if (response->head.headers)
615 response->head.headers->GetNormalizedHeaders(&response_headers);
613 616
614 GURL origin; 617 GURL origin;
615 std::string target_id; 618 std::string target_id;
616 if (!delegate_ || 619 if (!delegate_ ||
617 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), 620 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(),
618 request->url(), 621 request->url(),
619 mime_type, 622 mime_type,
620 &origin, 623 &origin,
621 &target_id)) { 624 &target_id)) {
622 return scoped_ptr<ResourceHandler>(); 625 return scoped_ptr<ResourceHandler>();
623 } 626 }
624 627
625 StreamContext* stream_context = 628 StreamContext* stream_context =
626 GetStreamContextForResourceContext(info->GetContext()); 629 GetStreamContextForResourceContext(info->GetContext());
627 630
628 scoped_ptr<StreamResourceHandler> handler( 631 scoped_ptr<StreamResourceHandler> handler(
629 new StreamResourceHandler(request, 632 new StreamResourceHandler(request,
630 stream_context->registry(), 633 stream_context->registry(),
631 origin)); 634 origin));
632 635
633 info->set_is_stream(true); 636 info->set_is_stream(true);
634 delegate_->OnStreamCreated( 637 delegate_->OnStreamCreated(
635 info->GetContext(), 638 info->GetContext(),
636 info->GetChildID(), 639 info->GetChildID(),
637 info->GetRouteID(), 640 info->GetRouteID(),
638 target_id, 641 target_id,
639 handler->stream()->CreateHandle(request->url(), mime_type), 642 handler->stream()->CreateHandle(request->url(), mime_type,
643 response_headers),
640 request->GetExpectedContentSize()); 644 request->GetExpectedContentSize());
641 return handler.PassAs<ResourceHandler>(); 645 return handler.PassAs<ResourceHandler>();
642 } 646 }
643 647
644 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( 648 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest(
645 net::URLRequest* request) { 649 net::URLRequest* request) {
646 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); 650 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
647 if (info) { 651 if (info) {
648 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); 652 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID());
649 if (loader) 653 if (loader)
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) 2000 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS)
1997 && !policy->CanReadRawCookies(child_id)) { 2001 && !policy->CanReadRawCookies(child_id)) {
1998 VLOG(1) << "Denied unauthorized request for raw headers"; 2002 VLOG(1) << "Denied unauthorized request for raw headers";
1999 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; 2003 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS;
2000 } 2004 }
2001 2005
2002 return load_flags; 2006 return load_flags;
2003 } 2007 }
2004 2008
2005 } // namespace content 2009 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698