View Single Post
Old 12-09-2016, 05:32 AM   #10
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by waces View Post
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.
Which of course requires that the PAC file had been retrieved at some time. And that would mean I would need to configure calibre at work and start it there to retrieve the PAC file. An unusual situation, but it would catch someone following a set of instructions.
Quote:
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)
That doesn't agree with the more complicated samples I found. They all have conditional checks of the URL against a pattern with a return for that pattern. And not all included a non-proxied option for when it fell through. Plus, what you say sounds like the PAC file execution is checking the proxy availability, not returning the calculated proxy to the client to try.

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";
I can see that as "use proxy.example.com:8080 if it responds, otherwise go direct". But, I expected that as meaning the client is to do the test. But, what you say suggests that the actual result returned to the client is the proxy server if it is available, or "DIRECT" if it is not.

Quote:
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
Yes, I know it is not new. And there has been plenty of time for it to be added to calibre. But, that's the point. Someone has to take the time to code it and add it. That means they are not doing something else. And as this is only the second mention of PAC files I can find in this forum, it isn't a highly desired feature. There are a lot of other things to do that people are asking for, so they will be done first.

But, I'm sure that if someone wants to code this, then Kovid will accept a patch.
davidfor is offline   Reply With Quote