Ticket #152: fcgi_to_s.patch

File fcgi_to_s.patch, 1.5 kB (added by archengule, 8 months ago)

patch to change 'to_s' so it works w/ fcgi

  • camping.rb

     
    3434"application/x-www-form-urlencoded": q.u(C.qsp(@in.read))end 
    3535@cookies,@input=@k.dup,q.dup end;def service *a;@body=send @method,*a 
    3636headers['Set-Cookie']=cookies.map{|k,v|"#{k}=#{C.escape(v)}; path=#{self/ 
    37 "/"}"if v!=@k[k]}-[nil];self end;def to_s;"Status: #@status#{Z+(headers.inject([ 
    38 ]){|a,o|[*o[1]].map{|x|a<<[o[0],v]*": "if v&&v.to_s.any?}}*Z)+Z+Z}#@body"end 
     37"/"}"if v!=@k[k]}-[nil];self end;def to_s;"Status: #@status#{Z+(headers.map{ 
     38|k,v|[*v].map{|x|[k,v]*": "}}*Z+Z).gsub(Z*2,Z)+Z}#@body"end 
    3939end;X=module Controllers;@r=[];class<<self;def r;@r end;def R *u;r=@r 
    4040Class.new{meta_def(:urls){u};meta_def(:inherited){|x|r<<x}}end 
    4141def D p,m;r.map{|k|k.urls.map{|x|return(k.instance_method(m)rescue nil)? 
  • camping-unabridged.rb

     
    461461    # Used by the web server to convert the current request to a string.  If you need to 
    462462    # alter the way Camping builds HTTP headers, consider overriding this method. 
    463463    def to_s 
    464       "Status: #@status#{Z+(headers.inject([]){|a,o|[*o[1]].map{|x|a<<[o[0],v]*": "if v&&v.to_s.any?}}*Z)+Z+Z}#@body" 
     464      "Status: #@status#{Z+(headers.map{|k,v|[*v].map{|x|[k,v]*": "}}*Z+Z).gsub(Z*2,Z)+Z}#@body" 
    465465    end 
    466466 
    467467  end