id HTTP date $date&quot;);
    }
    index += s.length;
  }

  int expectWeekday() {
    int weekday;
    &#47;&#47; The formatting of the weekday signals the format of the date string.
    int pos = date.indexOf(&quot;,&quot;, index);
    if (pos == -1) {
      int pos = date.indexOf(&quot; &quot;, index);
      if (pos == -1) throw new HttpException(&quot;Invalid HTTP date $date&quot;);
      tmp = date.substring(index, pos);
      index = pos + 1;
      weekday = wkdays.indexOf(tmp);
      if (weekday !=