[Mrpostman-cvs] mrpostman/src/com/sonalb/net/http HTTPRedirectHandler.java,1.7,1.8
Brought to you by:
chris_humphreys,
mrbook
From: <chr...@us...> - 2003-12-17 20:17:59
|
Update of /cvsroot/mrpostman/mrpostman/src/com/sonalb/net/http In directory sc8-pr-cvs1:/tmp/cvs-serv4605 Modified Files: HTTPRedirectHandler.java Log Message: Relative redirect patch Index: HTTPRedirectHandler.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/com/sonalb/net/http/HTTPRedirectHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HTTPRedirectHandler.java 22 Feb 2003 09:17:19 -0000 1.7 --- HTTPRedirectHandler.java 17 Dec 2003 20:17:56 -0000 1.8 *************** *** 43,46 **** --- 43,49 ---- import java.util.Iterator; import java.util.List; + import java.util.logging.Level; + import java.util.logging.Logger; + /** *************** *** 71,74 **** --- 74,79 ---- InputStream is; + private static Logger logger = Logger.getLogger("com.sonalb.net.http.httpredirecthandler"); + /** *************** *** 248,252 **** is = null; ! url = new URL(huc.getHeaderField("location")); --- 253,269 ---- is = null; ! logger.finest("HRH redirect: " + huc.getHeaderField("location")); ! //Hotmail sometimes returns a location field which is a relative URL, we'll have to check for this and ! //add the previous protocol, server url and port.... ! String location = huc.getHeaderField("location"); ! String newLocation = location; ! if (location.charAt(0) == '/') { ! logger.warning("HTTP redirect with relative URL! : " + location); ! String oldUrlStr = huc.getURL().toString(); ! String oldServerUrl = oldUrlStr.substring(0, oldUrlStr.indexOf(huc.getURL().getPath())); ! newLocation = oldServerUrl + newLocation; ! logger.warning("Appending previous server path : " + newLocation); ! } ! url = new URL(newLocation); |