[wellylug] Squid, wpad.dat auto-configuration and the Air NZ booking service

David Harrison david.harrison at stress-free.co.nz
Sun Apr 12 23:31:49 NZST 2009


Hi,
I was just wondering if anyone had come across a problem when using  
proxy auto-configuration files (wpad.dat) with a Squid proxy and the  
Air New Zealand booking service?
e.g. If you go to airnewzealand.co.nz, and in the left hand panel  
select a destination+date and press search.

When using a wpad.dat proxy auto-configuration script the resulting  
itinerary search page times out when loading.
However when the proxy is defined manually in Firefox or IE the  
itinerary search loads perfectly.

I have a feeling this is caused by some funky Javascript they are using.
This is because if I load their itinerary search page manually using  
the following URL everything works fine:
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do

If anyone has come across this before, or just has some random  
suggestions let me know.
Better yet if you know the monkey who wrote the lousy Javascript  
behind the Air NZ site kick him or her for me...

Regards,


David



P.S. I've added some debugging to my wpad.dat file and this is the  
output I receive when hitting the search button in Firefox:


PAC-alert: IP: null (http://www.cn.airnewzealand.co.nz/home/cookie_cross_domain.htm?name=origincity&value=AKL 
)

PAC-alert: Returning proxy

PAC-alert: IP: 162.112.18.131 (http://www.cn.airnz.co.nz/home/cookie_cross_domain.htm?name=origincity&value=AKL 
)

PAC-alert: Returning proxy

PAC-alert: IP: 162.112.18.118 (http://redirect.airnewzealand.com/redirectweb/servlet/FareDirector?promoCode=&fare_type=return&depart_loc=AKL&arrival_loc=WLG&depart_date=19&depart_yearmonth=2009-4&arrival_date=20&arrival_yearmonth=2009-4&searchType=fixed&adults=1&children=0&infants=0&shortHaulPref=smartsaver&longHaulPref=coach&service_class=smartsaver&promoCodeFFF=&hh_arrival_loc=&hh_depart_date=15&hh_depart_yearmonth=2009-4&hh_numOfNights=1&hh_arrival_date=17&hh_arrival_yearmonth=2009-4&hh_numOfTravellers=2&hh_ageOfChild_1=&hh_ageOfChild_2=&hh_ageOfChild_3=&hh_ageOfChild_4=&hh_ageOfChild_5=&promoCodeHotel=&=AKL&=&=15&=2009-4&h_numOfNights=2&=17&=2009-4&h_numOfTravellers=2&h_ageOfChild_1=&h_ageOfChild_2=&h_ageOfChild_3=&h_ageOfChild_4=&h_ageOfChild_5=&h_longHaulPref=coach&h_service_class=coach&promoCodeOLH=&h_fromRegion=domestic&h_toRegion=&h_defaultDepartOffset=3&hh_defaultDepartOffset=3&gsVendor=N1T&gsVacationType=AH&h_depart_loc=&h_arrival_loc=&h_depart_date=&h_depart_yea 
rmonth=&h_arrival_date=&h_arrival_yearmonth=&numOfNights=&numOfTravellers=&ageOfChild_1=&ageOfChild_2=&ageOfChild_3=&ageOfChild_4=&ageOfChild_5=&locField=&fromRegion=domestic&toRegion=domestic&defaultDepartOffset=1&finder_type=FFF&hasVB=true&hasXML=false&locale=en_NZ&region=nz&prefix=&engine=&utm_source=Air+NZ+Fare+Finder&utm_medium=Fare+Finder&utm_campaign=airnewzealand.co.nz 
)

PAC-alert: Returning proxy

PAC-alert: IP: null (http://www.cn.airnewzealand.co.nz/home/cookie_cross_domain.htm?name=origincity&value=AKL 
)

PAC-alert: IP: 162.112.18.100 (https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initNewSearchForFlights.do?destinationPoint0=WLG&originPoint0=AKL&tripType=return&tripStartDate=19&tripStartMonth=APR&tripEndDate=20&tripEndMonth=APR&bookingClass=smartsaver&adults=1&children=0&infants=0&searchType=fixed&promoCode=&i=&finder_type=FFF&utm_source=Air+NZ+Fare+Finder&utm_medium=Fare+Finder&utm_campaign=airnewzealand.co.nz 
)



P.S.S. Here's the wpad.dat file. Its a little lengthy thanks to all  
the debugging, but it works reliably everywhere but Air NZ:

function FindProxyForURL(url, host)
{
         var debug = false;
         var direct = "DIRECT";
         var proxy = "PROXY proxy.internal-site.co.nz:3128";

         try {
              	if (isPlainHostName(host)) {
                         return "DIRECT";
                 }

                 var resolved_ip = dnsResolve(host);
		if (debug) {
                 	alert('IP: ' + resolved_ip + " (" + url + ")");
		}
                 if (resolved_ip == null || resolved_ip == false ||  
resolved_ip == "") {
                         if (debug) {
                                 alert("Returning proxy");
                         }
                         return proxy;
                 } else {
                         if (isInNet(resolved_ip, "192.168.4.0",  
"255.255.255.0")) {
                                 if (debug) {
                                         alert("Local address - go  
direct");
                                 }
                                 return direct;
                         }
                 }
         } catch (err) {
                 if (debug) {
                         alert("Error determining address");
                 }
         }
         if (debug) {
                 alert("Returning proxy");
         }
         return proxy;
}






More information about the wellylug mailing list