Problem/Motivation

History: #1572394: Language detection by domain only works on port 80

URL generation does not works when the server listen to port non 80 and language detection is domain based.
The port number missing from the generated urls, as generated by language_url_rewrite_url.

The cause is that $options['base_url'] only contains the domain name without protocol and port, see #1572394: Language detection by domain only works on port 80 and #1250800: Language domain should work regardless of ports or protocols

Proposed resolution

Remaining tasks

Backport the changes to D7. Some of the code changes have already been backported in #78, but not the tests. See #79. The tests also need to be backported and a tests-only patch needs to be provided.

User interface changes

API changes

Original report by @Sweetchuck

url() function invoke the hook hook_url_outbound(). drupal_alter('url_outbound', $path, $options, $original_path);
Module locale implements this hook locale_url_outbound_alter() and call some configured callbacks.
In this case the callback function is locale_language_url_rewrite_url(), which is trim the port number from domain.

$host = 'http://' . str_replace(array('http://', 'https://'), '', $options['language']->domain);
$host = parse_url($host, PHP_URL_HOST);

I had replace this line

$options['base_url'] = $url_scheme . $host;

to

$options['base_url'] = $url_scheme . $host;
if (($port = parse_url($options['language']->domain,  PHP_URL_PORT))) {
  $options['base_url'] .= ":$port";
}

It seems to good

Comments

gábor hojtsy’s picture

Issue tags: +D8MI, +language-base

Does this also apply to Drupal 8?

gábor hojtsy’s picture

Issue tags: +Needs tests

Will also definitely need tests.

attiks’s picture

Issue tags: +7.15 release blocker

Tagging as release blocker so this gets fixed first

attiks’s picture

Assigned: Unassigned » attiks

Problem confirmed on Drupal 8

Setup: Server listening on port 80 and 81
All URL's are linking to port 80

gábor hojtsy’s picture

Version: 7.x-dev » 8.x-dev
attiks’s picture

Status: Active » Needs review
StatusFileSize
new2.51 KB
new1.51 KB

Let's try this

Status: Needs review » Needs work

The last submitted patch, i1645156.patch, failed testing.

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new2.52 KB

fixed

attiks’s picture

Status: Needs review » Needs work
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.phpundefined
@@ -79,4 +79,34 @@ class LanguageUrlRewritingTest extends WebTestBase {
+    // Enable domain configuration
...
+    // Fake a different port
...
+    // Create an absolute French link

dots

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new2.52 KB
new1.52 KB
tstoeckler’s picture

Status: Needs review » Needs work

Looks good, except for these code-style issues.

+++ b/core/modules/language/language.negotiation.inc
@@ -383,6 +383,14 @@ function language_url_rewrite_url(&$path, &$options) {
+          $http_host= $_SERVER['HTTP_HOST'];

This is missing a space before the =.

+++ b/core/modules/language/language.negotiation.inc
@@ -383,6 +383,14 @@ function language_url_rewrite_url(&$path, &$options) {
+            $http_host_tmp = explode(':', $http_host);
+            $options['base_url'] .= ':' . $http_host_tmp[1];

This is a matter of taste, but the first line could be written as

list($host, $port) = explode(':', $http_host);

That would allow using $port directly and would avoid the arbitrary 1 index.

+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
@@ -79,4 +79,34 @@ class LanguageUrlRewritingTest extends WebTestBase {
+      "language_negotiation_url_part" => 1,
+      "domain[fr]" => $language_domain

We usually prefer single-quotes, I think.

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new2.52 KB
new1.52 KB

space and quotes fixed
$http_host_tmp[1] rewritten to end($http_host_tmp), a similar construct is used in the other issue.

gábor hojtsy’s picture

@attiks: can you summarize in a couple sentences the reasons this did not work before?

tstoeckler’s picture

Code-style-wise looks good. :)

David_Rothstein’s picture

Is this tagged " 7.15 release blocker" because it's a regression from behavior that worked in previous versions of Drupal? Do we know when the last time was (if ever) that this behavior did work?

Just trying to clarify why that tag is applied to this issue... thanks.

attiks’s picture

This was first committed to D7 on 27/3/2012 #1250800-130: Language domain should work regardless of ports or protocols, and release with 7.12
Followed by #1572394: Language detection by domain only works on port 80 on 15/5/2012 with a first problem, fixed and committed #1572394-43: Language detection by domain only works on port 80
And finally (i hope) this issue

It's not really a regression but in the past you couldn't use domain names if you site needed http/https, we tried fixing it in the first issue, the other 2 are 'new' problems. So it would be nice if we can fix this before releasing a new D7.

gábor hojtsy’s picture

Well, it is both a regression, and not. So earlier before #1250800: Language domain should work regardless of ports or protocols, your help text said you should enter a full URL (with protocol, port, etc) which was prepended to your paths for specific languages. That functionality still works in Drupal 7, since we wanted to keep it backwards compatible, but the current help text suggests you enter a domain name only, and Drupal will put on the port and protocol itself, so you can have http and https pages for example and still use domains for languages. If you do follow the new instructions, custom ports will not work. If you follow the original (old) instructions, custom ports will work. So its a regression in that our current instructions will not make your setting work if you are not on port 80, looks like.

David_Rothstein’s picture

OK, thanks for the further information.

I think since this has been around for a little while and is only a "pseudo-regression", we probably wouldn't hold up a Drupal 7 release just for this, so I'm removing the tag. But I'd definitely commit this to D7 quickly, once it's ready!

gábor hojtsy’s picture

#12: i1645156-12.patch queued for re-testing.

gábor hojtsy’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests

Generally looks good, great that it has extra test coverage. Some notes:

+++ b/core/modules/language/language.negotiation.incundefined
@@ -383,6 +383,14 @@ function language_url_rewrite_url(&$path, &$options) {
+          // Add the port if we're not running on port 80.
+          $http_host = $_SERVER['HTTP_HOST'];
+          if (strpos($http_host, ':') !== FALSE) {
+            $http_host_tmp = explode(':', $http_host);
+            $options['base_url'] .= ':' . end($http_host_tmp);
+          }

I have not found docs that would indicate this would only ever contain the number if its different from 80 (or that it would always contain the number in that case). Looked on php.net. Do we have some docs to refer to here?

+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.phpundefined
@@ -79,4 +79,34 @@ class LanguageUrlRewritingTest extends WebTestBase {
+  /**
+   * Check URL rewriting for the given language when using a domain name.
+   */

"when using a domain name with a non-standard port" right? That is the goal of the patch. (Note the comment line will pass 80 chars then, needs some word-smithing to stay under that limit).

+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.phpundefined
@@ -79,4 +79,34 @@ class LanguageUrlRewritingTest extends WebTestBase {
+  function testDomainNameNegotiationPort() {
+    $language_domain = 'example.cn';
...
+    $this->assertTrue(strcmp($url, 'http://example.cn:88/') == 0, 'The right port is used');
+  }

This is more minor, but it would be good to use a domain that is relevant for the language tested :) You test French with example.cn, interesting combination :)

attiks’s picture

$_SERVER['HTTP_HOST'] is the Host taken from the HTTP request header, it can even contain :80 if the request was made like that, see a similar discussion in secure pages: #334419: $_SERVER['HTTP_HOST'] has port number and regex doesn't strip it.. php.net says "Contents of the Host: header from the current request, if there is one."

I used example.cn because the tests are using this already for a different test, if you want I'll change it.

I will fix the comment later today.

gábor hojtsy’s picture

Ok, http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23 documents the port question pretty well, right. Would be good to summarize it in a sentence there. "HTTP_HOST will optionally contain the port. Preserve that for the domain of the target language as well." Or something like that. It would be good to fix the example.cn test and the comments too, thanks! I think this looks to be close.

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new2.6 KB
new1.52 KB

should be ok

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks great now. Fixes the bug, expands tests proper :) Thanks for sticking to it.

gábor hojtsy’s picture

Issue tags: +sprint

Add on sprint for tracking.

webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

This seems like a pretty straight-forward bug fix. Nice test!

Committed and pushed to 8.x. Doesn't seem to apply cleanly to D7.

albert volkman’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new2.72 KB

Reworked test and test works properly locally. I'm somewhat of a noob when it comes to testing, so please let me know if I did anything incorrectly.

Status: Needs review » Needs work

The last submitted patch, url_generation_other_ports-1645156-27.patch, failed testing.

attiks’s picture

index 246edc2..e9626d5 100644
--- a/.htaccess

--- a/.htaccess
+++ b/.htaccessundefined

+++ b/.htaccessundefined
@@ -102,7 +102,7 @@ DirectoryIndex index.php index.html index.htm

@@ -102,7 +102,7 @@ DirectoryIndex index.php index.html index.htm
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_URI} !=/favicon.ico
-  RewriteRule ^ index.php [L]
+  RewriteRule ^ /index.php [L]

remove this please

albert volkman’s picture

Status: Needs work » Needs review
StatusFileSize
new2.25 KB

Ah, that's what I get for trying to code in a car while low on sleep, lol. Thanks @attiks!

David_Rothstein’s picture

+    // Fake a different port.
+    $_SERVER['HTTP_HOST'] .= ':88';

Shouldn't we be undoing this at the end of the test? Otherwise, that value will persist for all other tests that run afterwards in the same page request, which could potentially affect some of them.

I can't think of a specific example right now, but I know that elsewhere in the codebase where we have a test modify $_SERVER, we try to make sure the modifications are undone at the end.

attiks’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Needs work

I had a quick look:

  • modules/simpletest/tests/common.test is setting the value back
  • modules/simpletest/tests/bootstrap.test is setting the value back
  • modules/locale/locale.test isn't setting the value back

I don't think it's needed, but it wouldn't hurt to reset the value,

$_SERVER['HTTP_HOST'] = str_replace(':88', '', $_SERVER['HTTP_HOST']);

should do it

But changing this will mean fixing Drupal 8 first

gábor hojtsy’s picture

Agreed, let's fix it for Drupal 8 first. I think we can just remember the value at the start and set it back at the end? Instead of the dynamic manipulation suggested.

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new1019 bytes
gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Trivial.

David_Rothstein’s picture

Yup.

This is one of the quickest RTBCs ever, I think :) (Assuming the tests pass.)

David_Rothstein’s picture

Oh, ha, mine wasn't the quickest RTBC ever because Gábor cross-posted and changed the issue status one minute before me :)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

*whoosh*

Committed and pushed to 8.x. Thanks! :)

gábor hojtsy’s picture

Version: 8.x-dev » 7.x-dev
Status: Fixed » Needs work

Let's continue with D7 backport then.

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new2.39 KB

as requested

gábor hojtsy’s picture

+++ b/includes/locale.incundefined
@@ -457,6 +457,14 @@ function locale_language_url_rewrite_url(&$path, &$options) {
+
+          // HTTP_HOST will optionally contain the port. Preserve that for
+          // the domain of the target language as well.
+          $http_host = $_SERVER['HTTP_HOST'];
+          if (strpos($http_host, ':') !== FALSE) {
+            $http_host_tmp = explode(':', $http_host);
+            $options['base_url'] .= ':' . end($http_host_tmp);
+          }

Just looking at this one, is it not possible at all for $options['base_url'] to already contain a port? (In which case after this patch it will be two ports?).

attiks’s picture

Assigned: attiks » Unassigned
Status: Needs review » Needs work

According to default.settings.php it can be

* Examples:
* $base_url = 'http://www.example.com';
* $base_url = 'http://www.example.com:8888';
* $base_url = 'http://www.example.com/drupal';
* $base_url = 'https://www.example.com:8888/drupal';

So better change code to something like (untested):

if (strpos($http_host, ':') !== FALSE && strpos($options['base_url'], ':') === FALSE) {
  $http_host_tmp = explode(':', $http_host);
  $options['base_url'] .= ':' . end($http_host_tmp);
}

This also means that we need a new issue to change the examples in default.settings.php for Drupal 8!

Unassigning since I cannot fix this right now, feel free to jump in ;-)

gábor hojtsy’s picture

Should this be set back again on Drupal 8 because it has the same problem? :/

attiks’s picture

Version: 7.x-dev » 8.x-dev

Gabor,

Difficult question, I think we should decide what $base_url is/will be and what values are acceptable. But my experience is limited to the first option ($base_url = 'http://www.example.com';), I never used any of the other options.

I guess we need people using reverse proxies (Varnish), load balancers, ... to give feedback, so we can determine the impact (and see if it's even possible).

Back to 8.x, we either

  1. Fix this as in #42 and create a follow-up issue for $base_url discussion
  2. We discuss $base_url first, postponing this fix

I think 1 is the sanest to do?

gábor hojtsy’s picture

Yeah, let's fix like #42 in Drupal 8 for now I think.

attiks’s picture

According to KrisBuytaert: "mostly using it for rev proxy setups" (twitter) so in that case we cannot alter the $base_url, AFAIK #42 respects that.

tstoeckler’s picture

Assigned: Unassigned » tstoeckler

I'm claiming this for the current sprint at DrupalCon.

Carsten Müller’s picture

Assigned: tstoeckler » Unassigned
Status: Needs work » Needs review
StatusFileSize
new784 bytes

added #42 to drupal 8 core/modules/language/language.negotiation.inc

diff --git a/core/modules/language/language.negotiation.inc b/core/modules/language/language.negotiation.inc
index 48a8083..bfe3a27 100644
--- a/core/modules/language/language.negotiation.inc
+++ b/core/modules/language/language.negotiation.inc
@@ -401,7 +401,7 @@ function language_url_rewrite_url(&$path, &$options) {
           // HTTP_HOST will optionally contain the port. Preserve that for
           // the domain of the target language as well.
           $http_host = $_SERVER['HTTP_HOST'];
-          if (strpos($http_host, ':') !== FALSE) {
+          if (strpos($http_host, ':') !== FALSE && strpos($options['base_url'], ':') === FALSE) {
             $http_host_tmp = explode(':', $http_host);
             $options['base_url'] .= ':' . end($http_host_tmp);
           }

Status: Needs review » Needs work

The last submitted patch, i1645156-42_d8.patch, failed testing.

tstoeckler’s picture

Assigned: Unassigned » tstoeckler
Status: Needs work » Needs review
StatusFileSize
new4.31 KB
new1.9 KB

So this took a bit longer than expected.

1. The existing test was broken when using dirty URLs
2. We override $options['base_url'] before we do the port checking, but we want to retain a possible port from there.

tstoeckler’s picture

Status: Needs review » Needs work
+++ b/core/modules/language/language.negotiation.inc
@@ -390,20 +390,37 @@ function language_url_rewrite_url(&$path, &$options) {
+        global $is_https;
+        $url_scheme = ($is_https) ? 'https://' : 'http://';
...
         if (is_object($options['language']) && !empty($domains[$options['language']->langcode])) {
...
-          global $is_https;
-          $url_scheme = ($is_https) ? 'https://' : 'http://';

Oops, that change is accidental.

+++ b/core/modules/language/language.negotiation.inc
@@ -390,20 +390,37 @@ function language_url_rewrite_url(&$path, &$options) {
-            $http_host_tmp = explode(':', $http_host);
-            $options['base_url'] .= ':' . end($http_host_tmp);
...
+            list($host, $port) = explode(':', $http_host);
+            $options['base_url'] .= ':' . $port;

This change is not strictly necessary, but I find the list() syntax much more readable, because the variables, actually have a meaning.

+++ b/core/modules/language/language.negotiation.inc
@@ -390,20 +390,37 @@ function language_url_rewrite_url(&$path, &$options) {
+debug($original_base_url);
+debug($options['base_url']);
+debug($host);
+debug($port);

Oops

+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
@@ -106,6 +106,11 @@ class LanguageUrlRewritingTest extends WebTestBase {
+debug(url('', array('absolute' => TRUE)));

...

+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
@@ -114,9 +119,27 @@ class LanguageUrlRewritingTest extends WebTestBase {
-    $url = url('', array('absolute' => TRUE, 'language' => $language));
+    $url = url('', array(
+      'absolute' => TRUE,
+      'language' => $language,
+    ));

This is not strictly necessary, but I wanted to make it consistent with the call below.

+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
@@ -114,9 +119,27 @@ class LanguageUrlRewritingTest extends WebTestBase {
-    $this->assertTrue(strcmp($url, 'http://example.fr:88/') == 0, 'The right port is used.');
+    $this->assertEqual($url, $expected, 'A given port is not overriden.');

I don't why strcmp() was used here, I don't see a reason not to use assertEqual()

Will roll a followup patch in a moment.

tstoeckler’s picture

Status: Needs work » Needs review
StatusFileSize
new4.31 KB
new1.9 KB

This one is better, I hope. Bring on those reviews! :-)

tstoeckler’s picture

Oops I only now saw #48. That was a crosspost. Anyway, as point 2. in #50 elaborates, that approach does not work, at least not directly.

tstoeckler’s picture

Ahhh, I uploaded the same files again. I'm sorry. Here we go.

attiks’s picture

Status: Needs review » Needs work

Nice work, some minor remarks

+++ b/core/modules/language/language.negotiation.incundefined
@@ -392,18 +392,31 @@ function language_url_rewrite_url(&$path, &$options) {
+            $original_base_url = str_replace($url_scheme, '', $options['base_url']);

isn't it safer to do str_replace(array('http://', 'https://'), '' .... so if gets removed no matter what is in there.

+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.phpundefined
@@ -114,9 +118,27 @@ class LanguageUrlRewritingTest extends WebTestBase {
+    $expected = 'http://example.fr:88/';
+    $expected .= $index_php ? 'index.php/' : '';

i think it looks cleaner on 1 line

tstoeckler’s picture

1. I personally don't really know how all the different SSL settings work, I just noticed that this seems to work. Your proposal definitely can't hurt, I'll reroll with that.

2. I did it like that, so we don't need to duplicate the actual URL, but I don't really care either. I'll reroll with that.

tstoeckler’s picture

Status: Needs work » Needs review
StatusFileSize
new3.97 KB

Here we go.

Thinking about the $url_scheme / $base_url stuff, I actually think in case the base_url is given, we should take over the scheme, instead of relying on $is_https, just like we take over the port (with this patch).

I'm not sure that that should be part of this patch, though.

Carsten Müller’s picture

Assigned: tstoeckler » Unassigned
StatusFileSize
new1.23 KB

$options['base_url'] contains the Protocol (http://, 'https://', ...), so just checking for : is not the best idea ;-)

attiks’s picture

Assigned: Unassigned » tstoeckler

I shouldn't do that, and certainly not is this patch. The underlying problem is that you can only specify 1 $base_url containing a full URL including scheme and port, which should in a follow-up issue be changed so you only specify the FQDN so it is consistent and works regardless of the scheme and/or port.

FYI: I talked some more to other devops and most of them never use $base_url for Drupal 7 when using a reverse proxy.

Carsten Müller’s picture

I'm new to this issue and the specific topic itself. So instead of using the base url $_SERVER['SERVER_PORT'] may be better.
But i'm not sure if this port problem should be handled in this issue itself or if it is a more generic problem.

If the port is always given in global $base_url, that could be a workaround to parse the url and get the port.
I can change the patch to parse global $base_url, but my knowledge of the core is not good enough to handle this issue if it should be fixed in a more generic way within Drupal.

attiks’s picture

StatusFileSize
new3.97 KB

I think we should stay with the patch from #57 and handle all the rest in a separate issue.

Re uploading patch from #57

tstoeckler’s picture

I agree. I definitely there should be a follow-up where we can discuss this in detail. Also because, the whole HTTP/HTTPS thing needs the same discussion.

But this patch fixes an edge-case, but legitimate bug, so let's ship it!

RTBC anyone?

vasi1186’s picture

Status: Reviewed & tested by the community » Needs review

It also looks good to me. The only thing I've seen is that there is not use of t() function in the tests assertions. In the other parts in core, t() is used, but I am not sure if this is a good thing or not. Anyhow, I think we should follow a common path, either we use t() all the time, or we never use it.

gábor hojtsy’s picture

t() calls are in progress of being removed from assertion messages. We should not use it for assertion messages.

vasi1186’s picture

Status: Needs review » Reviewed & tested by the community

In that case, I think this can be RTBC.

catch’s picture

Status: Needs review » Needs work
+++ b/core/modules/language/language.negotiation.incundefined
@@ -392,18 +392,31 @@ function language_url_rewrite_url(&$path, &$options) {
+
+          // Save the original base URL. If it contains a port, we need to
+          // retain it below.
+          if (!empty($options['base_url'])) {
+            // The colon in the URL scheme messes up the port checking below.
+            $original_base_url = str_replace(array('https://', 'http://'), '', $options['base_url']);
+

If we're saving the original base URL, then we'd be saving the whole thing, not the base URL minus the protocol. We could call it something like 'normalized base url'?

Otherwise I think this is probably fine.

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new1.34 KB
new3.98 KB

new patch

Status: Needs review » Needs work
Issue tags: -Needs backport to D7, -D8MI, -sprint, -language-base

The last submitted patch, i1645156.patch, failed testing.

attiks’s picture

Status: Needs work » Needs review

#67: i1645156.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, i1645156.patch, failed testing.

attiks’s picture

Status: Needs work » Needs review
Issue tags: +Needs backport to D7, +D8MI, +sprint, +language-base

#67: i1645156.patch queued for re-testing.

tstoeckler’s picture

I'm not sure I am allowed to RTBC this. It looks good, though.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Resolves the concern from @catch. Back to RTBC.

webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Awesome, thanks so much for this fix!

Committed and pushed to 8.x. Moving to 7.x for backport.

amontero’s picture

StatusFileSize
new1.98 KB

First attempt for 7.x
I still have to figure out backporting the test changes.

amontero’s picture

Status: Patch (to be ported) » Needs review

Status: Needs review » Needs work

The last submitted patch, drupal--i1645156-74.D7.patch, failed testing.

amontero’s picture

Status: Needs work » Needs review
StatusFileSize
new1.87 KB

Disregard previous patch at all, still making my way through language system (= warning, novice at the wheel).
At least this should be modifying the appropiate code. Nothing broke... I'm starting to suspect that I must have something misconfigured :)

attiks’s picture

Issue tags: +Needs tests

Nice work, patch is looking good, but we still need the test. If you write the test, can you upload a patch with only the test first so we can see that it will break as you did in #54

gábor hojtsy’s picture

Issue tags: -sprint

Removing from D8MI sprint, where we focus on D8 :)

tstoeckler’s picture

Assigned: tstoeckler » Unassigned

Unassigning, as I'm not involved with the D7 port.

leschekfm’s picture

The patch still applies cleanly against 7.20 and works like a charm.

leschekfm’s picture

Issue summary: View changes

Updated issue summary.

mrharolda’s picture

What happened to this issue? It used to be a D7 release blocker ...

mgifford’s picture

78: drupal--i1645156-78.D7.patch queued for re-testing.

mgifford’s picture

Issue summary: View changes

With more sites moving to using https only, this limitation is becoming more annoying.

The patch in #78 still applies. What do we need to do to get this into D7?

dcam’s picture

Issue summary: View changes

Looks like the tests still need to be backported to D7. See #79.

mgifford’s picture

Status: Needs review » Needs work

Ok, setting it back to Needs work then until we get a patch with those. Thanks @dcam for your work on these issues.

k4v’s picture

For me the patch does not work in Drupal 7.34. $options['base_url'] is not set, but i have a $base_url in settings.php.

talhaparacha’s picture

Status: Needs work » Needs review
StatusFileSize
new2.33 KB

The patch from #78 applies cleanly to 7.41. As requested, here is the tests-only patch backported + re-rolled from #54 and #40. Hoping for a quick RTBC for getting the issue fixed in D7 as it has been in D8.

Status: Needs review » Needs work

The last submitted patch, 89: url_generation_only-1645156-89.patch.patch, failed testing.

The last submitted patch, 89: url_generation_only-1645156-89.patch.patch, failed testing.

talhaparacha’s picture

Status: Needs work » Needs review

Because the added tests were supposed to fail until this issue gets fixed...

dcam’s picture

Status: Needs review » Needs work

Thank you for your work, @talhaparacha!

A patch which combines the test and the fix must be created now. The issue can't be RTBCed without demonstrating that the fix corrects the test failures.

Edit: nevermind about the missing test failure. It was only reporting a single failure when I wrote that, but now it reports two.

talhaparacha’s picture

Status: Needs work » Needs review
StatusFileSize
new4.21 KB
new2.33 KB

@dcam Understood. Here we go; combined patch (fix from #78 and tests from #89) along with the tests-only patch.

Status: Needs review » Needs work

The last submitted patch, 94: url_generation_only-1645156-94-tests-only.patch, failed testing.

The last submitted patch, 94: url_generation_only-1645156-94-tests-only.patch, failed testing.

talhaparacha’s picture

Status: Needs work » Needs review
nicrodgers’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies cleanly to 7.41, and manually tested that urls correctly retain the port (if set). Also URLs continue to work correctly if the default port is set and not specified in the URL. #94 demonstrates that the patch (with test) fixes the failing test, so marking this as RTBC.

fabianx’s picture

Issue tags: +Pending Drupal 7 commit

Nice work! Those i18n patches always have such a nice structure and are well cared for! Thank you!

Marking for D7 commit.

stefan.r’s picture

Code is essentially the same as D8, backport looks OK to me

  • Fabianx committed 56940cd on 7.x
    Issue #1645156 by attiks, tstoeckler, talhaparacha, amontero, Carsten...
fabianx’s picture

Title: URL generation only works on port 80 » URL generation only works on port 80 when using domain based language negotation
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests, -Pending Drupal 7 commit +7.50 release notes

Committed and pushed to 7.x! Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.