Exemplo n.º 1
0
bool isValidProtocol(const String& protocol) {
  // RFC3986: ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
  if (protocol.isEmpty())
    return false;
  if (!isSchemeFirstChar(protocol[0]))
    return false;
  unsigned protocolLength = protocol.length();
  for (unsigned i = 1; i < protocolLength; i++) {
    if (!isSchemeChar(protocol[i]))
      return false;
  }
  return true;
}
Exemplo n.º 2
0
static bool isSchemeChar(char c)
{
    return isSchemeFirstChar(c) || (c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+';
}