/// <summary> /// Checks if the given protocol is supported. /// </summary> /// <param name="protocol"> /// The protocol to check for, e.g. http. /// </param> /// <returns> /// True if the protocol is supported, otherwise false. /// </returns> public Boolean SupportsProtocol(String protocol) { return protocol.IsOneOf(KnownProtocols.Http, KnownProtocols.Https); }
/// <summary> /// Checks if the given protocol (without a colon in the end) is /// what is called a relative scheme. /// </summary> /// <param name="protocol">The protocol to examine.</param> /// <returns>True if the protocol is a relative scheme, otherwise false.</returns> public static Boolean IsRelative(String protocol) { return protocol.IsOneOf("http", "https", "ftp", "file", "ws", "wss", "gopher"); }
private DocumentRequest SubmitForm(HttpMethod method, String scheme, Url action, IHtmlElement submitter) { if (scheme.IsOneOf(ProtocolNames.Http, ProtocolNames.Https)) { if (method == HttpMethod.Get) { return MutateActionUrl(action, submitter); } else if (method == HttpMethod.Post) { return SubmitAsEntityBody(action, submitter); } } else if (scheme.Is(ProtocolNames.Data)) { if (method == HttpMethod.Get) { return GetActionUrl(action); } else if (method == HttpMethod.Post) { return PostToData(action, submitter); } } else if (scheme.Is(ProtocolNames.Mailto)) { if (method == HttpMethod.Get) { return MailWithHeaders(action, submitter); } else if (method == HttpMethod.Post) { return MailAsBody(action, submitter); } } else if (scheme.IsOneOf(ProtocolNames.Ftp, ProtocolNames.JavaScript)) { return GetActionUrl(action); } return MutateActionUrl(action, submitter); }
/// <summary> /// Checks if the given protocol is supported. /// </summary> /// <param name="protocol"> /// The protocol to check for, e.g. http. /// </param> /// <returns> /// True if the protocol is supported, otherwise false. /// </returns> public Boolean SupportsProtocol(String protocol) { return protocol.IsOneOf(ProtocolNames.Http, ProtocolNames.Https); }
/// <summary> /// Checks if the given protocol (without a colon in the end) is /// suitable for deriving the origin. /// </summary> /// <param name="protocol">The protocol to examine.</param> /// <returns> /// True if the protocol is suited for origin, otherwise false. /// </returns> public static Boolean IsOriginable(String protocol) { return protocol.IsOneOf(Http, Https, Ftp, Ws, Wss, Gopher); }
/// <summary> /// Checks if the given protocol (without a colon in the end) is /// following a relative scheme. /// </summary> /// <param name="protocol">The protocol to examine.</param> /// <returns> /// True if the protocol is a relative scheme, otherwise false. /// </returns> public static Boolean IsRelative(String protocol) { return protocol.IsOneOf(Http, Https, Ftp, File, Ws, Wss, Gopher); }