Project

General

Profile

Actions

Bug #31967

closed

typoLink_URL leaves port untouched

Added by Hendrik Becker over 12 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2011-11-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In case of a special formed HTTP-request the return value of $this->cObj->typoLink_URL() is wrong.
This occurs in a basic TYPO3 4.5.7 installation.

Expected return value (correct):
https://domain.tld/index.php?id=5

Delivered return value (wrong):
https://domain.tld:80/index.php?id=5

Reproduction steps:

1. Create a new page
2. Edit the page properties and set "Use Protocol" to "https://"
3. Create a fe-plugin and put it in any other page (create one if necessary) with "Use Protocol" set to "http://" (or "Default")
4. Put this php code inside the fe-plugin:

echo $this->cObj->typoLink_URL(array('parameter' => 5));
exit;

The id 5 must be replaced by the id of the page created in step 1 of course.

5. Access the page containing the fe-plugin with your browser through the frontend

The result is the expected result until this step because the HTTP-request looks somewhat like this:

GET /index.php?id=7 HTTP/1.1
Host: domain.tld
User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive

But if the request gets changed in this form (only the port gets defined also, which is legitimated by: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23):

GET /index.php?id=7 HTTP/1.1
Host: domain.tld:80
User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive

Then the returned value includes the same port definition as in the request. But since "http" is changed into "https" the port must be omitted or changed into 443.

This behaviour can be tested by using e.g. the "Live HTTP headers" Plugin for Firefox.

Actions #1

Updated by Alexander Opitz over 9 years ago

  • Description updated (diff)
  • Status changed from New to Needs Feedback
  • Is Regression set to No

Hi,

does the problem still exists within newer versions of TYPO3 CMS (6.2.9)?

Actions #2

Updated by Hendrik Becker over 9 years ago

Hey Alexander,

the problem still exists in TYPO3 6.2.9.

Let me explain the problem (hopefully) more clearly, since I had problems to understand what exactly I meant 3 years ago myself.

If your page (e.g. ID9) is set to https (page properties), TYPO3 will redirect you to https if you try to access the page via http.

That means accessing: http://domain.tld/index.php?id=9
will result in a redirect to: https://domain.tld/index.php?id=9

That is correct behaviour.

Though if I access: http://domain.tld:80/index.php?id=9
TYPO3 will redirect me to: https://domain.tld:80/index.php?id=9

which is wrong behaviour, since https defaults to port 443 and my intention wasn't to access https on port 80.
If my intention was to access https on port 80, TYPO3 sure must keep this port information and must not change it to e.g. port 443.

ATTENTION: The browser will remove the port information from the http request, since port 80 is the default port. So you can not reproduce this behaviour using your browser's address bar. This is why I mentioned the "Live http headers" plugin for firefox, which makes it possible to modify the http request accordingly.

ATTENTION: There is a problem replaying http requests with newer firefox versions. Firefox simply does not do it. To fix this, add the http header field "If-Modified-Since: *" to your replaying request. Now Firefox will replay the http request. Yay!

Generally this misleading behaviour is no big deal, because it usually can not occur. Though I struggled when I had a program, which automatically requested TYPO3 Pages, and always included the port information in its requests.

Actions #3

Updated by Alexander Opitz over 9 years ago

  • Status changed from Needs Feedback to New

Ok, but then this issue also exists, if you don't use the standard 80/443 port.

Actions #4

Updated by Hendrik Becker over 9 years ago

That is correct. This behaviour occurs independently of the port number. It always occurs if any port was explicitly specified in the http request.

Actions #5

Updated by Benni Mack about 5 years ago

  • Status changed from New to Closed

This specific functionality was removed from TYPO3 v9 ("pages.url_scheme") due to lots of incompatibilities. I will close this ticket. We've also refactored the typolink handling now in TYPO3 v9 which allows to create proper URLs with a defined port in your URL scheme / base, not in sys_domain anymore.

If you feel this issue is still not fixed in v9 / v10, please open the ticket again or create a new one.

Thanks for your insights (I am quite interested to read this ticket now and see how we solved this one (differently) now, and what side effects were there with TYPO3.

Actions

Also available in: Atom PDF