diff --git a/modules/plugin/base/public/nsIPluginManager.h b/modules/plugin/base/public/nsIPluginManager.h index b65328545bbf..2bd3869dcde9 100644 --- a/modules/plugin/base/public/nsIPluginManager.h +++ b/modules/plugin/base/public/nsIPluginManager.h @@ -162,10 +162,13 @@ public: * URLs, even if the user currently has JavaScript disabled (usually * specify PR_FALSE) * @param postHeadersLength - the length of postHeaders (if non-NULL) - * @param postHeaders - the headers to POST. NULL specifies that there - * are no post headers - * @result - NS_OK if this operation was successful - */ + + * @param postHeaders - the headers to POST. Must be in the form of + * "HeaderName: HeaderValue\r\n". Each header, including the last, + * must be followed by "\r\n". NULL specifies that there are no + * post headers + + * @result - NS_OK if this operation was successful */ NS_IMETHOD PostURL(nsISupports* pluginInst, @@ -221,6 +224,35 @@ public: NS_IMETHOD UnregisterPlugin(REFNSIID aCID) = 0; + + /** + * Fetches a URL, with Headers + + * @see GetURL. Identical except for additional params headers and + * headersLen + + * @param getHeadersLength - the length of getHeaders (if non-NULL) + + * @param getHeaders - the headers to GET. Must be in the form of + * "HeaderName: HeaderValue\r\n". Each header, including the last, + * must be followed by "\r\n". NULL specifies that there are no + * get headers + + * @result - NS_OK if this operation was successful + + */ + + NS_IMETHOD + GetURLWithHeaders(nsISupports* pluginInst, + const char* url, + const char* target = NULL, + nsIPluginStreamListener* streamListener = NULL, + const char* altHost = NULL, + const char* referrer = NULL, + PRBool forceJSEnabled = PR_FALSE, + PRUint32 getHeadersLength = 0, + const char* getHeaders = NULL) = 0; + }; diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index a82d09f8d165..42ed29f8cab8 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -1533,6 +1533,20 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst, const char* altHost, const char* referrer, PRBool forceJSEnabled) +{ + return GetURLWithHeaders(pluginInst, url, target, streamListener, + altHost, referrer, forceJSEnabled, nsnull, nsnull); +} + +NS_IMETHODIMP nsPluginHostImpl::GetURLWithHeaders(nsISupports* pluginInst, + const char* url, + const char* target, + nsIPluginStreamListener* streamListener, + const char* altHost, + const char* referrer, + PRBool forceJSEnabled, + PRUint32 getHeadersLength, + const char* getHeaders) { nsAutoString string; string.AssignWithConversion(url); nsIPluginInstance *instance; @@ -1567,7 +1581,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst, else if (0 == PL_strcmp(target, "_current")) target = "_self"; - rv = owner->GetURL(url, target, nsnull, 0, nsnull, nsnull); + rv = owner->GetURL(url, target, nsnull, 0, (void *) getHeaders, + getHeadersLength); } NS_RELEASE(peer); @@ -1575,7 +1590,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst, } if (nsnull != streamListener) - rv = NewPluginURLStream(string, instance, streamListener); + rv = NewPluginURLStream(string, instance, streamListener, + nsnull, nsnull, getHeaders, getHeadersLength); NS_RELEASE(instance); } diff --git a/modules/plugin/base/src/nsPluginHostImpl.h b/modules/plugin/base/src/nsPluginHostImpl.h index f872c8222050..5a327e1e4c3b 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.h +++ b/modules/plugin/base/src/nsPluginHostImpl.h @@ -148,6 +148,17 @@ public: const char* referrer = NULL, PRBool forceJSEnabled = PR_FALSE); + NS_IMETHOD + GetURLWithHeaders(nsISupports* pluginInst, + const char* url, + const char* target = NULL, + nsIPluginStreamListener* streamListener = NULL, + const char* altHost = NULL, + const char* referrer = NULL, + PRBool forceJSEnabled = PR_FALSE, + PRUint32 getHeadersLength = 0, + const char* getHeaders = NULL); + NS_IMETHOD PostURL(nsISupports* pluginInst, const char* url, diff --git a/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/modules/plugin/nglsrc/nsPluginHostImpl.cpp index a82d09f8d165..42ed29f8cab8 100644 --- a/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -1533,6 +1533,20 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst, const char* altHost, const char* referrer, PRBool forceJSEnabled) +{ + return GetURLWithHeaders(pluginInst, url, target, streamListener, + altHost, referrer, forceJSEnabled, nsnull, nsnull); +} + +NS_IMETHODIMP nsPluginHostImpl::GetURLWithHeaders(nsISupports* pluginInst, + const char* url, + const char* target, + nsIPluginStreamListener* streamListener, + const char* altHost, + const char* referrer, + PRBool forceJSEnabled, + PRUint32 getHeadersLength, + const char* getHeaders) { nsAutoString string; string.AssignWithConversion(url); nsIPluginInstance *instance; @@ -1567,7 +1581,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst, else if (0 == PL_strcmp(target, "_current")) target = "_self"; - rv = owner->GetURL(url, target, nsnull, 0, nsnull, nsnull); + rv = owner->GetURL(url, target, nsnull, 0, (void *) getHeaders, + getHeadersLength); } NS_RELEASE(peer); @@ -1575,7 +1590,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst, } if (nsnull != streamListener) - rv = NewPluginURLStream(string, instance, streamListener); + rv = NewPluginURLStream(string, instance, streamListener, + nsnull, nsnull, getHeaders, getHeadersLength); NS_RELEASE(instance); } diff --git a/modules/plugin/nglsrc/nsPluginHostImpl.h b/modules/plugin/nglsrc/nsPluginHostImpl.h index f872c8222050..5a327e1e4c3b 100644 --- a/modules/plugin/nglsrc/nsPluginHostImpl.h +++ b/modules/plugin/nglsrc/nsPluginHostImpl.h @@ -148,6 +148,17 @@ public: const char* referrer = NULL, PRBool forceJSEnabled = PR_FALSE); + NS_IMETHOD + GetURLWithHeaders(nsISupports* pluginInst, + const char* url, + const char* target = NULL, + nsIPluginStreamListener* streamListener = NULL, + const char* altHost = NULL, + const char* referrer = NULL, + PRBool forceJSEnabled = PR_FALSE, + PRUint32 getHeadersLength = 0, + const char* getHeaders = NULL); + NS_IMETHOD PostURL(nsISupports* pluginInst, const char* url, diff --git a/modules/plugin/public/nsIPluginManager.h b/modules/plugin/public/nsIPluginManager.h index b65328545bbf..2bd3869dcde9 100644 --- a/modules/plugin/public/nsIPluginManager.h +++ b/modules/plugin/public/nsIPluginManager.h @@ -162,10 +162,13 @@ public: * URLs, even if the user currently has JavaScript disabled (usually * specify PR_FALSE) * @param postHeadersLength - the length of postHeaders (if non-NULL) - * @param postHeaders - the headers to POST. NULL specifies that there - * are no post headers - * @result - NS_OK if this operation was successful - */ + + * @param postHeaders - the headers to POST. Must be in the form of + * "HeaderName: HeaderValue\r\n". Each header, including the last, + * must be followed by "\r\n". NULL specifies that there are no + * post headers + + * @result - NS_OK if this operation was successful */ NS_IMETHOD PostURL(nsISupports* pluginInst, @@ -221,6 +224,35 @@ public: NS_IMETHOD UnregisterPlugin(REFNSIID aCID) = 0; + + /** + * Fetches a URL, with Headers + + * @see GetURL. Identical except for additional params headers and + * headersLen + + * @param getHeadersLength - the length of getHeaders (if non-NULL) + + * @param getHeaders - the headers to GET. Must be in the form of + * "HeaderName: HeaderValue\r\n". Each header, including the last, + * must be followed by "\r\n". NULL specifies that there are no + * get headers + + * @result - NS_OK if this operation was successful + + */ + + NS_IMETHOD + GetURLWithHeaders(nsISupports* pluginInst, + const char* url, + const char* target = NULL, + nsIPluginStreamListener* streamListener = NULL, + const char* altHost = NULL, + const char* referrer = NULL, + PRBool forceJSEnabled = PR_FALSE, + PRUint32 getHeadersLength = 0, + const char* getHeaders = NULL) = 0; + };