Zotero standalone should wait for proxy authentication
Configuring zotero standalone to work with a proxy is already not easy, because of the lack of a proper interface to do so.
Now, the issue is that even when correctly configured, zotero standalone does not interact properly with proxies that require authentication.
Consider the following case:
1) You open Zotero standalone
2) You open your web browser
3) You navigate on the browser to a resource that you want to save on Zotero. Here there is something (e.g. a PDF document) that is only accessible through the proxy.
4) You press the Save to Zotero button
5) Zotero tries to get the document and to do so tries accessing the proxy. The proxy asks for authentication login and password. Zotero standalone shows the dialog to enter the authentication data. So far so good. However, at this point zotero standalone does not wait for the user to enter the data before attempting to download the document and consequently the download fails.
6) You get a half-downloaded entry in your collection with the "parent item" present and the inner stuff (e.g. PDF document) missing because of the failed download
at this point, you need to
7) Finish entering the authentication data so that zotero finally authenticates with the proxy
8) Erase the half-saved entry
9) Go back to the web browser and redo the save to zotero. At this time, Zotero standalone has already authenticated with the proxy and so the download succeeds
This is unnecessarily complex. When realizing that authentication to a proxy is needed, Zotero standalone should make the document download wait for it to succeed.
Note that having zotero work correctly with authenticated proxies is extremely important. Many universities can only provide to its stuff access to some resources they bought via authenticated proxies.
Now, the issue is that even when correctly configured, zotero standalone does not interact properly with proxies that require authentication.
Consider the following case:
1) You open Zotero standalone
2) You open your web browser
3) You navigate on the browser to a resource that you want to save on Zotero. Here there is something (e.g. a PDF document) that is only accessible through the proxy.
4) You press the Save to Zotero button
5) Zotero tries to get the document and to do so tries accessing the proxy. The proxy asks for authentication login and password. Zotero standalone shows the dialog to enter the authentication data. So far so good. However, at this point zotero standalone does not wait for the user to enter the data before attempting to download the document and consequently the download fails.
6) You get a half-downloaded entry in your collection with the "parent item" present and the inner stuff (e.g. PDF document) missing because of the failed download
at this point, you need to
7) Finish entering the authentication data so that zotero finally authenticates with the proxy
8) Erase the half-saved entry
9) Go back to the web browser and redo the save to zotero. At this time, Zotero standalone has already authenticated with the proxy and so the download succeeds
This is unnecessarily complex. When realizing that authentication to a proxy is needed, Zotero standalone should make the document download wait for it to succeed.
Note that having zotero work correctly with authenticated proxies is extremely important. Many universities can only provide to its stuff access to some resources they bought via authenticated proxies.
Under normal operation, if extensions.zotero.triggerProxyAuthentication is true (which it is by default) at startup, Zotero checks with the networking stack to see if requests for several of the URLs specified in extensions.zotero.proxyAuthenticationURLs would use a proxy (i.e., for a general proxy or as specified in a PAC file with conditional rules). If so, it makes a foreground HEAD request to trigger an authentication dialog. So if you're not getting a proxy auth prompt at Zotero startup then something isn't behaving properly. We'd have to know how you've set up the proxy, in Zotero and/or on the system, to figure out why that is.
I have a manually configured proxy (no pac file), i.e. configured via about:config, by setting network.proxy.ssl, network.proxy.ssl_port
and network.proxy.type = 1.
I cannot use this proxy as a system proxy because it fails too often on some resources, but it is OK for papers. In firefox I generally use proxy selectors such as foxyproxy to select this proxy only for the resources that truly need it. On Zotero standalone, this should be unnecessary because I use Zotero standalone only to grab resources that work fine with the proxy.
Indeed I could write a pac file, but I think that would be unnecessary if only zotero standalone could either:
1) Ask for the proxy authentication at startup; or
2) Check if downloads trigger a proxy authentication dialog, so that they are automatically retried after authentication is achieved.
The Debug ID is D1359386684
Relevant setup in about config is:
network.proxy.http = localhost
network.proxy.http_port = 8095
network.proxy.type = 1
This corresponds to a local stunnel instance (possibly unneeded today, but this is how my institution makes us work).
With this, the zotero debug log says
No general proxy or PAC file found -- assuming direct connection
Hope this helps finding the issue.
In the meantime, I'd like to thank you for looking into it.
But now I have one more question. This discussion made me curious, so I tried to get rid of the stunnel and foxyproxy in firefox by building a PAC file for my academic resources, since the PAC file is the only way to force firefox to access a proxy over SSL. This worked. Then I tried using the same PAC file with zotero standalone. I have:
1) configured
network.proxy.autoconfig_url
to point to my pac file
2) configured
network.proxy.type
to 2
3) augmented my pac file to return the proxy to be accessed via ssl (marked as HTTPS host:port) also for urls like matching the pattern https://s3.amazonaws.com/zotero.org/*
Unfortunately, in this way I cannot make zotero ask for the proxy authentication at startup.
I wonder if you may have some hint at what I may be missing...