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

Unified Diff: chrome_frame/npapi_url_request.cc

Issue 6381005: Implement a poor mans redirect handling in ChromeFrame for browsers which don... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/np_browser_functions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/npapi_url_request.cc
===================================================================
--- chrome_frame/npapi_url_request.cc (revision 71693)
+++ chrome_frame/npapi_url_request.cc (working copy)
@@ -6,6 +6,7 @@
#include "base/string_number_conversions.h"
#include "base/threading/platform_thread.h"
+#include "chrome_frame/chrome_frame_npapi.h"
#include "chrome_frame/np_browser_functions.h"
#include "chrome_frame/np_utils.h"
#include "net/base/net_errors.h"
@@ -370,6 +371,24 @@
}
DCHECK(request_map_.find(request->id()) != request_map_.end());
+
+ // If the host browser does not support the NPAPI redirect notification
+ // spec, and if the request URL is implicitly redirected, we need to
+ // inform Chrome about the redirect and allow it to follow the redirect.
+ // We achieve this by comparing the URL requested with the URL received in
+ // the response and if they don't match we assume a redirect. This would have
+ // a sideffect that two GET requests would be sent out in this case.
+ if (!BrowserSupportsRedirectNotification()) {
+ if (GURL(request->url().c_str()) != GURL(stream->url)) {
+ DVLOG(1) << "Request URL:"
+ << request->url()
+ << " was redirected to:"
+ << stream->url;
+ delegate_->OnResponseStarted(request->id(), "", "", 0, base::Time(),
+ stream->url, 302);
+ return NPERR_GENERIC_ERROR;
+ }
+ }
// We need to return the requested stream mode if we are returning a success
// code. If we don't do this it causes Opera to blow up.
*stream_type = NP_NORMAL;
« no previous file with comments | « chrome_frame/np_browser_functions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698