Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
6895cc3c
Commit
6895cc3c
authored
12 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1645156
by attiks: Fixed URL generation only works on port 80.
parent
4cc4103e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/language/language.negotiation.inc
+9
-0
9 additions, 0 deletions
core/modules/language/language.negotiation.inc
core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
+30
-0
30 additions, 0 deletions
...ge/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
with
39 additions
and
0 deletions
core/modules/language/language.negotiation.inc
+
9
−
0
View file @
6895cc3c
...
...
@@ -383,6 +383,15 @@ function language_url_rewrite_url(&$path, &$options) {
$url_scheme
=
(
$is_https
)
?
'https://'
:
'http://'
;
$options
[
'absolute'
]
=
TRUE
;
$options
[
'base_url'
]
=
$url_scheme
.
$domains
[
$options
[
'language'
]
->
langcode
];
// 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
);
}
if
(
isset
(
$options
[
'https'
])
&&
variable_get
(
'https'
,
FALSE
))
{
if
(
$options
[
'https'
]
===
TRUE
)
{
$options
[
'base_url'
]
=
str_replace
(
'http://'
,
'https://'
,
$options
[
'base_url'
]);
...
...
This diff is collapsed.
Click to expand it.
core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
+
30
−
0
View file @
6895cc3c
...
...
@@ -79,4 +79,34 @@ private function checkUrl($language, $message1, $message2) {
$this
->
drupalGet
(
"
$prefix
/
$path
"
);
$this
->
assertResponse
(
404
,
$message2
);
}
/**
* Check URL rewriting when using a domain name and a non-standard port.
*/
function
testDomainNameNegotiationPort
()
{
$language_domain
=
'example.fr'
;
$edit
=
array
(
'language_negotiation_url_part'
=>
1
,
'domain[fr]'
=>
$language_domain
);
$this
->
drupalPost
(
'admin/config/regional/language/detection/url'
,
$edit
,
t
(
'Save configuration'
));
// Enable domain configuration.
variable_set
(
'language_negotiation_url_part'
,
LANGUAGE_NEGOTIATION_URL_DOMAIN
);
// Reset static caching.
drupal_static_reset
(
'language_list'
);
drupal_static_reset
(
'language_url_outbound_alter'
);
drupal_static_reset
(
'language_url_rewrite_url'
);
// Fake a different port.
$_SERVER
[
'HTTP_HOST'
]
.
=
':88'
;
// Create an absolute French link.
$language
=
language_load
(
'fr'
);
$url
=
url
(
''
,
array
(
'absolute'
=>
TRUE
,
'language'
=>
$language
));
$this
->
assertTrue
(
strcmp
(
$url
,
'http://example.fr:88/'
)
==
0
,
'The right port is used.'
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment