CHH / pipe

Put your assets into the pipe and smoke them.
MIT License
120 stars 9 forks source link

Invalid Content-Type #23

Closed svperfecta closed 12 years ago

svperfecta commented 12 years ago

I'm using the Server module using the example on the PIPE homepage. I'm having a strange problem. No matter what I do I'm getting a content type back of text/html. I'm using PHP 5.3.16 (installed via homebrew-php), NGINX, and FPM.

First, the file:

$ curl http://localhost:8081/assets.php/init.css                                                                                               
.test{}

And here are the headers:

$ curl -I http://localhost:8081/assets.php/init.css
HTTP/1.1 200 OK                                                                                   
Server: nginx/1.2.3                                                                               
Date: Sun, 09 Sep 2012 04:24:56 GMT                                                               
Content-Type: text/html                                                                           
Connection: keep-alive                                                                            
X-Powered-By: PHP/5.3.16 

Here's my NGINX config (pretty vanilla):

# Apollo-JS
server {
    listen       8081;
    server_name  localhost;
    root   /my/home/folder/web;

    location / {
        try_files $uri /index.html;
    }
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ ^/.*\.php(/|$) {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO         $fastcgi_path_info;
        fastcgi_param HTTPS             off;
    }
}

If I echo the response object in my assets.php file I get:

HTTP/1.0 200 OK                                                                                
Cache-Control: public                                                                          
Content-Type:  text/css; charset=UTF-8                                                         
Date:          Sun, 09 Sep 2012 04:32:21 GMT                                                   
Last-Modified: Sun, 09 Sep 2012 00:53:32 GMT    

I can't see anything wrong anywhere. NGINX isn't touching the headers, PHP-FPM doesn't seem to have any option to manipulate them even if I wanted to, and PHP seems to be sending them correctly. I was wondering if I was missing something obvious?

svperfecta commented 12 years ago

Any chance someone else could see if they are getting the same thing? It happens to me for JS files too.

svperfecta commented 12 years ago

I found this bug late last night. It was in PAKE. I found it by doing:

if (headers_sent($filename, $linenum)) { echo "Headers already sent in $filename on line $linenum\n"; }