in the spirit of minimal-impact 'leave no trace' principles, this patch adds a 
missing feature, the ability to remove cookies.

usage:

@cookies.redbean = nil


a side note, the trunk seems to be broken when using Markaby. i've tested this 
out using ngrep and firefox and opera w/ controllers that just return strings 
in any case..
Index: lib/camping.rb
===================================================================
--- lib/camping.rb      (revision 194)
+++ lib/camping.rb      (working copy)
@@ -25,7 +25,7 @@
 "post" and e.CONTENT_TYPE == "application/x-www-form-urlencoded"
 q.u C.qsp(@in.read)end;@cookies,@[EMAIL PROTECTED],q.dup end;def service*a
 @body=send(@method,*a)if [EMAIL PROTECTED];@headers["Set-Cookie"[EMAIL 
PROTECTED]
-|k,v|"#{k}=#{C.escape(v)}; path=#{self/'/'}"if [EMAIL PROTECTED];self end;def 
to_s
+|k,v|"#{k}=#{C.escape(v)};#{"max-age=0;"if !v}path=#{self/'/'}"if [EMAIL 
PROTECTED];self end;def to_s
 a=[];@headers.map{|k,v|[*v].map{|x|a<<"#{k}: #{x}"}};"Status: [EMAIL PROTECTED]
 [EMAIL PROTECTED]"end;end;X=module Controllers;@r=[];class<<self;def 
r;@r;end;def R*u
 [EMAIL 
PROTECTED];Class.new{meta_def(:urls){u};meta_def(:inherited){|x|r<<x}}end;def 
M;def M
Index: lib/camping-unabridged.rb
===================================================================
--- lib/camping-unabridged.rb   (revision 194)
+++ lib/camping-unabridged.rb   (working copy)
@@ -438,7 +438,7 @@
     # on before and after overrides with Camping.
     def service(*a)
       @body = send(@method, *a) if respond_to? @method
-      @headers['Set-Cookie'] = @cookies.map { |k,v| "#{k}=#{C.escape(v)}; 
path=#{self/"/"}" if v != @k[k] } - [nil]
+      @headers['Set-Cookie'] = @cookies.map { |k,v| 
"#{k}=#{C.escape(v)};#{"max-age=0;"if !v}path=#{self/"/"}" if v != @k[k] } - 
[nil]
       self
     end
 
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to