Вопрос

I build FastCGI-server with "fcgi_stdio.h". All works fine, except one problem. I want to set up HTTP status of response. So I write, for example:

...
FCGI_SetExitStatus( 404 );
FCGI_Finish();

But response has status 200 (I see it in the Chrome, with Web Developer plugin).

What can I do?

Tested on Ubuntu Linux 12.04, Apache/2.2.22 (Ubuntu)

Это было полезно?

Решение

FCGI_SetExitStatus() does not set the HTTP status code; the exit code it sets only has application-level meaning.

You need to output an additional header like Status: 404 Not Found. See this similar question on stackoverflow and the FastCGI FAQ.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top