Making http use ASCII rather than Unicode; fixing encodings bug

db4
Daniel Ehrenberg 2009-03-18 18:49:59 -05:00
parent a282789910
commit d5af5027d0
1 changed files with 4 additions and 6 deletions

View File

@ -5,8 +5,7 @@ sequences splitting sorting sets strings vectors hashtables
quotations arrays byte-arrays math.parser calendar quotations arrays byte-arrays math.parser calendar
calendar.format present urls fry calendar.format present urls fry
io io.encodings io.encodings.iana io.encodings.binary io io.encodings io.encodings.iana io.encodings.binary
io.encodings.8-bit io.crlf io.encodings.8-bit io.crlf ascii
unicode.case unicode.categories
http.parsers http.parsers
base64 ; base64 ;
IN: http IN: http
@ -215,11 +214,10 @@ TUPLE: post-data data params content-type content-encoding ;
: parse-content-type-attributes ( string -- attributes ) : parse-content-type-attributes ( string -- attributes )
" " split harvest [ " " split harvest [
"=" split1 "=" split1
[ >lower ] [ "\"" ?head drop "\"" ?tail drop ] bi* "\"" ?head drop "\"" ?tail drop
] { } map>assoc ; ] { } map>assoc ;
: parse-content-type ( content-type -- type encoding ) : parse-content-type ( content-type -- type encoding )
";" split1 ";" split1
parse-content-type-attributes "charset" swap at parse-content-type-attributes "charset" swap at name>encoding
[ name>encoding ] [ dup "text/" head? latin1 binary ? ] unless* ;
[ dup "text/" head? latin1 binary ? ] if* ;