[racket] Print Cookie Path issue

From: J G Cho (gcho at fundingmatters.com)
Date: Fri Jul 1 15:27:16 EDT 2011

(map (λ (item)
       (display (header-field item))
       (display " ")
       (display (header-value item))

       (list (cookie->header (make-cookie "id" "joseph" #:max-age 500
#:path "/"))))


Set-Cookie id=joseph; Max-Age=500; Path="/"; Version=1

I think it should be Path=/ without "". (I am guessing based on
looking at various cookies stored by FF 4 on OSX.)

Looking at net/cookie-unit.rkt, it's not obvious to me why "" are being printed.

(define (print-cookie cookie)
  (define (format-if fmt val) (and val (format fmt val)))
  (unless (cookie? cookie) (error* "cookie expected, received: ~a" cookie))
   (filter values
           (list (format "~a=~a" (cookie-name cookie) (cookie-value cookie))
                 (format-if "Comment=~a" (cookie-comment cookie))
                 (format-if "Domain=~a" (cookie-domain cookie))
                 (format-if "Max-Age=~a" (cookie-max-age cookie))
                 (format-if "Path=~a" (cookie-path cookie))
                 (and (cookie-secure cookie) "Secure")
                 (format "Version=~a" (or (cookie-version cookie) 1))))
   "; "))

Any thoughts what I can do to suppress printing ""?


Posted on the users mailing list.