Regression: HTTP server would fail to serve files with binary encoding after Dan's io.encodings.iana changes from earlier today

db4
Slava Pestov 2009-02-04 04:17:24 -06:00
parent cd77ecfab3
commit cb174f0db1
2 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,21 @@
USING: http http.server math sequences continuations tools.test ;
USING: http http.server math sequences continuations tools.test
io.encodings.utf8 io.encodings.binary accessors ;
IN: http.server.tests
[ t ] [ [ \ + first ] [ <500> ] recover response? ] unit-test
\ make-http-error must-infer
[ "text/plain; charset=UTF-8" ] [
<response>
"text/plain" >>content-type
utf8 >>content-charset
unparse-content-type
] unit-test
[ "text/xml" ] [
<response>
"text/xml" >>content-type
binary >>content-charset
unparse-content-type
] unit-test

View File

@ -97,10 +97,8 @@ GENERIC: write-full-response ( request response -- )
tri ;
: unparse-content-type ( request -- content-type )
[ content-type>> "application/octet-stream" or ]
[ content-charset>> encoding>name ]
bi
[ "; charset=" glue ] when* ;
[ content-type>> "application/octet-stream" or ] [ content-charset>> ] bi
dup binary eq? [ drop ] [ encoding>name "; charset=" glue ] if ;
: ensure-domain ( cookie -- cookie )
[