我有一个名为server.rb的Ruby脚本,我使用spawn-fcgi -a 127.0.0.1 -p 9001 /bin/ruby server.rb
打开。
正在运行sudo netstat -lnptu | grep :9001
告诉我ruby
正在收听。
我还设置了nginx以将.rb文件传递到127.0.0.1:9001
但是一旦我请求.rb文件:
ruby
来自netstat
2015/06/02 14:47:37 [error] 1852#0: *30 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /ruby/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "localhost", referrer: "http://localhost/"
server.rb
require "rubygems"
require "fcgi"
loop FCGI.each do |request|
File.write("test.txt", "Loading file #{__FILE__}!")
request.out.print "Content-Type: text/plain\\n\\nHello from #{__FILE__}"
request.finish
end
答案 0 :(得分:0)
问题在于:
UISlider
你正在逃避反斜杠,并且在输出中实际上没有换行符。会发生什么是客户端收到整行并将其视为标题,然后关闭连接
替换为:
\\n\\n