Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Ruleset Style Guide Problem #6985

Closed
Closed

Description

@gloomy-ghost

The style guide doesn't like wildcard, it requires a list of subdomains with a plain rewrite rule in rulesets rather than regexes with long strings of subdomains.

However, some sites have a bunch of subdomains to balance loading pressure, or just to avoid concurrent connections limit in bowsers. Then it is too much to list them all.

A recent example is #6899, in that case we have c[2-79].yunpan.360.cn, which have exactly the same function. There are 3 options:

  1. List nearly 80 subdomains one by one, which is a huge list.
  2. Use a wildcard with a special rule, but then we have to use regexes with long strings of subdomains instead of a plain rewrite rule.
  3. Use a exclusion with negative lookahead operator, which is confusing for somebody.

The style guide notes option 2 and 3 as a bad example, even though option 1 is not an elegant solution. If this still need to consider, another example is McAfee.xml:

Only some certain pages under www.mcafee.com have https, and all of the others redirect to http. In this case we don't have option 1, so it seems to be a problem that has no solution if we don't violate the style guide.

Activity

  1. jeremyn commented on Sep 24, 2016

    @jeremyn
    Contributor

    I've already participated in this discussion in pull request #6899 , so @fuglede @Hainish @J0WI please add your comments here.

    EDIT: to clarify, my preference in #6899 is for option (2), using special rules rather than many targets or an exclusion with a negative lookahead.

  2. Hainish commented on Sep 26, 2016

    @Hainish
    Member

    I don't think that the styleguide needs to change here - the wording is open-ended enough to allow reasonable exceptions. Words like "avoid" and "prefer" provide the flexibility needed to allow for option 2. Which is my preference as well.

  3. J0WI commented on Oct 1, 2016

    @J0WI
    Contributor

    Since the question has been answered I'm closing this issue.

  4. gloomy-ghost commented on Oct 1, 2016

    @gloomy-ghost
    CollaboratorAuthor

    Sorry, didn't notice the email.

    But there are some large rulesets which are using option 3 and it is really looong to write every subdomains in the rule, such as QQ.xml. So are these acceptable or not?

  5. jeremyn commented on Oct 1, 2016

    @jeremyn
    Contributor

    It's case-by-case. In #6899 that you linked above, there are only seven subdomains that need to be listed in one regex, and two subdomains (including one wildcard with \d{1,2}) in the other. Here is an example of one regex with over twenty subdomains. So I think that if some new rule has a lot more than twenty subdomains in one regex, we can worry about it then. And even then listing each subdomain might be better than whatever the alternative is.

  6. gloomy-ghost commented on Oct 2, 2016

    @gloomy-ghost
    CollaboratorAuthor

    There are 50 subdomains in #6986. I will just leave it there and whoever wants to do that please feel free.

  7. added a commit that references this issue on Oct 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions