NPAPI:HTTPRedirectHandling

From MozillaWiki
Jump to navigation Jump to search

Status

Under consideration.

Contributors

  • Last modified: October 8, 2010
  • Authors: Rudi Sherry (Adobe), Josh Aas (Mozilla)
  • Contributors: Darin Fisher (Google), Dimcho Balev (Adobe), Deneb Meketa (Adobe)

Overview

We need to allow plugins to participate in HTTP redirect handling.

Specification

Disabling Redirects

Plugins can disable HTTP redirects entirely by setting the following variable:

NPPVpluginRequestsNoHTTPRedirects = 22

Redirect Handler

Plugins can query for support for this specification using the following variable:

...

The following function in the NPAPI plugin function table can be implemented to allow for HTTP redirect handling:

 int32 NPP_URLNotifyRedirect(NPP instance, const char* url, int32 status, void* notifyData);
  • instance: the plug-in instance that made the request
  • url: the new redirected url
  • status: the status code returned from the server (will be 3xx)
  • notifyData: the data passed into NPN_PostURLNotify() or NPN_GetURLNotify()

Plugins should return "NPERR_NO_ERR" when the redirect is to be allowed, and when this happens there may be further redirect notifications. Any other return value will disallow the redirect and the browser will subsequently issue an "NPP_URLNotify" call with reason "NPRES_USER_BREAK" and the last redirected url (the same one passed to the NPP_URLNotifyRedirect the last time)

The existence of a slot for this handler in the plugin's function table can be confirmed by querying the following version number:

 NPVERS_HAS_HTTP_REDIRECT_HANDLER = 26

The slot in the function table can be NULL, in which case the browser will not send redirect information. [What is the default behavior?]