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

Side by Side Diff: webkit/glue/resource_handle_impl.cc

Issue 46094: Fix our handling of mixed SSL / non-SSL content.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file replaces WebCore/platform/network/win/ResourceHandleWin.cpp with a 5 // This file replaces WebCore/platform/network/win/ResourceHandleWin.cpp with a
6 // platform-neutral implementation that simply defers almost entirely to 6 // platform-neutral implementation that simply defers almost entirely to
7 // ResouceLoaderBridge. 7 // ResouceLoaderBridge.
8 // 8 //
9 // This uses the same ResourceHandle.h header file that the rest of WebKit 9 // This uses the same ResourceHandle.h header file that the rest of WebKit
10 // uses, allowing us to avoid complicated changes. Our specific things are 10 // uses, allowing us to avoid complicated changes. Our specific things are
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 headerBuf.append(crlf); 409 headerBuf.append(crlf);
410 headerBuf.append((*it).first + sep + (*it).second); 410 headerBuf.append((*it).first + sep + (*it).second);
411 } 411 }
412 412
413 // TODO(jcampan): in the non out-of-process plugin case the request does not 413 // TODO(jcampan): in the non out-of-process plugin case the request does not
414 // have a origin_pid. Find a better place to set this. 414 // have a origin_pid. Find a better place to set this.
415 int origin_pid = request_.originPid(); 415 int origin_pid = request_.originPid();
416 if (origin_pid == 0) 416 if (origin_pid == 0)
417 origin_pid = base::GetCurrentProcId(); 417 origin_pid = base::GetCurrentProcId();
418 418
419 bool mixed_content =
420 webkit_glue::KURLToGURL(request_.mainDocumentURL()).SchemeIsSecure() &&
421 !url.SchemeIsSecure();
422
423 if (url.SchemeIs("data")) { 419 if (url.SchemeIs("data")) {
424 if (sync_load_response) { 420 if (sync_load_response) {
425 // This is a sync load. Do the work now. 421 // This is a sync load. Do the work now.
426 sync_load_response->url = url; 422 sync_load_response->url = url;
427 std::string data; 423 std::string data;
428 GetInfoFromDataUrl(sync_load_response->url, sync_load_response, 424 GetInfoFromDataUrl(sync_load_response->url, sync_load_response,
429 &sync_load_response->data, 425 &sync_load_response->data,
430 &sync_load_response->status); 426 &sync_load_response->status);
431 } else { 427 } else {
432 pending_ = true; 428 pending_ = true;
433 job_->ref(); // to be released when we get a OnCompletedRequest. 429 job_->ref(); // to be released when we get a OnCompletedRequest.
434 job_->ref(); // to be released when HandleDataUrl is completed. 430 job_->ref(); // to be released when HandleDataUrl is completed.
435 MessageLoop::current()->PostTask(FROM_HERE, 431 MessageLoop::current()->PostTask(FROM_HERE,
436 data_url_factory_.NewRunnableMethod( 432 data_url_factory_.NewRunnableMethod(
437 &ResourceHandleInternal::HandleDataUrl)); 433 &ResourceHandleInternal::HandleDataUrl));
438 } 434 }
439 return true; 435 return true;
440 } 436 }
441 437
438 Frame* frame = request_.frame();
439 std::string frame_origin = webkit_glue::FrameToOrigin(frame);
440 std::string main_frame_origin =
441 webkit_glue::FrameToOrigin(frame ? frame->tree()->top() : NULL);
442
442 // TODO(darin): is latin1 really correct here? It is if the strings are 443 // TODO(darin): is latin1 really correct here? It is if the strings are
443 // already ASCII (i.e., if they are already escaped properly). 444 // already ASCII (i.e., if they are already escaped properly).
444 // TODO(brettw) this should take parameter encoding into account when 445 // TODO(brettw) this should take parameter encoding into account when
445 // creating the GURLs. 446 // creating the GURLs.
446 bridge_.reset(ResourceLoaderBridge::Create( 447 bridge_.reset(ResourceLoaderBridge::Create(
447 webframe, 448 webframe,
448 webkit_glue::CStringToStdString(method), 449 webkit_glue::CStringToStdString(method),
449 url, 450 url,
450 policy_url, 451 policy_url,
451 referrer, 452 referrer,
453 frame_origin,
454 main_frame_origin,
452 webkit_glue::CStringToStdString(headerBuf.latin1()), 455 webkit_glue::CStringToStdString(headerBuf.latin1()),
453 load_flags_, 456 load_flags_,
454 origin_pid, 457 origin_pid,
455 FromTargetType(request_.targetType()), 458 FromTargetType(request_.targetType())));
456 mixed_content));
457 if (!bridge_.get()) 459 if (!bridge_.get())
458 return false; 460 return false;
459 461
460 if (request_.httpBody()) { 462 if (request_.httpBody()) {
461 // GET and HEAD requests shouldn't have http bodies. 463 // GET and HEAD requests shouldn't have http bodies.
462 DCHECK(method != "GET" && method != "HEAD"); 464 DCHECK(method != "GET" && method != "HEAD");
463 const Vector<FormDataElement>& elements = request_.httpBody()->elements(); 465 const Vector<FormDataElement>& elements = request_.httpBody()->elements();
464 size_t n = elements.size(); 466 size_t n = elements.size();
465 for (size_t i = 0; i < n; ++i) { 467 for (size_t i = 0; i < n; ++i) {
466 const FormDataElement& e = elements[static_cast<unsigned>(i)]; 468 const FormDataElement& e = elements[static_cast<unsigned>(i)];
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // if the request cannot be serviced from cache. We force the 'DontLoad' 778 // if the request cannot be serviced from cache. We force the 'DontLoad'
777 // cache policy at this point to ensure that we never hit the network for 779 // cache policy at this point to ensure that we never hit the network for
778 // this request. 780 // this request.
779 // 781 //
780 DCHECK(request.httpMethod() == "POST"); 782 DCHECK(request.httpMethod() == "POST");
781 request.setCachePolicy(ReturnCacheDataDontLoad); 783 request.setCachePolicy(ReturnCacheDataDontLoad);
782 return true; 784 return true;
783 } 785 }
784 786
785 } // namespace WebCore 787 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698