bool RequestParser::GetNextBoundaryLine(std::size_t* b_off, std::size_t* b_len,
                                        bool* ended) {
  std::size_t off = 0;

  while (true) {
    std::size_t pos = pending_data_.find(kCRLF, off);
    if (pos == std::string::npos) {
      break;
    }

    std::size_t len = pos - off;
    if (len == 0) {
      off = pos + 2;
      continue;  // Empty line
    }

    if (IsBoundary(pending_data_, off, len, ended)) {
      *b_off = off;
      *b_len = len;
      return true;
    }

    off = pos + 2;
  }

  return false;
}
bool RequestParser::GetNextBoundaryLine(std::size_t* b_off, std::size_t* b_len,
                                        bool* ended) {
  std::size_t off = 0;

  while (true) {
    std::size_t pos = pending_data_.find(kCRLF, off);
    if (pos == std::string::npos) {
      break;
    }

    std::size_t len = pos - off;
    if (len == 0) {
      off = pos + 2;
      continue;   
    }

    if (IsBoundary(pending_data_, off, len, ended)) {
      *b_off = off;
      *b_len = len;
      return true;
    }

    off = pos + 2;
  }

  return false;
}