]> gitweb.factorcode.org Git - factor.git/commitdiff
http: Make parse-set-cookie matching case insensitive
authorGiftpflanze <gifti@tools.wmflabs.org>
Fri, 12 Mar 2021 11:52:55 +0000 (11:52 +0000)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 12 Mar 2021 15:41:02 +0000 (07:41 -0800)
basis/http/http.factor

index 45efd1f39b8c8c498b288e080bb0ab899b9743cd..0f5eff158a09a564671ccead2f00c920efff52f1 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs base64 calendar calendar.format
+USING: accessors arrays ascii assocs base64 calendar calendar.format
 calendar.parser combinators fry hashtables http.parsers io io.crlf
 io.encodings.iana io.encodings.utf8 kernel make math math.parser
 mime.types present sequences sets sorting splitting urls ;
@@ -52,7 +52,7 @@ TUPLE: cookie name value version comment path domain expires max-age http-only s
         f swap
         (parse-set-cookie)
         [
-            swap {
+            over >lower [ swapd ] dip {
                 { "version" [ >>version ] }
                 { "comment" [ >>comment ] }
                 { "expires" [ [ cookie-string>timestamp >>expires ] unless-empty ] }
@@ -61,8 +61,9 @@ TUPLE: cookie name value version comment path domain expires max-age http-only s
                 { "path" [ >>path ] }
                 { "httponly" [ drop t >>http-only ] }
                 { "secure" [ drop t >>secure ] }
-                [ <cookie> dup , nip ]
+                [ drop rot <cookie> dup , ]
             } case
+            nip
         ] assoc-each
         drop
     ] { } make ;