Changeset 11854 in project


Ignore:
Timestamp:
09/01/08 22:05:34 (11 years ago)
Author:
sjamaan
Message:

Allow spaces and tabs in unparsed tokens too by quoting them

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

Legend:

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

    r11853 r11854  
    318318(define unparse-token
    319319  (let* ((must-be-quoted-chars (char-set-adjoin char-set:iso-control #\"))
    320          (trigger-quoting-chars (char-set-adjoin must-be-quoted-chars #\, #\;))
     320         (trigger-quoting-chars (char-set-union
     321                                 (char-set-adjoin must-be-quoted-chars #\, #\;)
     322                                 char-set:blank))
    321323         (smap (map (lambda (c)
    322324                      (cons (string c)
  • release/4/intarweb/trunk/tests/run.scm

    r11853 r11854  
    293293          "Foo: bar, qux\r\n"
    294294          (test-unparse-headers `((foo "bar" "qux"))))
    295     (test "Auto-quoting"
    296           "Foo: \"bar, qux\"\r\n"
    297           (test-unparse-headers `((foo "bar, qux"))))
     295    (test "Auto-quoting on commas and whitespace"
     296          "Foo: \"bar, qux\", \"mooh blah\"\r\n"
     297          (test-unparse-headers `((foo "bar, qux" "mooh blah"))))
     298    ;; RFC 2616 2.2
    298299    (test "Escaping quotes"
    299300          "Foo: \"bar \\\" qux\", mooh\r\n"
    300301          (test-unparse-headers `((foo "bar \" qux" "mooh"))))
    301     (test "Escaping control characters"
     302    ;; XXX Should we interpret "\\\r\n" as "\r\n", too?
     303    (test "Escaping control characters and CRLF"
    302304          "Foo: \"bar\\\r\\\x01qux\"\r\n"
    303305          (test-unparse-headers `((foo "bar\r\x01qux"))))
Note: See TracChangeset for help on using the changeset viewer.