To the best of my knowledge, the two attached patches should work on all common 
lisp implementations. Basically I just added an "as-keyword" function to the 
util.lisp of both chunga and drakma that checks the readtable-case and uses 
#'string-upcase to convert the string if it is :upcase, otherwise it uses 
#'string-downcase (since the symbols in your source files are typically typed 
in all lowercase).

The two places (one in chunga read.lisp and one in drakma request.lisp) that 
call (intern (string-upcase ..) :keyword) were replaced with the (as-keyword ) 
form.

I've attached the diff -u output trying to follow your patching rules.

If the attachment doesn't go through, I'll paste the patches in.

Ross
----- Original Message -----
From: "Edi Weitz" <[EMAIL PROTECTED]>
To: "General interest list for Drakma and Chunga" <drakma-devel@common-lisp.net>
Sent: Sunday, September 30, 2007 11:37:46 AM (GMT-0800) America/Los_Angeles
Subject: Re: [drakma-devel] utf-8 question

On Sun, 30 Sep 2007 10:40:24 -0700 (PDT), Ross Jekel <[EMAIL PROTECTED]> wrote:

> I'm using Allegro CL in case-sensitive modern mode (the
> default). There are several places in chunga and drakma that might
> do something like (intern (string-upper somevalue) :keyword) making
> uppercase symbols such as :CONTENT-TYPE for headers or :UTF-8 for
> encoding types. If there is any code that compares against the
> lower-case symbol (such as :content-type in get-content-type in
> drakma/read.lisp), the match fails.

Ah, good, thanks for the analysis.  I myself have never used "modern
mode" and I don't really care about it, so I won't "fix" this myself,
but if someone is interested in doing it, I'll gladly accept clean
patches, of course.

  http://weitz.de/patches.html

Thanks again,
Edi.
_______________________________________________
drakma-devel mailing list
drakma-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel
Common subdirectories: drakma-0.11.0.orig/doc and drakma-0.11.0/doc
diff -u drakma-0.11.0.orig/request.lisp drakma-0.11.0/request.lisp
--- drakma-0.11.0.orig/request.lisp     2007-10-01 01:04:04.000000000 -0700
+++ drakma-0.11.0/request.lisp  2007-10-01 22:25:25.000000000 -0700
@@ -50,8 +50,7 @@
                                            '("identity")
                                            :test #'equalp)))
             (let* ((charset (parameter-value "charset" params))
-                   (name (cond (charset (intern (string-upcase charset)
-                                                :keyword))
+                   (name (cond (charset (as-keyword charset))
                                (t external-format-in))))
               (make-external-format name :eol-style :lf)))))
     (error (condition)
diff -u drakma-0.11.0.orig/util.lisp drakma-0.11.0/util.lisp
--- drakma-0.11.0.orig/util.lisp        2007-10-01 01:04:04.000000000 -0700
+++ drakma-0.11.0/util.lisp     2007-10-01 22:20:11.000000000 -0700
@@ -272,4 +272,14 @@
         thereis (and (or (null candidate-type)
                          (string-equal type candidate-type))
                      (or (null candidate-subtype)
-                         (string-equal subtype candidate-subtype)))))
\ No newline at end of file
+                         (string-equal subtype candidate-subtype)))))
+
+(defun as-keyword (str)
+  "Converts a string to a keyword taking into account the readtable-case."
+  (intern (funcall
+            (if (eq (readtable-case *readtable*) :upcase)
+              #'string-upcase
+              #'string-downcase)
+            str)
+          :keyword))
+
Common subdirectories: chunga-0.4.0.orig/doc and chunga-0.4.0/doc
diff -u chunga-0.4.0.orig/read.lisp chunga-0.4.0/read.lisp
--- chunga-0.4.0.orig/read.lisp 2007-09-18 00:00:39.000000000 -0700
+++ chunga-0.4.0/read.lisp      2007-10-01 22:29:28.000000000 -0700
@@ -158,7 +158,7 @@
                (unless (zerop (length (trim-whitespace line)))
                  (let ((colon-pos (or (position #\: line :test #'char=)
                                       (error "Couldn't find colon in header 
line ~S." line))))
-                   (cons (intern (string-upcase (subseq line 0 colon-pos)) 
:keyword)
+                   (cons (as-keyword (subseq line 0 colon-pos))
                          (trim-whitespace (subseq line (1+ colon-pos)))))))
              (add-header (pair)
                "Adds the name/value cons PAIR to HEADERS.  Takes
diff -u chunga-0.4.0.orig/util.lisp chunga-0.4.0/util.lisp
--- chunga-0.4.0.orig/util.lisp 2007-01-01 15:39:36.000000000 -0800
+++ chunga-0.4.0/util.lisp      2007-10-01 22:16:16.000000000 -0700
@@ -43,3 +43,11 @@
     (or (null mismatch)
         (= mismatch (- (length seq) (length suffix))))))
 
+(defun as-keyword (str)
+  "Converts a string to a keyword taking into account the readtable-case."
+  (intern (funcall
+            (if (eq (readtable-case *readtable*) :upcase)
+              #'string-upcase
+              #'string-downcase)
+            str)
+          :keyword))
_______________________________________________
drakma-devel mailing list
drakma-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel

Reply via email to