Plugins:GenericHttpMethod: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 7: Line 7:
# The plugin API only supports GET and POST. It would be desirable to support other methods defined in [http://tools.ietf.org/html/rfc2616 RFC 2616], such as [http://tools.ietf.org/html/rfc2616#section-9.7 DELETE], [http://tools.ietf.org/html/rfc2616#section-9.2 OPTIONS], and [http://tools.ietf.org/html/rfc2616#section-9.6 PUT], and also extension methods such as [http://tools.ietf.org/html/rfc4918#section-9.1 PROPFIND] (WebDAV) or [http://tools.ietf.org/html/draft-dusseault-http-patch PATCH].
# The plugin API only supports GET and POST. It would be desirable to support other methods defined in [http://tools.ietf.org/html/rfc2616 RFC 2616], such as [http://tools.ietf.org/html/rfc2616#section-9.7 DELETE], [http://tools.ietf.org/html/rfc2616#section-9.2 OPTIONS], and [http://tools.ietf.org/html/rfc2616#section-9.6 PUT], and also extension methods such as [http://tools.ietf.org/html/rfc4918#section-9.1 PROPFIND] (WebDAV) or [http://tools.ietf.org/html/draft-dusseault-http-patch PATCH].
# HTTP request headers can only be set for POST (see [https://developer.mozilla.org/en/NPN_PostURLNotify NPN_PostURLNotify]), but not for GET ([https://developer.mozilla.org/en/NPN_GetURLNotify NPN_GetURLNotify]). This makes it hard to access content-negotiated resources.
# HTTP request headers can only be set for POST (see [https://developer.mozilla.org/en/NPN_PostURLNotify NPN_PostURLNotify]), but not for GET ([https://developer.mozilla.org/en/NPN_GetURLNotify NPN_GetURLNotify]). This makes it hard to access content-negotiated resources.
# There is unsufficient control over handling HTTP redirects (need details).
# There is insufficient control over handling HTTP redirects (need details).
# Confusion about how invalid URLs (for instance, containing non-ASCII characters or whitespace) need to be handled.
# Confusion about how invalid URLs (for instance, containing non-ASCII characters or whitespace) need to be handled.



Revision as of 12:19, 21 August 2009

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)