 }
    String tmp = date.substring(index, pos);
    index = pos + separator.length;
    try {
      int value = int.parse(tmp);
      return value;
    } on FormatException {
      throw new HttpException(&quot;Invalid HTTP date $date&quot;);
    }
  }

  void expectEnd() {
    if (index != date.length) {
      throw new HttpException(&quot;Invalid HTTP date $date&quot;);
    }
  }

  int weekday = expectWeekday();
  int day;
  int month;
  int year;
  int hours;
  int minutes;
  int seconds;
  if (format =