Ticket #153: cookie_expires.patch
| File cookie_expires.patch, 1.6 kB (added by gunark, 5 months ago) |
|---|
-
lib/camping.rb
33 33 C.qsp(fn,'&;',fh,q)if fn;fh.tempfile.rewind if fh.is_a?H end;when 34 34 "application/x-www-form-urlencoded": q.u(C.qsp(@in.read))end 35 35 @cookies,@input=@k.dup,q.dup end;def service *a;@body=send @method,*a 36 headers['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([ 36 headers['Set-Cookie']=cookies.map{|k,v|"#{k}=#{C.escape(v[:value] || v)}; path=#{self/ 37 "/"}; expires=#{v[:expires] && v[:expires].strftime('%a, %d-%b-%Y %H:%M:%S %Z') 38 || nil}"if v!=@k[k]}-[nil];self end;def to_s;"Status: #@status#{Z+(headers.inject([ 38 39 ]){|a,o|[*o[1]].map{|v|a<<[o[0],v]*": "if v&&v.to_s.any?};a}*Z)+Z+Z}#@body"end 39 40 end;X=module Controllers;@r=[];class<<self;def r;@r end;def R *u;r=@r 40 41 Class.new{meta_def(:urls){u};meta_def(:inherited){|x|r<<x}}end -
lib/camping-unabridged.rb
454 454 # on before and after overrides with Camping. 455 455 def service(*a) 456 456 @body = send(@method, *a) 457 headers['Set-Cookie'] = cookies.map { |k,v| "#{k}=#{C.escape(v)}; path=#{self/"/"}" if v != @k[k] } - [nil] 457 headers['Set-Cookie'] = cookies.map { |k,v| 458 "#{k}=#{C.escape(v[:value] || v)}; path=#{self/"/"}; expires=#{v[:expires] && v[:expires].strftime('%a, %d-%b-%Y %H:%M:%S %Z') || nil}" if v != @k[k] 459 } - [nil] 458 460 self 459 461 end 460 462
