From 81d23c3ac09a951397fbc2b480a466c2253bd798 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 8 Mar 2009 17:33:17 -0500 Subject: [PATCH] Fix parse-content-type for quoted tokens --- basis/http/http-tests.factor | 2 ++ basis/http/http.factor | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index 2b9cd100f7..0d4282b1d7 100644 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -9,6 +9,8 @@ IN: http.tests [ "text/html" utf8 ] [ "text/html; charset=UTF-8" parse-content-type ] unit-test +[ "text/html" utf8 ] [ "text/html; charset=\"utf-8\"" parse-content-type ] unit-test + [ "application/octet-stream" binary ] [ "application/octet-stream" parse-content-type ] unit-test : lf>crlf "\n" split "\r\n" join ; diff --git a/basis/http/http.factor b/basis/http/http.factor index c7f10a789d..bf58f5c238 100755 --- a/basis/http/http.factor +++ b/basis/http/http.factor @@ -213,7 +213,10 @@ TUPLE: post-data data params content-type content-encoding ; swap >>content-type ; : parse-content-type-attributes ( string -- attributes ) - " " split harvest [ "=" split1 [ >lower ] dip ] { } map>assoc ; + " " split harvest [ + "=" split1 + [ >lower ] [ "\"" ?head drop "\"" ?tail drop ] bi* + ] { } map>assoc ; : parse-content-type ( content-type -- type encoding ) ";" split1