зеркало из https://github.com/mozilla/pjs.git
Added support for Proxies in the MRJ Plugin via getProxyForURL. Reviewed
by ed.burns@eng.sun.com and approved by drapeau@eng.sun.com. Fixes bug #18691. I can be contacted at mark.lin@eng.sun.com or phone: (408) 517-5365, (650) 627-8409.
This commit is contained in:
Родитель
9d1943bdae
Коммит
634795291f
|
@ -769,6 +769,38 @@ Boolean MRJContext::appletLoaded()
|
|||
return (mViewer != NULL);
|
||||
}
|
||||
|
||||
void MRJContext::setProxyInfoForURL(char * url, JMProxyType proxyType)
|
||||
{
|
||||
/*
|
||||
* We then call 'nsIPluginManager2::FindProxyForURL' which will return
|
||||
* proxy information which we can parse and set via JMSetProxyInfo.
|
||||
*/
|
||||
|
||||
char * result = NULL;
|
||||
|
||||
thePluginManager2->FindProxyForURL(url, &result);
|
||||
if (result != NULL) {
|
||||
JMProxyInfo proxyInfo;
|
||||
|
||||
/* See if a proxy was specified */
|
||||
if (strcmp("DIRECT", result)) {
|
||||
int index = 0;
|
||||
int length = strlen(result);
|
||||
|
||||
proxyInfo.useProxy = true;
|
||||
result = strchr(result, ' ');
|
||||
for (index = 0; *result != ':' && index < length; result++, index++) {
|
||||
proxyInfo.proxyHost[index] = *result;
|
||||
}
|
||||
proxyInfo.proxyHost[index] = '\0';
|
||||
result++;
|
||||
proxyInfo.proxyPort = atoi(result);
|
||||
JMSetProxyInfo(mSessionRef, proxyType, &proxyInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Boolean MRJContext::loadApplet()
|
||||
{
|
||||
static JMAppletSecurity security = {
|
||||
|
@ -787,6 +819,18 @@ Boolean MRJContext::loadApplet()
|
|||
};
|
||||
OSStatus status;
|
||||
|
||||
/* Added by Mark: */
|
||||
/*
|
||||
* Set proxy info
|
||||
* It is only set if the new enhanced Plugin Manager exists.
|
||||
*/
|
||||
if (thePluginManager2 != NULL) {
|
||||
/* Sample URL's to use for getting the HTTP proxy and FTP proxy */
|
||||
setProxyInfoForURL("http://www.mozilla.org", eHTTPProxy);
|
||||
setProxyInfoForURL("ftp://ftp.mozilla.org", eFTPProxy);
|
||||
}
|
||||
/* End set proxy info code */
|
||||
|
||||
status = ::JMNewAppletViewer(&mViewer, mContext, mLocator, 0,
|
||||
&security, &callbacks, this);
|
||||
if (status == noErr) {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
// Instance state information about the plugin.
|
||||
//
|
||||
// *Developers*: Use this struct to hold per-instance
|
||||
// information that you¹ll need in the
|
||||
// information that you¼ll need in the
|
||||
// various functions in this file.
|
||||
//
|
||||
|
||||
|
@ -58,6 +58,7 @@ public:
|
|||
Boolean createContext();
|
||||
JMAWTContextRef getContextRef();
|
||||
|
||||
void setProxyInfoForURL(char * url, JMProxyType proxyType);
|
||||
Boolean appletLoaded();
|
||||
Boolean loadApplet();
|
||||
Boolean isActive();
|
||||
|
|
Загрузка…
Ссылка в новой задаче