final private int get_and_update_maxforwards()
{
  int maxforwards=-1;
  String s,s1;
  int cachedsize=headers.size();
  for(int i=0;i<cachedsize;i++)
  {
    int j;
    s=headers.get(i);
    j=s.indexOf(':',0);
    if(j==-1) continue;
    s1=s.substring(0,j).toLowerCase();
    if(s1.equals("max-forwards")) {
                try
			    {
                      String s2=s.substring(j+1).trim();
                      maxforwards=Integer.valueOf(s2).intValue();
			    }
			    catch (NumberFormatException nfe) {continue;}
                if(maxforwards>0) headers.set(i, "Max-Forwards: "+(maxforwards-1));
                return maxforwards;
    }
 }
 return -1; // NONE
}