[wp-trac] [WordPress Trac] #15936: IPv6 literal support in multisite broken

WordPress Trac noreply at wordpress.org
Sun Dec 23 13:55:40 UTC 2018


#15936: IPv6 literal support in multisite broken
------------------------------------------------+--------------------------
 Reporter:  jmdh                                |       Owner:  jeremyfelt
     Type:  enhancement                         |      Status:  assigned
 Priority:  normal                              |   Milestone:  Future
                                                |  Release
Component:  Networks and Sites                  |     Version:  3.0
 Severity:  major                               |  Resolution:
 Keywords:  has-patch dev-feedback 2nd-opinion  |     Focuses:  multisite
------------------------------------------------+--------------------------
Changes (by spacedmonkey):

 * keywords:  has-patch dev-feedback => has-patch dev-feedback 2nd-opinion
 * owner:  (none) => jeremyfelt
 * status:  new => assigned
 * component:  Permalinks => Networks and Sites


Old description:

> The logic for handling explicit port numbers in wp-includes/ms-
> settings.php is confused by IPv6 literal addresses in URLs as defined by
> RFC 2732.
> It tries to handle the URL as it as if there were a port appended, but
> then fails to strip it off. Incidentally the error message here:
> 'Multisite only works without the port number in the URL.' is untrue,
> since ports are handled (but for only two particular cases, port 80 and
> 443).
>
> The attached patch, against Wordpress 3.0.3, fixes both these issues, and
> allows ports other than 80 and 443 to be used with Wordpress, by just
> stripping off the trailing port rather than special-casing the two well-
> known ports, and not incorrectly detecting IPv6 literals as URLs with
> ports in. It also has the advantage of being much more compact.
>
> It may be worth someone thinking through whether the substitution is
> strictly correct with reference to the URL standards, but I'm pretty sure
> that this is an improvement on the current code.
>
> Thanks,
> Dominic.

New description:

 The logic for handling explicit port numbers in wp-includes/ms-
 settings.php is confused by IPv6 literal addresses in URLs as defined by
 RFC 2732.
 It tries to handle the URL as it as if there were a port appended, but
 then fails to strip it off. Incidentally the error message here:
 'Multisite only works without the port number in the URL.' is untrue,
 since ports are handled (but for only two particular cases, port 80 and
 443).

 The attached patch, against WordPress 3.0.3, fixes both these issues, and
 allows ports other than 80 and 443 to be used with Wordpress, by just
 stripping off the trailing port rather than special-casing the two well-
 known ports, and not incorrectly detecting IPv6 literals as URLs with
 ports in. It also has the advantage of being much more compact.

 It may be worth someone thinking through whether the substitution is
 strictly correct with reference to the URL standards, but I'm pretty sure
 that this is an improvement on the current code.

 Thanks,
 Dominic.

--

Comment:

 Sent some time on this and got a patch working at
 [https://core.trac.wordpress.org/attachment/ticket/15936/15936.diff
 15936.diff].

 Couple of things, worth noting, to use the filter, you have to put it in a
 sunrise.php file, which limits it's usefulness, but still might be worth
 it. This patch was extremely hard to test, so would love some eyes on it.

 Setting owner to @jeremyfelt as he knows all things MS bootstrap.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/15936#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list