![]() |
#1 |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
calibre vs proxy vs no-proxy
Hello forum,
I checked the previous posts so far but didn't found any solution so far. My environment have the following. When I'm in the office network I use a proxy deployed to the clients via pac file. When I'm off the office network the connection (defined in the pac file) change to direct. But, when I'm off the network calibre cannot connect to the internet (Even there is _no_ proxy settings). As not surprising, but on the office network calibre also not working. When I try the command : calibre-debug -c "from calibre import get_proxies; print get_proxies()" the response is {} which means no proxy connection. Even there is. Is there any special settings I missed to configure the proxy usage (it's probably not a weird question all the companies and most of the free wifis have proxy configured) |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,126
Karma: 27110892
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
PAC proxies are not supported by calibre. PAC proxies are only intended for browsers, they are javascript files.
You want to set a proxy in calibre, use the http_proxy environment variable or your system proxy settings (non-PAC proxy settings). |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
Quote:
By the way, the system proxy settings not working (it's direct connection in case of the proxy server not available) Will search for the envir.variab. you mentioned Last edited by waces; 10-28-2016 at 01:26 PM. |
|
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
up the thread.
i checked in various scenarios and even the pac file redirects the network traffic to "DIRECT" calibre cannot access the internet. My guess Calibre use the system wide settings, so see no reason why it's not working, but any ideas are more than welcome |
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
up the thread. it's getting ridiculous to not having answer to this very simple question.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,859
Karma: 59840450
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Either Kovids answer covered it (so no one else saw a need) or it is
NOT SIMPLE, an no one has a answer ![]() |
![]() |
![]() |
![]() |
#7 |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
corrects me if i'm wrong (frankly not dig myself deep into the metadata query, so feel free to correct me) but the data query is a simply http get via port 80 so see no reason why it cannot work. Pac file only route the traffic to a proxy (if available) or use "direct" connection (with no proxy) if the proxy server not available. So, in this case as the client not able to connect to the proxy server on off-corporate network the traffic will simply bypass the pac file settings. As of it I see no reason to fail. But, as I mentioned, I more than happy if someone directs me to the right direction and probably make me able to find a quick fix for the issue
|
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
To use a PAC file, the client must: - Have a way to configure the URL to retrieve the PAC file. - Retrieve the PAC file. - Each time the client wants to access a URL, it has to call the Javascript function in PAC file passing the URL and host name. - Then interpret the results of the call to decide whether to access the URL directly or via the returned proxy. - Handle when the proxy server is not available. None of that is hard, but it takes time develop, test and maintain. And the client has to be able to execute Javascript. The latter makes PAC file support for most clients undesirable for most projects. With that, I can understand why Kovid doesn't want to support them. |
|
![]() |
![]() |
![]() |
#9 | |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
Yes, I'm pretty sure as I designed the proxy infrastrucuture
![]() The way PAC file is in use like it's download the latest pac file from the predefined (Autoconfig) URL _if_ available. If not will use the latest cached version. So, in my example if the Proxy server holding the PAC file unavailable (eg the client is off-office network) the very last line of the PAC file take place which is: // DEFAULT RULE: All other traffic, use below proxies, in fail-over order. return "DIRECT"; So, the traffic will flow without any proxy server just like in a no-PAC file environment. (Btw if the machine is on the office network and can access the proxy server calibre still not able to connect to the internet, so it's _NOT_ a pac file access related issue) Also using pac file is not a new thing, those kind of proxy config exists for many years so had plenty of time to develop this quite simple thing into calibre Quote:
|
|
![]() |
![]() |
![]() |
#10 | |||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Quote:
One of the examples is http://findproxyforurl.com/example-pac-file/. In that example, it uses DIRECT for internal addresses and different proxies for all other sites. And the default when there is no earlier match is to use one of two proxy servers. To me that says that for everything except local and intranet addresses, the client uses a proxy. There is nothing in it that suggests a direct connection can be used for a general internet site. If this example is invalid, then based on the google search results, I would think that a lot of sites are using bad PAC files. The example on the Wikipedia page ends with: Code:
return "PROXY proxy.example.com:8080; DIRECT"; Quote:
But, I'm sure that if someone wants to code this, then Kovid will accept a patch. |
|||
![]() |
![]() |
![]() |
#11 | |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
Agree, but if it's just a proxy response time issue (which should occure when the client wait for the server defined in the PAC file to respond first and then move to Direct) it should work in the environment when the pac file response is prompt. But it's not the case. Just tested and even the server defined in the pac file available calibre cannot connect through it. And - as I checked the log file on the proxy server itself - unfortunately there was no request initiated by calibre (and alos checked the target hosts defined in the meta query available via the proxy, so there is no url blocking, and also no blocking on the standard http port required for query the meta data)
Yes, you're right but when the pac file reports back direct it means 2 thing. 1 the defined proxy server is not available and 2 the connection will goes through without defined proxy settings. But it doesn't mean there is no data flow in case of no-proxy situations. (If you want to deny all the traffic in case the user cannot access the proxy you need to remove the "direct" part from the pac file. In that case all the communication will be blocked if the proxy is unavailable. But it's a very rare situation.) Quote:
|
|
![]() |
![]() |
![]() |
#12 |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
happy new year fellow calibre users. and up the thread
|
![]() |
![]() |
![]() |
#13 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,581
Karma: 29709834
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Moderator Notice
You have been given an answer on this issue by the author of calibre, Kovid Goyal. He is not interested in implementing and maintaining support for PAC proxies, and he has told you why. There is nothing stopping you from downloading the source and writing the code to support PAC proxies for your own own use, if you lack the skills to write the code, find someone who has them and commission them to do the work. Thread bumping to no good purpose is frowned at MR. So you should regard this post as a warning. BR Last edited by BetterRed; 01-07-2017 at 08:28 AM. |
![]() |
![]() |
![]() |
#14 | |
Member
![]() Posts: 11
Karma: 10
Join Date: Oct 2016
Device: kindle
|
Sorry for the bumping will take care of it next time.
Unfortunately the answer from the developer was not a real answer about the design decision why calibre not support the common method using system API. Or if it's by design why there is no option to overwrite it. Normally if an application need to connect the internet it use the system default variables (calibre not, as it can't use this for whatever reasons). The question was more about the "why" and not the "how". Thanks for pointing to the source code I created a temporary workaround using the source but I think it would be better to implement this in an official way. Quote:
|
|
![]() |
![]() |
![]() |
#15 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,581
Karma: 29709834
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
![]() |
![]() |
![]() |
Tags |
direct connection, noproxy, pac, proxy |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nginx Calibre Proxy | Ackis | Calibre | 2 | 04-19-2016 01:48 PM |
Using calibre in a proxy. fetching metadata proxy authentication required | shiftymorgan | Calibre | 8 | 05-13-2011 03:45 AM |
Proxy authentication problems (I have no proxy) | fogus | Calibre | 16 | 03-08-2009 01:27 PM |