[VWNC] Is it possible to execute the proxy script file *.pac from inside the smalltalk?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[VWNC] Is it possible to execute the proxy script file *.pac from inside the smalltalk?

Mark Pirogovsky-3
Hello everybody.
When our application connects to the internet for the information it has
to go via Proxy.  We can read the proxy setup from the internet explorer
setup when host and port are set explicitly.  However very often users
are using the proxy scripts in *.pac file which looks like some java
function.

Does anyone know if it is possible to execute such a file from inside
smalltalk ?

here is an example of such a file:

//pacfile
function FindProxyForURL(url, host)
{
     /* Don't proxy local hostnames */
     if (isPlainHostName(host))
     {
         return 'DIRECT';
     }

     /* Don't proxy local domains */
     if (dnsDomainIs(host, ".session.rservices.com") ||
(host == "session.rservices.com")
     {
         return 'DIRECT';
     }

     /* Don't proxy portal addresses */
     if ((host == 'www.blackspider.com') ||
dnsDomainIs(host, '.mailcontrol.com')

     {
         return 'DIRECT';
     }

     /* Don't proxy Windows Update */
     if ((host == "download.microsoft.com") ||
(host == "ntservicepack.microsoft.com") ||
(host == "cdm.microsoft.com") ||
(host == "wustat.windows.com") ||
(host == "windowsupdate.microsoft.com") ||
(dnsDomainIs(host, ".windowsupdate.microsoft.com")) ||
(host == "update.microsoft.com") ||
(dnsDomainIs(host, ".update.microsoft.com")) ||
(dnsDomainIs(host, ".windowsupdate.com")))
     {
         return 'DIRECT';
     }

     if (isResolvable(host))
     {
         var hostIP = dnsResolve(host);

         /* Don't proxy non-routable addresses (RFC 3330) */
         if (isInNet(hostIP, '0.0.0.0', '255.0.0.0') ||
isInNet(hostIP, '10.0.0.0', '255.0.0.0') ||
isInNet(hostIP, '127.0.0.0', '255.0.0.0') ||
isInNet(hostIP, '169.254.0.0', '255.255.0.0') ||
isInNet(hostIP, '172.16.0.0', '255.240.0.0') ||
isInNet(hostIP, '192.0.2.0', '255.255.255.0') ||
isInNet(hostIP, '192.88.99.0', '255.255.255.0') ||
isInNet(hostIP, '192.168.0.0', '255.255.0.0') ||
isInNet(hostIP, '198.18.0.0', '255.254.0.0') ||
isInNet(hostIP, '224.0.0.0', '240.0.0.0') ||
isInNet(hostIP, '240.0.0.0', '240.0.0.0'))
         {
             return 'DIRECT';
         }

         /* Don't proxy local addresses */
         if (isInNet(hostIP ,   "255.255.248.0") ||
isInNet(hostIP, "255.255.255.255") ||

isInNet(hostIP,   "255.255.255.255"))
         {
             return 'DIRECT';
         }
     }

     if (url.substring(0, 5) == 'http:' || url.substring(0, 6) == 'https:' || url.substring(0, 4) == 'ftp:')
     {
         return 'PROXY proxy.com:8081';
     }

     return 'DIRECT';
}



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [VWNC] Is it possible to execute the proxy script file *.pac from inside the smalltalk?

Steven Kelly
See http://en.wikipedia.org/wiki/Proxy_auto-config
The contents are JavaScript. Michael Lucas-Smith / WithStyle wrote an ECMAScript processor in Smalltalk, which may help:
http://www.cincomsmalltalk.com/userblogs/mls/blogView?entry=3248300989

Steve

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Mark Pirogovsky
> Sent: 25. kesäkuuta 2010 17:37
> To: [hidden email]
> Subject: [vwnc] [VWNC] Is it possible to execute the proxy script file
> *.pac from inside the smalltalk?
>
> Hello everybody.
> When our application connects to the internet for the information it
> has
> to go via Proxy.  We can read the proxy setup from the internet
> explorer
> setup when host and port are set explicitly.  However very often users
> are using the proxy scripts in *.pac file which looks like some java
> function.
>
> Does anyone know if it is possible to execute such a file from inside
> smalltalk ?
>
> here is an example of such a file:
>
> //pacfile
> function FindProxyForURL(url, host)
> {
>      /* Don't proxy local hostnames */
>      if (isPlainHostName(host))
>      {
>          return 'DIRECT';
>      }
>
>      /* Don't proxy local domains */
>      if (dnsDomainIs(host, ".session.rservices.com") ||
> (host == "session.rservices.com")
>      {
>          return 'DIRECT';
>      }
>
>      /* Don't proxy portal addresses */
>      if ((host == 'www.blackspider.com') ||
> dnsDomainIs(host, '.mailcontrol.com')
>
>      {
>          return 'DIRECT';
>      }
>
>      /* Don't proxy Windows Update */
>      if ((host == "download.microsoft.com") ||
> (host == "ntservicepack.microsoft.com") ||
> (host == "cdm.microsoft.com") ||
> (host == "wustat.windows.com") ||
> (host == "windowsupdate.microsoft.com") ||
> (dnsDomainIs(host, ".windowsupdate.microsoft.com")) ||
> (host == "update.microsoft.com") ||
> (dnsDomainIs(host, ".update.microsoft.com")) ||
> (dnsDomainIs(host, ".windowsupdate.com")))
>      {
>          return 'DIRECT';
>      }
>
>      if (isResolvable(host))
>      {
>          var hostIP = dnsResolve(host);
>
>          /* Don't proxy non-routable addresses (RFC 3330) */
>          if (isInNet(hostIP, '0.0.0.0', '255.0.0.0') ||
> isInNet(hostIP, '10.0.0.0', '255.0.0.0') ||
> isInNet(hostIP, '127.0.0.0', '255.0.0.0') ||
> isInNet(hostIP, '169.254.0.0', '255.255.0.0') ||
> isInNet(hostIP, '172.16.0.0', '255.240.0.0') ||
> isInNet(hostIP, '192.0.2.0', '255.255.255.0') ||
> isInNet(hostIP, '192.88.99.0', '255.255.255.0') ||
> isInNet(hostIP, '192.168.0.0', '255.255.0.0') ||
> isInNet(hostIP, '198.18.0.0', '255.254.0.0') ||
> isInNet(hostIP, '224.0.0.0', '240.0.0.0') ||
> isInNet(hostIP, '240.0.0.0', '240.0.0.0'))
>          {
>              return 'DIRECT';
>          }
>
>          /* Don't proxy local addresses */
>          if (isInNet(hostIP ,   "255.255.248.0") ||
> isInNet(hostIP, "255.255.255.255") ||
>
> isInNet(hostIP,   "255.255.255.255"))
>          {
>              return 'DIRECT';
>          }
>      }
>
>      if (url.substring(0, 5) == 'http:' || url.substring(0, 6) ==
> 'https:' || url.substring(0, 4) == 'ftp:')
>      {
>          return 'PROXY proxy.com:8081';
>      }
>
>      return 'DIRECT';
> }
>
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [VWNC] Is it possible to execute the proxy script file *.pac from inside the smalltalk?

Maarten Mostert-2
In reply to this post by Mark Pirogovsky-3
Hi,

> Hello everybody.
> When our application connects to the internet for the information it has
> to go via Proxy. We can read the proxy setup from the internet explorer
> setup when host and port are set explicitly.

Could you share some code explaining how you read this information from IE ?
Can the same be done on OSX ?

Notice that Bottom feeder seems to declare a Proxy Domain: called BOTTOMFEEDER which seems to work ???

Regards,

@+Maarten,


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc