tomasen / fcgi_client

go fastcgi client with fcgi params support
BSD 3-Clause "New" or "Revised" License
99 stars 40 forks source link

How to handle "Primary script unknown" error from php-fpm #1

Open valichek opened 8 years ago

valichek commented 8 years ago

Now we get malformed MIME header line: Primary script unknown error on response like:

Primary script unknown
Status: 404 Not Found
X-Powered-By: PHP/7.0.1
Content-type: text/html; charset=UTF-8

File not found.

It's not obvious how to handle it, now we can just search for Primary script unknown and manually create http.Response with 404.

The response is "almost" valid. Would be nice to get normal http response with 404 status from fcgiclient.

tomasen commented 8 years ago

can you provide reproduce procedures?

valichek commented 8 years ago

Sure. First, run php-fpm. It is simple with docker. docker run --name some-test -p 9000:9000 php:fpm Then you just connect to it (php-fpm should be running on 9000 port of docker host) and send some request to the script that doen't exist env["SCRIPT_FILENAME"] = "/path/to/not-existing.php" php-fpm should reply with message that contains Primary script unknown at first line