Ignore:
Timestamp:
08/05/09 19:40:36 (12 years ago)
Author:
sjamaan
Message:

Add exception for URIs: those will probably never be quoted (but we should test with other special chars like quotes)

File:
1 edited

Legend:

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

    r15162 r15327  
    559559
    560560;; Unparse a value as token, converting it to a string first
    561 (define unparse-token
    562   (let* ((trigger-quoting-chars (char-set-union
    563                                  (char-set-adjoin must-be-quoted-chars #\, #\; #\=)
    564                                  char-set:blank)))
    565    (lambda (token)
    566      (let ((token-string (->string token)))
    567       (if (string-any trigger-quoting-chars token-string)
    568           (quote-string token-string)
    569           token-string)))))
     561(define (unparse-token token #!optional (separator-chars (char-set #\= #\; #\,)))
     562  (let ((trigger-quoting-chars
     563         (char-set-union must-be-quoted-chars separator-chars char-set:blank))
     564        (token-string (->string token)))
     565    (if (string-any trigger-quoting-chars token-string)
     566        (quote-string token-string)
     567        token-string)))
    570568
    571569;; There's no need to make a specific header unparser for every header type.
     
    586584                                       attribute
    587585                                       (unparse-token (cdr contents))))))
    588                        ((uri-reference? contents) (unparse-token (uri->string contents)))
     586                       ((uri-reference? contents)
     587                        (unparse-token (uri->string contents) (char-set)))
    589588                       (else (unparse-token contents))))
    590589               (parameter-unparsers '())) ; Maybe we want to make this a param
Note: See TracChangeset for help on using the changeset viewer.