Plugins:GenericHttpMethod: Difference between revisions

Jump to navigation Jump to search
Line 25: Line 25:
= Current Proposal =
= Current Proposal =


* Last modified: August 24, 2009
* Last modified: August 25, 2009
* Author: Darin Fisher (Google) and Julian Reschke (greenbytes)
* Author: Darin Fisher (Google) and Julian Reschke (greenbytes)
* Contributors: Ian Melven (Adobe)
* Contributors: Ian Melven (Adobe)
Line 34: Line 34:
NPError NPN_HttpRequest(
NPError NPN_HttpRequest(
   NPP instance,
   NPP instance,
  PRUInt64 flags, // control redirects etc
   const char* method,
   const char* method,
   const char* url,
   const char* url,
Line 44: Line 45:
</pre>
</pre>


and have a matching plugin method that would be called as soon as status line and response headers are received (see [http://www.w3.org/TR/XMLHttpRequest/#headers-received-state headers-received state in XmlHttpRequest]):
and have a matching plugin method that would be called everytime the state of the request state changes (see [http://www.w3.org/TR/XMLHttpRequest/#states XHR states]).


<pre>
<pre>
void NPP_HttpResponseNotify(
void NPP_HttpResponseNotify(
  int requestState,
   NPP instance,
   NPP instance,
   const char* url,
   const char* url,
   int status,
   int httpResponseStatus,
   const char* headers, // potentially including the status line
   const char* headers, // potentially including the status line
   void* notifyData);
   void* notifyData);
</pre>
</pre>


Another callback would then be needed to signal the final result.
A callback with requestState == [http://www.w3.org/TR/XMLHttpRequest/#done-state DONE] would then signal the completion of the request.


To address potential security issues with certain HTTP methods (for instance, TRACE), and to allow easier deployment, support for methods other than GET and POST would only be RECOMMENDED, and a new status code (see below) allows the caller to detect this condition.
To address potential security issues with certain HTTP methods (for instance, TRACE), and to allow easier deployment, support for methods other than GET and POST would only be RECOMMENDED, and a new status code (see below) allows the caller to detect this condition.
Line 67: Line 69:
=== Open Issues ===
=== Open Issues ===


* Extend the NPN_RequestURLNotify with a flags parameter controlling how redirects are handled (and leaving room for future extensions?)
* Do we need a separate callback for the final state (as in NPN_PostURLNotify, or should we just keep calling NPP_HttpResponseNotify and add a status field as in XmlHttpRequest?)
* Do we need a separate callback for the final state (as in NPN_PostURLNotify, or should we just keep calling NPP_HttpResponseNotify and add a status field as in XmlHttpRequest?)
88

edits

Navigation menu