Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy script fails after piwik.php returns 204 response #6712

Closed
mattab opened this issue Nov 22, 2014 · 9 comments
Closed

Proxy script fails after piwik.php returns 204 response #6712

mattab opened this issue Nov 22, 2014 · 9 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Nov 22, 2014

The goal of this issue is to:

Reported in forum

Now I have an entry in my PHP error log for every piwik request because
[function.file-get-contents]:
failed to open stream: HTTP request failed! HTTP/1.1 204 No Response
in piwik.php on line 75

@mattab mattab added Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. labels Nov 22, 2014
@mattab mattab added this to the Piwik 2.10.0 milestone Nov 22, 2014
@mnapoli
Copy link
Contributor

mnapoli commented Dec 1, 2014

I tested both with PHP 5.3 and 5.6 and file_get_contents() works with a 204 response.

No error:

php -r "var_dump(file_get_contents('http://quiet-fog-825.herokuapp.com/204'));"

Error (404 status) which is normal:

php -r "var_dump(file_get_contents('http://quiet-fog-825.herokuapp.com/404'));"

Reading this stackoverflow question, it might be a problem of a specific PHP version…

@mnapoli
Copy link
Contributor

mnapoli commented Dec 1, 2014

The commit mentioned in the stackoverflow question is this one: php/php-src@15da836

It turns out it's included in PHP 5.3.0 and above.

Maybe the forum user that reported this is using PHP 5.2 on the server where he put the proxy script?

@mnapoli mnapoli self-assigned this Dec 1, 2014
@mattab
Copy link
Member Author

mattab commented Dec 2, 2014

Maybe the forum user that reported this is using PHP 5.2 on the server where he put the proxy script?

That's really possible! (server hosting the proxy does not have to be 5.3 + )

I guess we could add some kind of test for the proxy piwik.php to prevent it breaking in the future

@mnapoli
Copy link
Contributor

mnapoli commented Dec 2, 2014

Do we really want to maintain this script for PHP 5.2? We could accept PRs if people want to fix it, but not actively maintain it ourselves for obsolete PHP versions?

@mattab
Copy link
Member Author

mattab commented Dec 2, 2014

if it's easily fixable then let's fix it, if not then we can skip... this script is not supposed to require 5.3 and ideally would work with old PHP as its goal is to proxy requests and this should not fail (or we get data loss)

@mattab
Copy link
Member Author

mattab commented Dec 2, 2014

@mnapoli I guess we could make it work on PHP 5.2 by adding &send_image=1 to the URL request so it does return 200 instead of 204 (previous behavior) ?

@mnapoli
Copy link
Contributor

mnapoli commented Dec 2, 2014

@mattab good idea, seems like an easy fix, I'll give it a try

@mnapoli
Copy link
Contributor

mnapoli commented Dec 2, 2014

Good point by the bug reporter: the HTTP status should be forwarded by the proxy (even if we fix this bug)

@mnapoli
Copy link
Contributor

mnapoli commented Dec 3, 2014

@mattab I implemented your suggestion: matomo-org/tracker-proxy@42ff2de

This issue should be fixed in the new repository: piwik/tracker-proxy

@mnapoli mnapoli closed this as completed Dec 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants