ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SCGI и сжатие ответов


  • To: nginx-ru@xxxxxxxxx
  • Subject: SCGI и сжатие ответов
  • From: "excanoe" <nginx-forum@xxxxxxxx>
  • Date: Thu, 08 Dec 2011 09:20:09 -0500
  • Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mickey.jlkhosting.com; s=x; h=Date:Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=eISsbO1urJBAXH4I+sBn2OAOh/1hG+wuIuwlAiWQI/k=; b=u9pJ1E+bbQVDD3hd90/gxum87NR0aA+KD5TJved4qOq0E0IZdBkF+j0cnnZNYxbKfJNFqccJsfZIuDrYpjFmd7hrra4T9JmhTit/qhz41nxjJyCseHItQOJcTxn+cLXs;

Здравствуйте уважаемые форумчане!

Столкнулся с данной ошибкой: ответы от
scgi сервера не сжимаются.

привожу код сервера на руби и
конфигурацию nginx (конфигурация
тестовая):

######################################################################

worker_processes 1;

events{
  worker_connections 1024;
}

http{
  server_tokens off;
   
  default_type text/plain;
  
  gzip on;
  gzip_types text/plain;
  
  types{
    text/plain js css txt;
  }
  
  server{
    return 404;
  }
  
  server{
    server_name localhost;
    
    scgi_buffering off;
    
    location / {
      try_files $uri @engine;
    }
    
    location @engine {
      include scgi_params;
      scgi_pass 127.0.0.1:9000;
    }
  }
}

######################################################################

#coding: utf-8

require "socket"
require "thread"
require "openssl"
require "erb"

scgid=Socket.new(Socket::AF_INET,Socket::SOCK_STREAM,0)
scgid.bind(Socket.pack_sockaddr_in(9000,"127.0.0.1"))
scgid.listen(1)

loop{
  scgi=scgid.accept[0]
  Thread.new{
    begin
      
      f=File.new(Time.now.to_f.to_s+".bin","wb")
      while(f.syswrite scgi.sysread 4096)==4096
      end
      f.close
      File.unlink f.path
      
      scgi.syswrite "Status: 200 OK\r\nContent-Type:
text/plain\r\n\r\n"
      
      scgi.syswrite "ok"
      
      #header_size   =""
      #header_pairs  =""
      #while (header_size=~/:/)==nil
      #  header_size+=scgi.sysread 1
      #end
      #header_size=header_size.to_i
      #while header_pairs.size<header_size
      #  header_pairs+=scgi.sysread 1
      #end
      
      #env=Hash[*header_pairs.split("\0")]
      
      #scgi.syswrite "Status: 200 OK\r\nContent-Type:
text/plain\r\nContent-Length: "+env.to_s.size.to_s+"\r\n\r\n"
      #scgi.syswrite env.to_s

      scgi.close
    rescue=>err
      p err
    end
  }
}

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?21,219800,219800#msg-219800

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.