-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
fix: cgi-fcgi status code #6267
base: develop
Are you sure you want to change the base?
Conversation
Well, it sounds deliberated. |
I think so too. The code has been that way forever and underneath in other lines it does set the code. For what reason this was omitted for CGI, I have no idea. |
That 15-year-old code was intended for CGI. The line returns
CodeIgniter/system/codeigniter/Common.php Lines 323 to 336 in 817163a
|
Yes, but why was the response code omitted from the response specifically for CGI? It looks like it's intentional given the other lines that do set it. |
I'm not confirmed, but it seems if the status code is set to <?php
// (<?phpの前に任意の文字列がないようにしてください)
header('HTTP', true, 400);
?>
<html><body>
<h1>400 Bad Request</h1>
<p>This page is not working properly.</p>
<p>If this issue occur repeatedly, please contact administrator.</p>
</body></html>
|
So, probably the correct fix is on the if condition |
After a quick inspection at RFC 3875, it looks like there's not response code except within the Status header. |
Hey @kenjis 👋 Thanks for approving 😃 Do you think this PR will get merged, and if so, do you have an ETA? |
Hi 👋
I work at Datadog, and while doing some tests with CodeIgniter 3, I stumbled upon what I found to be strange behavior when using the
cgi-fcgi
sapi. I want to understand whether this is a bug or a feature, or if there is an existing workaround. I mostly want to foster discussion and understand :)Consider this controller:
When accessing the
/foo
endpoint, I expect a500
status code: This is indeed the case in the response header of a curl request, for instance.However, this is not the case after the exception handler has been called. For instance, if you add the following to
error_exception.php
, a200
status code will be displayed:Forcing the status code during the call to
header
effectively solves this issue, if this is one.You may ask why do we care? Basically, currently, it would appear that when using CGI SAPIs, requests that should be marked as 500s are marked as 200s on Datadog's UI :(
Thank you for your help! 😃