NPAPI:GetRequestHeaders

From MozillaWiki
Jump to: navigation, search

The NPAPI currently allows adding HTTP headers to a POST request, by prepending them to the POST body in NPN_PostURL and NPN_PostURLNotify. We (Flash Runtime) would like for plugins to be able to add HTTP headers to GET requests as well.

We propose:

NPError NPN_GetURLNotifyHeaders
(
  NPP instance,
  const char* url,
  const char* target,
  void* notifyData,
  const char* headers
);


/* Identical to NPN_GetURLNotify, except for the new parameter 'headers',
 * which specifies additional request headers. These are separated by \n
 * characters (NOT \r\n), and terminated by \n\0 (NOT \n\n\0). The browser
 * appends these headers to the request verbatim, inserting them after the
 * headers automatically generated by the browser. The browser does NOT
 * attempt to detect conflicts between its own headers and those specified
 * by the plugin; if the plugin specifies headers that overlap with browser
 * headers, the conflicting headers will simply be sent verbatim. *