Fix parse-content-type for quoted tokens
parent
43dd93d1fa
commit
81d23c3ac0
|
@ -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
|
||||||
|
|
||||||
|
[ "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
|
[ "application/octet-stream" binary ] [ "application/octet-stream" parse-content-type ] unit-test
|
||||||
|
|
||||||
: lf>crlf "\n" split "\r\n" join ;
|
: lf>crlf "\n" split "\r\n" join ;
|
||||||
|
|
|
@ -213,7 +213,10 @@ TUPLE: post-data data params content-type content-encoding ;
|
||||||
swap >>content-type ;
|
swap >>content-type ;
|
||||||
|
|
||||||
: parse-content-type-attributes ( string -- attributes )
|
: 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 )
|
: parse-content-type ( content-type -- type encoding )
|
||||||
";" split1
|
";" split1
|
||||||
|
|
Loading…
Reference in New Issue