code: public void add(HeaderField header) {
      int headerSize = header.size();
      if (headerSize > capacity) {
        clear();
        return;
      }
      while (size + headerSize > capacity) {
        remove();
      }
      headerFields[head++] = header;
      size += header.size();
      if (head == headerFields.length) {
        head = 0;
      }
    }
docs: Add the header field to the dynamic table.
  Entries are evicted from the dynamic table until the size of the table
  and the new header field is less than or equal to the table's capacity.
  If the size of the new entry is larger than the table's capacity,
  the dynamic table will be cleared.