Users could have connections through proxies. Some using system-wide proxy settings, others browser-wide proxy.
On Windows for example you could have the system proxy settings as well as proxy settings for Firefox or Chrome alone. Therefore relying on system proxy settings is not reliable.
The only logical solution is to 开发者_StackOverflowuse whatever proxy settings the browser loading my plugin is using. If Firefox is loading my plugin and it has some proxy settings, my plugin should connect using these settings as well. I need my plugin to download the SSL cert of the page in which the plugin is loaded (for further verification..etc).
Is there some way to do that in NPAPI or I must use APIs like Windows WinInet or WinHTTP, or OpenSSL for Linux and Mac? If I have to do so, then how can I let my plugin use whatever proxy settings the host browser is using? I am checking out NPN_GetValueForURL, but I don't think it has good compatibility and good browser interop.
Thank you guys!
I'm pretty sure that NPN_GetURLNotify() will use the browser's proxy settings. It would be pretty crazy if it did not.
Update
If you're writing an NPAPI-based plugin, you need to use the NPN_Get/Post functions to do HTTP requests. That will use the host's proxy settings, cookies, etc. These functions exist for this reason; I don't know why you would use Wininet or roll your own instead.
Looking through about:config, it appears Firefox stores the proxy settings in network.proxy.*. You can access these settings programmatically via the Preferences Service. I suppose you could configure Wininet to behave the same, but you still have the cookie problem.
精彩评论