gbarnas
Posts: 155
Joined: 27.Apr.2005
From: New Jersey
Status: offline
|
Strange - I had been working with this last week - even opened a case with MS. I took the WPAD.DAT file to our senior Java coder with some questions, and he confirmed my suspicions of the process logic for exclusions. Consider the following part of my wpad file: (my comments marked by ";" in italics) ; per the WPAD specification: ; URL variable format = http://host.domain.ext:port/path ; HOST variable format = host.domain.ext - ; everything between :// and the first : or / ; assume URL = http://www.xyzzy.com, Host = www.xyzzy.com function FindProxyForURL(url, host){ var hash=0, urllower, i, fIp=false, ip, nocarp=false, skiphost=false; var list="", pl, j, score, ibest, bestscore; urllower = url.toLowerCase(); ; forces "url" to all lower-case ; these all evaluate FALSE, as this is "http:" if((urllower.substring(0,5)=="rtsp:") || (urllower.substring(0,6)=="rtspt:") || (urllower.substring(0,6)=="rtspu:") || (urllower.substring(0,4)=="mms:") || (urllower.substring(0,5)=="mmst:") || (urllower.substring(0,5)=="mmsu:")) return "DIRECT"; ; This does not succeed, as HOST = www.xyzzy.com if(UseDirectForLocal){ ; is TRUE! if(isPlainHostName(host)) ; true only if hostname w/o domain. fIp = true;} ; set IP flag. ; enumerate the list of DirectNames - cDirectNames = 6 in our situation ; I think the logic here is a bit backward – if we have a partial match ; (just hostname), we set a flag and break out of the loop, but THEN we ; check for an exact match of the ENTIRE URL and exit direct. If we have a ; partial match, there's no way to test for an exact match. I would ; have expected the exact match test to be performed first. for(i=0; i<cDirectNames; i++){ if(shExpMatch(host, DirectNames)){ ; Checks DirectName value to Host (matches when i=1) fIp = true; ; Is TRUE! break;} ; breaks the for-loop - ; I would expect a < return "DIRECT" > here instead.. if(shExpMatch(url, DirectNames)) ; checks for exact URL to DirectName match return "DIRECT"; } ; continue processing - fIp is true - the above code processed the BREAK statement if(cDirectIPs == 0){ ; cDirectIPs is 28 - next 2 lines are skipped if(fIp) return "DIRECT";} else{ ip = host; ; assume name is IP? if(fIp) ; if IP flag is true, do DNS lookup ip = dnsResolve(host); ; get IP from Host var isIpAddr = /^(\d+.){3}\d+$/; ; RegEx to evaluate x.x.x.x format ; This returns here if the www.xyzzy.com IP (22.11.33.77) is in the DirectIP list - if(isIpAddr.test(ip)){ ; if IP format is valid for(i=0; i<cDirectIPs; i += 2){ ; enumerate net/mask pairs if(isInNet(ip, DirectIPs, DirectIPs[i+1])) ; If IP is in the DirectIP network return "DIRECT";}} else if(isPlainHostName(host)) ; host is NOT a plain host name! return "DIRECT"; } ; end of else ; processing continues - fIp is still true... ; at this point DIRECT is not an option - the proxy will be used!!! As you can see, the process of testing for partial matches before exact matchs seems flawed, since a partial match would superscede an exact match, preventing the exact-match logic from ever triggering. I'm not a Java coder, so I could be wrong in my interpretations. However - our resident Java programmer did run this through his development environment and got the results I posted above. I'm not sure how to fix this, and have not had a fix from MS since opening the ticket last week. Glenn
< Message edited by gbarnas -- 23.Apr.2008 8:21:46 AM >
|