Re: [Pharo-project] About HTTP proxies, settings and MacOS
On Jun 28, 2011, at 10:29 AM, Mariano Martinez Peck wrote:
Hi guys. Few weeks ago, there was an issue about Zn and HTTP proxies. I am in MacOS and behind a proxy. Before that issue, I was able to DIRECTLY connect to internet without specifying anything at the image level. This is because, I guess, the VM and somehow the image I guess, took the default proxy settings I have in MacOS.
Now, with the last version of Pharo 1.3 I need to explicitly set the proxy in order to go to internet. So, first question, is that expected?
No.
Second question, if I go to the settings browser, Network -> Use HTTP proxy, if I check the box, it AUTOMATICALLY shows me the correct data: IP + port. So it seems it is getting it automatically from the MacOS specification. When enabling the checkbox, I can use internet.
However, I still need to go there and set it and I am a lazy guy ;) So my question is....is there a way to avoid having to set this? I mean, if you could detect that there was a proxy IP and port, why not to use it directly? is this on purpose?
-- Marcus Denker -- http://www.marcusdenker.de INRIA Lille -- Nord Europe. Team RMoD.
On Jun 28, 2011, at 11:10 AM, Marcus Denker wrote:
On Jun 28, 2011, at 10:29 AM, Mariano Martinez Peck wrote:
Hi guys. Few weeks ago, there was an issue about Zn and HTTP proxies. I am in MacOS and behind a proxy. Before that issue, I was able to DIRECTLY connect to internet without specifying anything at the image level. This is because, I guess, the VM and somehow the image I guess, took the default proxy settings I have in MacOS.
Now, with the last version of Pharo 1.3 I need to explicitly set the proxy in order to go to internet. So, first question, is that expected?
No.
Second question, if I go to the settings browser, Network -> Use HTTP proxy, if I check the box, it AUTOMATICALLY shows me the correct data: IP + port. So it seems it is getting it automatically from the MacOS specification. When enabling the checkbox, I can use internet.
We need to rewrite this: InternetConfiguration>>startUp OSPlatform isMacOS ifTrue: [ self useHTTPProxy ifTrue: [ (self getHTTPProxyHost findTokens: ':') ifNotEmpty: [:p | HTTPSocket useProxyServerNamed: p first port: p second asInteger]]] For Zinc. -- Marcus Denker -- http://www.marcusdenker.de INRIA Lille -- Nord Europe. Team RMoD.
On 28 Jun 2011, at 11:12, Marcus Denker wrote:
We need to rewrite this:
InternetConfiguration>>startUp OSPlatform isMacOS ifTrue: [ self useHTTPProxy ifTrue: [ (self getHTTPProxyHost findTokens: ':') ifNotEmpty: [:p | HTTPSocket useProxyServerNamed: p first port: p second asInteger]]]
For Zinc.
Since (which is now in 1.3 already): --- Name: Zinc-HTTP-SvenVanCaekenberghe.164 Author: SvenVanCaekenberghe Time: 17 June 2011, 9:16:22 am UUID: 90d57d3d-fc41-4548-a2fd-dcd7c22a3a1f Ancestors: Zinc-HTTP-SvenVanCaekenberghe.163 implemented support for proxies that require authorization; ZnHeaders class>>#requestHeadersFor: will add a Proxy-Authorization header when needed; added public API ZnNetworkingUtils class>>#proxyAuthorizationHeaderValueToUrl: removed public API ZnNetworkingUtils class>>#httpProxy and #isProxySet; upgraded public API ZnNetworkingUtils class>>#shouldProxyUrl: to be a primary interface; refactored internals of ZnNetworkUtils to use NetworkSystemSettings directly instead of HTTPSocket; this code still has to be tested and validated with real world proxies --- Zn is no longer using HTTPSocket as authorative source for the proxy settings info, but is using NetworkSystemSettings. This was necessary to get the info for authenticated proxies. Also, we should not depend on HTTPSocket if we can avoid it. So yes, it seems as if the code that Marcus showed needs to modify NetworkSystemSettings, which would fix Mariono's issues. Sven
Is Zinc-HTTP supports NTLM proxy authentication? 2011/6/28 Sven Van Caekenberghe <sven@beta9.be>
Name: Zinc-HTTP-SvenVanCaekenberghe.164 Author: SvenVanCaekenberghe Time: 17 June 2011, 9:16:22 am UUID: 90d57d3d-fc41-4548-a2fd-dcd7c22a3a1f Ancestors: Zinc-HTTP-SvenVanCaekenberghe.163
implemented support for proxies that require authorization; ZnHeaders class>>#requestHeadersFor: will add a Proxy-Authorization header when needed; added public API ZnNetworkingUtils class>>#proxyAuthorizationHeaderValueToUrl: removed public API ZnNetworkingUtils class>>#httpProxy and #isProxySet; upgraded public API ZnNetworkingUtils class>>#shouldProxyUrl: to be a primary interface; refactored internals of ZnNetworkUtils to use NetworkSystemSettings directly instead of HTTPSocket;
this code still has to be tested and validated with real world proxies ---
Zn is no longer using HTTPSocket as authorative source for the proxy settings info, but is using NetworkSystemSettings. This was necessary to get the info for authenticated proxies. Also, we should not depend on HTTPSocket if we can avoid it.
So yes, it seems as if the code that Marcus showed needs to modify NetworkSystemSettings, which would fix Mariono's issues.
Sven
On 28 Jun 2011, at 21:05, Denis Kudriashov wrote:
Is Zinc-HTTP supports NTLM proxy authentication?
No, it is not. This also seems like a older MS only technology, but I might be wrong. Code contributions are always welcome of course. Sven
On 28 Jun 2011, at 11:12, Marcus Denker wrote:
InternetConfiguration>>startUp OSPlatform isMacOS ifTrue: [ self useHTTPProxy ifTrue: [ (self getHTTPProxyHost findTokens: ':') ifNotEmpty: [:p | HTTPSocket useProxyServerNamed: p first port: p second asInteger]]]
After browsing the code a bit, adding NetworkSystemSettings useHTTPProxy: true inside the ifNotEmpty: as last statement might already help. It would be cleaner to no longer reference HTTPSocket here and add use NetworkSystemSettings. The silly thing is that currently, NetworkSystemSettings itself falls back to HTTPSocket for the proxy host and port, for backwards compatibility reasons no doubt. Still, the abstraction/indirection would be good. So then it the code would be NetworkSystemSettings httpProxyServer: p first; httpProxyPort: p second asInteger; useHTTPProxy: true As sole contents of the ifNotEmpty: But since I am not behind a proxy, this must still be tested by someone who is. Regards, Sven
On Tue, Jun 28, 2011 at 12:13 PM, Sven Van Caekenberghe <sven@beta9.be>wrote:
On 28 Jun 2011, at 11:12, Marcus Denker wrote:
InternetConfiguration>>startUp OSPlatform isMacOS ifTrue: [ self useHTTPProxy ifTrue: [ (self getHTTPProxyHost findTokens: ':') ifNotEmpty: [:p | HTTPSocket useProxyServerNamed: p first port: p second asInteger]]]
After browsing the code a bit, adding
NetworkSystemSettings useHTTPProxy: true
inside the ifNotEmpty: as last statement might already help.
Thanks Sven, that worked :) Thanks Marcus for pointing us to the right place to fix it. Can we integrate it marcus for 1.3?
It would be cleaner to no longer reference HTTPSocket here and add use NetworkSystemSettings. The silly thing is that currently, NetworkSystemSettings itself falls back to HTTPSocket for the proxy host and port, for backwards compatibility reasons no doubt. Still, the abstraction/indirection would be good. So then it the code would be
NetworkSystemSettings httpProxyServer: p first; httpProxyPort: p second asInteger; useHTTPProxy: true
As sole contents of the ifNotEmpty:
But since I am not behind a proxy, this must still be tested by someone who is.
Regards,
Sven
-- Mariano http://marianopeck.wordpress.com
participants (4)
-
Denis Kudriashov -
Marcus Denker -
Mariano Martinez Peck -
Sven Van Caekenberghe