[prev in list] [next in list] [prev in thread] [next in thread]
List: ipcop-svn
Subject: [Ipcop-svn] SF.net SVN: ipcop:[6008] ipcop/trunk
From: owes () users ! sourceforge ! net
Date: 2011-10-30 21:00:07
Message-ID: E1RKcUB-00016D-48 () sfp-svn-1 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 6008
http://ipcop.svn.sourceforge.net/ipcop/?rev=6008&view=rev
Author: owes
Date: 2011-10-30 21:00:06 +0000 (Sun, 30 Oct 2011)
Log Message:
-----------
Polish the code that creates proxy.pac, and make it available under \
http:/<<ipcop-ip>>:81/proxy.pac
Modified Paths:
--------------
ipcop/trunk/config/rootfiles/common/ipcop-gui
ipcop/trunk/html/cgi-bin/proxy.cgi
ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1
Modified: ipcop/trunk/config/rootfiles/common/ipcop-gui
===================================================================
--- ipcop/trunk/config/rootfiles/common/ipcop-gui 2011-10-30 14:38:25 UTC (rev 6007)
+++ ipcop/trunk/config/rootfiles/common/ipcop-gui 2011-10-30 21:00:06 UTC (rev 6008)
@@ -141,3 +141,4 @@
home/httpd/vhost81/html/images/blacklogo.png
home/httpd/vhost81/html/images/null.gif
home/httpd/vhost81/html/images/redirect-background.jpg
+home/httpd/vhost81/html/proxy.pac
Modified: ipcop/trunk/html/cgi-bin/proxy.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/proxy.cgi 2011-10-30 14:38:25 UTC (rev 6007)
+++ ipcop/trunk/html/cgi-bin/proxy.cgi 2011-10-30 21:00:06 UTC (rev 6008)
@@ -3103,73 +3103,46 @@
sub writepacfile
{
- open(FILE, ">/home/httpd/html/proxy.pac");
+ open(FILE, ">/home/httpd/vhost81/html/proxy.pac");
flock(FILE, 2);
- print FILE "function FindProxyForURL(url, host)\n";
- print FILE "{\n";
- if (($proxysettings{'ENABLED_GREEN_1'} eq 'on') || \
($proxysettings{'ENABLED_BLUE_1'} eq 'on'))
- {
+ print FILE "function FindProxyForURL(url, host)\n{\n";
+
+ if (($proxysettings{'ENABLED_GREEN_1'} eq 'on') || \
($proxysettings{'ENABLED_BLUE_1'} eq 'on')) { print FILE <<END
-if (
- (isPlainHostName(host)) ||
- (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) ||
- (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
- (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
- (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
- (isInNet(host, "169.254.0.0", "255.255.0.0"))
- )
- return "DIRECT";
+ // URL without dots
+ if (isPlainHostName(host))
+ return "DIRECT";
- else
+ // our domain
+ if (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}"))
+ return "DIRECT";
+ var resolved_host = dnsResolve(host);
+ // 'internal' IPs
+ if (
+ (isInNet(resolved_host, "10.0.0.0", "255.0.0.0")) ||
+ (isInNet(resolved_host, "172.16.0.0", "255.240.0.0")) ||
+ (isInNet(resolved_host, "192.168.0.0", "255.255.0.0")) ||
+ (isInNet(resolved_host, "169.254.0.0", "255.255.0.0")) ||
+ (isInNet(resolved_host, "127.0.0.0", "255.0.0.0"))
+ )
+ return "DIRECT";
END
;
- if ($proxysettings{'ENABLED_GREEN_1'} eq 'on')
- {
- print FILE "if (\n";
- print FILE " (isInNet(myIpAddress(), \
\"$netsettings{'GREEN_1_NETADDRESS'}\", \
\"$netsettings{'GREEN_1_NETMASK'}\"))";
-
- undef @templist;
- if (-e "$acl_src_subnets") {
- open(SUBNETS,"$acl_src_subnets");
- @templist = <SUBNETS>;
- close(SUBNETS);
- }
-
- foreach (@templist)
- {
- @temp = split(/\//);
- if (
- ($temp[0] ne $netsettings{'GREEN_1_NETADDRESS'}) && ($temp[1] ne \
$netsettings{'GREEN_1_NETMASK'}) &&
- ($temp[0] ne $netsettings{'BLUE_1_NETADDRESS'}) && ($temp[1] ne \
$netsettings{'BLUE_1_NETMASK'})
- )
- {
- chomp $temp[1];
- print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \
\"$temp[1]\"))";
- }
- }
-
- print FILE "\n";
-
+ if (($netsettings{'BLUE_COUNT'} >= 1) && ($proxysettings{'ENABLED_BLUE_1'} \
eq 'on')) { print FILE <<END
- )
- return "PROXY $netsettings{'GREEN_1_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
+
+ // BLUE Network
+ else if (isInNet(myIpAddress(), "$netsettings{'BLUE_1_NETADDRESS'}", \
"$netsettings{'BLUE_1_NETMASK'}")) + return "PROXY \
$netsettings{'BLUE_1_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; END
-;
+ ;
}
- if (($proxysettings{'ENABLED_GREEN_1'} eq 'on') && \
($proxysettings{'ENABLED_BLUE_1'} eq 'on') && \
($netsettings{'BLUE_COUNT'} >= 1))
- {
- print FILE "\n else\n\n";
+ if ($proxysettings{'ENABLED_GREEN_1'} eq 'on') {
+ print FILE "\n return \"PROXY \
$netsettings{'GREEN_1_ADDRESS'}:$proxysettings{'PROXY_PORT'}\";\n"; }
- if (($netsettings{'BLUE_COUNT'} >= 1) && ($proxysettings{'ENABLED_BLUE_1'} \
eq 'on'))
- {
- print FILE <<END
-if (
- (isInNet(myIpAddress(), "$netsettings{'BLUE_1_NETADDRESS'}", \
"$netsettings{'BLUE_1_NETMASK'}"))
- )
- return "PROXY $netsettings{'BLUE_1_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
-END
-;
+ else {
+ print FILE "\n return \"DIRECT\";\n";
}
}
print FILE "}\n";
Modified: ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1
===================================================================
--- ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1 2011-10-30 14:38:25 UTC (rev 6007)
+++ ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1 2011-10-30 21:00:06 UTC (rev 6008)
@@ -21,6 +21,7 @@
/home/httpd/vhost81/cgi-bin/redirect.cgi
/home/httpd/vhost81/html/images/null.gif
/home/httpd/vhost81/html/images/redirect-background.jpg
+/home/httpd/vhost81/html/proxy.pac
/usr/lib/ipcop/general-functions.pl
/usr/lib/ipcop/header.pl
/usr/lib/ipcop/lang.pl
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic