Changeset 15089 in project


Ignore:
Timestamp:
06/27/09 16:15:17 (11 years ago)
Author:
sjamaan
Message:

Update cookie-parser so it removes the stupid dollar signs

Location:
release/4/intarweb/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/intarweb/trunk/header-parsers.scm

    r15054 r15089  
    444444        (if (null? remaining)
    445445            (reverse cookies)
    446             (let ((cookie (cons (symbol->string (caar remaining))
    447                                 (cdar remaining)))
     446            (let ((cookie (car remaining))
    448447                  (params (cdr remaining)))
    449448              (receive (local-attrs rest)
    450449                (split-attribs params)
    451                 (let* ((all-attrs (append global-attrs local-attrs))
     450                (let* ((all-attrs (map
     451                                   (lambda (a) ; remove the $
     452                                     (cons
     453                                      (string->symbol
     454                                       (string-drop
     455                                        (symbol->string (car a)) 1))
     456                                      (cdr a)))
     457                                   (append global-attrs local-attrs)))
    452458                       (result (vector cookie all-attrs)))
    453459                  (loop rest (cons result cookies))))))))))
  • release/4/intarweb/trunk/tests/run.scm

    r15080 r15089  
    1 (require-extension test extras uri-common intarweb)
     1(require-extension test extras uri-common intarweb srfi-18)
    22
    33(define-syntax test-error*
     
    350350    (let* ((headers (test-read-headers "Cookie: foo=bar; $Path=/; qux=mooh; $unknown=something")))
    351351      (test "Multiple cookies in the same header"
    352             '(("foo" . "bar") . ("qux" . "mooh"))
     352            '((foo . "bar") . (qux . "mooh"))
    353353            (cons
    354354             (get-value (first  (header-contents 'cookie headers)))
     
    356356      (test "Parameters of cookies (spaces stripped)"
    357357            "/"
    358             (get-param '$path (first (header-contents 'cookie headers))))
     358            (get-param 'path (first (header-contents 'cookie headers))))
    359359      (test "Parameters of cookies"
    360360            "something"
    361             (get-param '$unknown (second (header-contents 'cookie headers)))))
     361            (get-param 'unknown (second (header-contents 'cookie headers)))))
    362362    (let* ((headers (test-read-headers "Cookie: $Version=\"1\"; foo=bar; $Path=/; qux=mooh; $unknown=something")))
    363363      (test "Version string is used for all cookies"
    364364            (cons 1 1)
    365365            (cons
    366              (get-param '$version (first (header-contents 'cookie headers)))
    367              (get-param '$version (second (header-contents 'cookie headers))))))))
     366             (get-param 'version (first (header-contents 'cookie headers)))
     367             (get-param 'version (second (header-contents 'cookie headers))))))))
    368368
    369369(test-group "Headers"
Note: See TracChangeset for help on using the changeset viewer.