Ticket #105 (closed defect: duplicate)

Opened 2 years ago

Last modified 2 years ago

empty 'Set-Cookie' header bug

Reported by: moumar Owned by: somebody
Priority: minor Milestone:
Component: camping.rb Version: 1.5
Keywords: Cc:

Description

camping generate an empty 'Set-Cookie' header that lead to output too much "\r\n" when calling Controller#to_s.

This is ok when dealing with plain text (like HTML) output, but is problematic when generating binary content (like on-the-fly generated images), leading to corrupt files.

Here a patch

--- camping-unabridged.rb       2006-11-01 16:43:15.628963250 +0100
+++ camping_patched.rb  2006-11-01 16:44:37.334069500 +0100
@@ -420,7 +420,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)}; path=#{self/"/"}" if v != @k[k] } - [nil] unless @cookies.empty?
       self
     end

Change History

Changed 2 years ago by mst

  • status changed from new to closed
  • resolution set to duplicate

This was fixed in Changeset 171 http://code.whytheluckystiff.net/camping/changeset/171. Duplicate of ticket #98.

Note: See TracTickets for help on using tickets.