Plugins:GenericHttpMethod

Status

Under Consideration

Problem Summary

  1. The plugin API only supports GET and POST. It would be desirable to support other methods defined in RFC 2616, such as DELETE, OPTIONS, and PUT, and also extension methods such as PROPFIND (WebDAV) or PATCH.
  2. HTTP request headers can only be set for POST (see NPN_PostURLNotify), but not for GET (NPN_GetURLNotify). This makes it hard to access content-negotiated resources.
  3. There is insufficient control over handling HTTP redirects (need details).
  4. Confusion about how invalid URLs (for instance, containing non-ASCII characters or whitespace) need to be handled.

Existing Discussions and Documentation

Related Documentation

  • XMLHttpRequest (demonstrates that browsers already support the required functionality and could be used to define certain behaviors, such as how request headers are defaulted and combined)
  • Mark Nottingham's XmlHttpRequest Test Cases

API Requirements

Current Proposal

  • Last modified: Augus 19, 2009
  • Author: Darin Fisher (Google) and Julian Reschke (greenbytes)
  • Contributors: Ian Melven (Adobe)

The current proposal is to add a new method inspired by NPP_URLNotify, adding the missing pieces:

NPError NPN_RequestURLNotify(
  NPP instance,
  const char* method,
  const char* url,
  const char* target,
  const char* headers,
  PRUInt64 len,
  const char* buf,
  NPBool file,
  void* notifyData);

and have a matching plugin method providing all aspects of the HTTP response:

void NPP_ResponseURLNotify(
  NPP instance,
  const char* url,
  NPReason reason,
  int status,
  const char* headers,
  void* notifyData);

(Darin pointed out that this method is only called upon completion; it would be nice to have access to the response status and headers as soon as they are received though)