J3 Issue ?
avatar pnkr
pnkr
18 Jul 2016

Steps to reproduce the issue

On administrator back-end, on Systems > Global Configuration > Server Tab

I enable proxy and try to install other languages through Extensions>Manage>Install Languages.

Expected result

Joomla purges the server response from the file of the update list,
and then parses the response body.

Actual result

There is an error then saying it could not parse the https address...

After debugging the response of the https get request i saw that there was 2 headers in the response but joomla expects only 1 header.

In the below example the first header is the proxy response header and the second is the servers response header (the one that Joomla expects).

Example response starts as below:

"HTTP/1.1 200 Connection established\r\n\r\nHTTP/1.1 200 OK\r\nDate: Mon, 18 Jul 2016 10:16:03 GMT\r\nContent-Type: application/xml\r\nContent-Length: 11500\r\nConnection: keep-alive\r\nLast-Modified: Mon, 18 Jul 2016 09:42:41 GMT\r\nCache-Control: max-age=600\r\nServer: NetDNA-cache/2.2\r\nX-Cache: HIT\r\nAccept-Ranges: bytes\r\n\r\n\n<extensionset name="Accredited Joomla! Translations" description="Accredited Joomla! Translations Updates. /// and the response continues blah blah blah

After joomla removes the first header it still cannot parse the response body as XML file because it still has another header remaining...

System information (as much as possible)

Additional comments

Debugging curl.php and specific on line 263 is that causes the real problem when updating behind a proxy

	$response = explode("\r\n\r\n", $content, 2 + $redirects);

	// Set the body for the response.
	$return->body = array_pop($response);

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar pnkr pnkr - open - 18 Jul 2016
avatar pnkr
pnkr - comment - 20 Jul 2016

Digging deeper... the libraries/joomla/http/transport/curl.php in line 263

/*
* Split the response into headers and body. If cURL encountered redirects, the headers for the redirected requests will
* also be included. So we split the response into header + body + the number of redirects and only use the last two
* sections which should be the last set of headers and the actual body.
*/

    $response = explode("\r\n\r\n", $content, 2 + $redirects);

    // Set the body for the response.
    $return->body = array_pop($response);

If i change this :
$response = explode("\r\n\r\n", $content, 2 + $redirects);
to this:
$response = explode("\r\n\r\n", $content, 3 + $redirects);

Problem is solved, because it splits the proxy response also...BUT that could (in some cases) cause problems (for example if the xml has \r\n\r\n in a description node or something.....

So its not a perfect solution...

Why joomla is assuming that proxy server will not send a response?

does anyone have a thought about it?

avatar conconnl
conconnl - comment - 22 Jul 2016

I'm not sure why Joomla should think that a proxy does not give a response/header. I can tell you most proxy servers in default installation will give you a header indeed.
So someone needs to change the function to filtera response headers from the raw data and just use the body.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11178.

avatar mbabker
mbabker - comment - 22 Jul 2016

So someone needs to change the function to filtera response headers from the raw data and just use the body.

Except we don't want that to happen because part of the data that gets used to build the JHttpResponse object IS the response headers. So the methods doing that splitting need to be smarter to better be able to split headers and body.

avatar pnkr
pnkr - comment - 31 Aug 2016

The method needs to be more precise.
Somehow it needs to understand if proxy sends a response and purge it also.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11178.

avatar vladanminic
vladanminic - comment - 27 Sep 2016

Thank you @pnkr!!! Your previous post regarding curl.php helped me!

avatar 4eversr
4eversr - comment - 30 Sep 2016

Hello from germany !

I also had trouble with updating joomla behind our company proxy. With the "curl.php" workaround which "pnkr" posted, now everything works fine.

So the only thing what we need now is a real solution for this misbehavior.

avatar diegofcv
diegofcv - comment - 25 Jan 2017

Hello from Brazil, same stuff here, workaround was good.

avatar joomla-cms-bot joomla-cms-bot - change - 25 Jan 2017
The description was changed
avatar joomla-cms-bot joomla-cms-bot - edited - 25 Jan 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 9 May 2017
Status New Discussion
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar brianteeman
brianteeman - comment - 18 Aug 2018

Can someone please confirm that this is still an issue for them. There was a recent server change that is related to the headers.

If there is no response this willl be closed in a few weeks

avatar infograf768
infograf768 - comment - 10 May 2019

Closing as no reply. Please open a new issue if problem still exists.

avatar infograf768 infograf768 - change - 10 May 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-05-10 16:38:17
Closed_By infograf768
avatar infograf768 infograf768 - close - 10 May 2019

Add a Comment

Login with GitHub to post a comment